1 | initial version |
You can use the -ss
and -to
options in ffmpeg to extract a specific range from a video. The -ss
option sets the start timestamp and the -to
option sets the end timestamp. The timestamps should be in the format HH:MM:SS
.
Here's a basic example:
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4
In this command:
-i input.mp4
specifies the input file.-ss 00:01:00
sets the start time of the cut to 1 minute.-to 00:02:00
sets the end time of the cut to 2 minutes.-c copy
copies the input streams to the output file. This means the command won't re-encode the video and audio streams, which makes it run faster.output.mp4
is the output file.This command will extract a 1-minute clip from the input video, starting at 1:00 and ending at 2:00.
Please note that when using -c copy
, the cut may not be precise, because it's limited to existing keyframes. If you need a precise cut, you should remove -c copy
, which will cause ffmpeg to re-encode the video:
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 output.mp4
This command will give you a more precise cut, but it will take longer to run.