KOMPX.COM or COMPMISCELLANEA.COM   

Splitting video file. FFmpeg

Splitting video files by means of ffmpeg in Linux. There are two ways how to split video files by ffmpeg. The first one is good in itself, more than that, it is faster, but sometimes creates output files with certain flaws. So for those cases there is the second way: it is considerably slower, the output files are larger, but it seems they are always of the same quality level as the input files used.

The first way:


ffmpeg -ss <start> -t <duration> -i in1.avi -vcodec copy -acodec copy out1.avi

Another one:


ffmpeg -ss <start> -t <duration> -i in1.avi -sameq out1.avi

<start> - the beginning of the part of a video ffmpeg is to cut out. Format: 00:00:00 → hours:minutes:seconds → hh:mm:ss.

<duration> - the duration of the part of a video ffmpeg is to cut out. Format: 00:00:00 → hours:minutes:seconds → hh:mm:ss.

Examples

The first way:


ffmpeg -ss 01:19:00 -t 00:05:00 -i in1.avi -vcodec copy -acodec copy out1.avi

Another one:


ffmpeg -ss 01:19:00 -t 00:05:00 -i in1.avi -sameq out1.avi

ffmpeg cuts out a part of the video file starting from 1 hour 19 minutes 0 seconds. The duration of the video sequence cut out is 5 minutes 0 seconds.

More about ffmpeg:

Operating systems
More