Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to split a long 50 minute video file into two 25 minute parts. I finally found out how to stream one video file into another video file via the command line thanks to and docs.

Here is the terminal command I used to achieve this:

vlc original_video.mp4 --start-time 0 --stop-time 1500 --sout "#standard{access=file,mux=ts,dst=/home/max/Desktop/video_A.mp4}"

The only problem is that it seems as though VLC is just sitting there streaming the original_video.mp4 into video-A.mp4. I stopped it after 5 minutes and saw that video_A.mp4 was only 5 minutes long.

Is there a way to exedite this process?

share|improve this question
Are you open to options other than VLC? I know that ffmpeg can do what you're trying to do (because I've done it myself), and it should even be lossless. – evilsoup Apr 28 '13 at 17:32
Sure I am open to it. I just installed ffmpeg on Ubuntu although when I try to use it in Terminal it tells me to use avconv instead. Can you tell me how to split my big video file? – max Apr 28 '13 at 19:57

I would use ffmpeg's segment muxer (scroll down a bit on that link for some examples). Basically:

ffmpeg -i input.mp4 -c copy -f segment -segment_times 1500 output%02d.mp4

This will produce two files, 'output01.mp4' and 'output02.mp4'. If you were to use output%03d.mp4, you would instead get 'output001.mp4' and 'output002.mp4'.

-segment_times calls for a comma-separated list of split-points, measured in seconds. As you only want to split once, at 25 minutes, just use 1500 (=25*60). Note that -segment_time (without the 's') is a completely separate option - you'd use that if you wanted to split the file every five seconds (for example), without putting in a big list of every specific time.

You may find that you need to use -reset_timestamps 1 for the files to play correctly:

ffmpeg -i input.mp4 -c copy -f segment -segment_times 1500 -reset_timestamps 1 output%02d.mp4

There are a lot more options on the documentation page. This should be pretty quick, and lossless (so you'll get identical video with no extra video artefacts). However, it won't be 100% accurate, since ffmpeg needs to split on a key frame, which can't be guaranteed without re-encoding.

If you need accurate splitting, the documentation recommends re-encoding and using the -force_key_frames and -segment_time_delta options to ensure that there will be I-frames on the times that the segment muxer will attempt to split on (see also the libx264 and AAC encoding guides on the ffmpeg wiki):

ffmpeg -i input.mp4 -c:v libx264 -crf 22 -preset veryfast -c:a libfdk_aac -vbr 3 \
-force_key_frames 1500 -f segment -segment_times 1500 -segment_time_delta 0.05 output%02d.mp4

The version of ffmpeg in most Linux repositories is going to be quite old, and in the case of Debian and Ubuntu et al the situation is even worse: they do not provide ffmpeg, but rather the fork, avconv, from the libav team (see also LordNeckbeard's answer here). AVconv is a perfectly fine tool on its own, but I can't guarantee that the ffmpeg syntax will work with it 100% of the time, especially with 'advanced' stuff like this.

I would recommend either grabbing a static build from the ffmpeg Downloads page or compiling it yourself. The main benefit of compiling it yourself is that you can get access to libfdk_aac, the best AAC audio encoder that ffmpeg can use - which cannot be legally distributed in a compiled ffmpeg binary, due to licensing conflicts (fdk_aac uses a custom copyleft license, which isn't quite compatible with ffmpeg's GPL).

share|improve this answer
Hmm thanks but I get an error Unrecognized option 'segment_times' when I try ffmpeg -i file.mp4 -c copy -f segment -segment_times 1500 output%02d.mp4 and when I change it to -segment_time I get this error Output file #0 does not contain any stream – max May 6 '13 at 20:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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