How to extract a section from a video with ffmpeg?
How to cut a video, without re-encoding
Use this to cut video from [start]
for [duration]
:
ffmpeg -ss [start] -i in.mp4 -t [duration] -c copy out.mp4
Here, the options mean the following:
-ss
specifies the start time, e.g.00:01:23.000
or83
(in seconds)-t
specifies the duration of the clip (same format).- Instead of
-t
you can also supply the end time with-to
. -c copy
copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them. This won't harm the quality and make the command run within seconds.
Note that if you've used -ss
, you have to subtract this from the -to
timestamp. For example, if you cut with -ss 3 -i in.mp4 -to 5
, the output will be five seconds long.
For more info, see https://trac.ffmpeg.org/wiki/Seeking
No comments:
Post a Comment