I read the following thread, and the solution works if I want to split a video into pieces every two minutes: Split video file into pieces with ffmpeg

The problem is that I want to split a video into pieces every 15 seconds.

When I use the following command:

for i in {00..49}
 do ffmpeg -i fff.avi -sameq -ss 00:$[ i*2 ]:00 -t 00:00:15 output_$i.avi

it will output 15-second video sequences, but not in order. It will skip parts of the video, so I end up with a few 15 second clips, but not all the clips. I want to be able to use ffmpeg to split any video I throw at it into many pieces based on the time I give it.

1 Answer 1


I found the answer. It turns out I was having problems because I didn't have the proper FFmpeg installed, but a fork of ffmpeg.

This code works for me:

ffmpeg -i fff.avi -acodec copy -f segment -segment_time 10 -vcodec copy -reset_timestamps 1 -map 0 fff%d.avi

fff.avi is the name of the source clip. Change -segment_time 10 to the general duration you want for each segment. If you want each clip to be about 40 seconds, then use -segment_time 40. Use -an after -map 0 if you don't want the resulting clips to have sound.

  • 1
    Too bad that I have run the command at first, deleted the source video and have read about -an flag at last.
    – Pehat
    Aug 9, 2016 at 21:31
  • 1
    @Pehat That's unfortunate. I removed -an from the code. You might be able to retrieve your source video with Photorec: linux-magazine.com/Online/Features/…
    – whitewings
    Aug 9, 2016 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.