13

I have a 2 hour video. I want to make 30 minute sections but avoid re-encoding. So 2 hours of video into four 30 minute videos. How can I do this using a single ffmpeg command?

I am using Ubuntu 16.04 64-bit.

4
  • Do you mean you wanna split your 2-hour video in 30-min pieces, so you will have 4 pieces with 30-min each?
    – Redbob
    Commented Aug 21, 2017 at 11:51
  • Yes. How to ? Please I ask for command Commented Aug 21, 2017 at 12:12
  • Possible duplicate of askubuntu.com/questions/56022/….
    – Redbob
    Commented Aug 21, 2017 at 12:47
  • What is this purpose? -acodec copy -ss 00:30:00 -t 00:30:00 output2.avi Commented Aug 21, 2017 at 12:51

1 Answer 1

25

You can use the segment muxer:

ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 1800 -reset_timestamps 1 output_%03d.mp4
  • In this example output files will be named output_000.mp4, output_001.mp4, etc.

  • Segments may not be exactly 30 minutes long because it must cut on keyframes only.

1
  • You can also format the arguments for -segment_time in hours, minutes, and seconds (eg. 01:00:00)
    – plunker
    Commented May 21, 2023 at 3:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .