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).
avconv
instead. Can you tell me how to split my big video file?