videoffmpegavconv

How to segment mp4 with ffmpeg or avconv, fast, where times are specified?


I need to segment mp4 in specified pieces. They are all different durations. Example segmentation:

1 - 0:00:00 to 0:01:11
segment 2 - 0:01:11 to 0:04:24
segment 3 - 0:05:51 to 0:06:30
...

I already wrote a script extracting them one by one, but it is pretty slow. I guess because it wastes a lot of time opening the file, decoding and seeking from the beginning.


Solution

  • ffmpeg has the option

    - segment_times times 
      Specify a list of split points. times contains
      a list of comma separated duration specifications,
      in increasing order. See also the segment_time option.