Let's just say i was trying to learn how to better use ffmpeg,
and started asking myself "What are the things i needed when working with video content?".
And this is one of the things that came to mind.
A simple way to extract a clip from an starting point and length of a video file,
and exporting that into another video file with minimal quality loss.
Here are some ways on how i managed to do exactly that.
Using ffmpeg to extract a clip from a specific time point in the video
#!/usr/bin/env bash
INPUT_FILEPATH = " ${ 1 } "
START_TIME = " ${ 2 } "
CLIP_DURATION_TIME = " ${ 3 } "
OUTPUT_FILEPATH = " ${ INPUT_FILEPATH } .clip"
ffmpeg \
-ss ${ START_TIME } \
-i ${ INPUT_FILEPATH } \
-t ${ CLIP_DURATION_TIME } \
-c copy \
${ OUTPUT_FILEPATH }
The Bash script takes 3 arguments in total, with the last being optional:
The 1. one is the filepath to the video file.
The 2. one is the starting time, from which to extract the clip. The expected input format is HH:MM:SS, meaning hours, minutes and seconds in two digits.
The 3. one is the duration of the clip. The expected input format is HH:MM:SS, meaning hours, minutes and seconds in two digits.
The clipped video file will have the suffix ".clip" added to the output filename.
Proudly powered by Pelican , which takes great advantage of Python .
The theme is by Smashing Magazine , thanks!