File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ To get started, check out the table of contents below and follow these steps:
68
68
- [Convert video to WebM](# convert-video-to-webm)
69
69
- [Edit two images and/or videos to display next to each other, horizontally](# create-a-horizontal-stack)
70
70
- [Resize an image](# resize-an-image)
71
+ - [Extract clip from a video](# extract-clip-from-a-video)
71
72
- [Extract frames from a video](# extract-frames-from-a-video)
72
73
- [Modify video speed](# modify-video-speed)
73
74
@@ -172,6 +173,15 @@ Usage:
172
173
```bash
173
174
sh index.sh resize assets/image.png 0.5
174
175
```
176
+ ### Extract clip from a video
177
+
178
+ This command will extract a clip from the video using timestamps. The command requires a start and end timestamp following this format: HH:MM:SS.
179
+
180
+ Usage:
181
+
182
+ ```bash
183
+ sh index.sh extract-clip assets/video.mp4 00:00:05 00:00:20
184
+ ```
175
185
176
186
### Extract frames from a video
177
187
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ if [ " $# " -lt 3 ]; then
4
+ echo " Error: Insufficient args provided."
5
+ echo " Usage: ./script.sh <filename1> 00:00:05 00:00:10..."
6
+ exit 1
7
+ fi
8
+
9
+ arguments=(" $@ " )
10
+
11
+ video_file_name=" ${arguments[0]} "
12
+ extension=" ${video_file_name##* .} "
13
+
14
+ startTime=" ${arguments[1]} "
15
+ endTime=" ${arguments[2]} "
16
+
17
+ ffmpeg -loglevel quiet -i " $video_file_name " -ss " $startTime " -to " $endTime " -c:v copy -c:a copy assets/clip." ${extension} "
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# Check if the script is called with the correct number of arguments
4
- if [ " $# " -eq 0 ]; then
5
- echo " Error: No filenames provided."
6
- echo " Usage: ./script.sh <filename1> <filename2> ..."
7
- exit 1
8
- fi
9
-
10
4
if [ " $# " -lt 1 ]; then
11
5
echo " Error: Insufficient number of arguments for filenames. Need at least one file."
12
6
echo " Usage: ./script.sh <filename1>"
You can’t perform that action at this time.
0 commit comments