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:
6868- [Convert video to WebM](# convert-video-to-webm)
6969- [Edit two images and/or videos to display next to each other, horizontally](# create-a-horizontal-stack)
7070- [Resize an image](# resize-an-image)
71+ - [Extract clip from a video](# extract-clip-from-a-video)
7172- [Extract frames from a video](# extract-frames-from-a-video)
7273- [Modify video speed](# modify-video-speed)
7374
@@ -172,6 +173,15 @@ Usage:
172173```bash
173174sh index.sh resize assets/image.png 0.5
174175```
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+ ```
175185
176186### Extract frames from a video
177187
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 11#! /bin/bash
22
33# 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-
104if [ " $# " -lt 1 ]; then
115 echo " Error: Insufficient number of arguments for filenames. Need at least one file."
126 echo " Usage: ./script.sh <filename1>"
You can’t perform that action at this time.
0 commit comments