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:
-ssspecifies the start time, e.g.00:01:23.000or83(in seconds)-tspecifies the duration of the clip (same format).- Instead of
-tyou can also supply the end time with-to. -c copycopies 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