Splitting an MP4 into 2 halves
I recorded a friend’s stag do on a new video camera that produced a 4.5 GB video file. I wanted to stream this down to the telly and play it on the Xbox but the wifi bandwidth wasn’t quite beefy enough, so it was stuttery.
I then entered a world of hell trying to put it onto a removable media but none of that worked.
- First I tried to copy the 4.5GB on to a FAT32 memory stick, but the file system format wouldn’t take a file bigger than 4GB.
- Then I formatted the memory stick to NTFS which would accept the extra large file, but the XBox wouldn’t read this - weird thanks Microsoft!
- Next I thought of DVDs. ULead DVD burning software can only burn Joliet for the data file system and this wouldn’t accept the large file size either.
- Go to: http://ffmpeg.arrozcru.org/autobuilds/
- Download the Latest static builds for MacOs or Windows.
- Use 7-Zip to unpack the file into a local directory.
- That’s it, there’s no installer!
ffprobe stagdo-1080p.mp4This should produce the duration of the video file (I’ve highlighted it, because I’m nice).
FFprobe version SVN-r25924, Copyright © 2007-2010 the FFmpeg developers built on Dec 10 2010 04:13:08 with gcc 4.4.2 configuration: –enable-gpl –enable-version3 –enable-libgsm –enable-pthreads –enable-libvorbis –enable-libtheora –enable-libspeex –enable-libmp3lame –enable-libopenjpeg –enable-libschroedin ger –enable-libopencore_amrwb –enable-libopencore_amrnb –enable-libvpx –disable-decoder=libvpx –arch=x86 –enable-runtime-cpudetect –enable-libxvid –enable-libx264 –extra-libs=’-lx264 -lpthrea d’ –enable-librtmp –extra-libs=’-lrtmp -lpolarssl -lws2_32 -lwinmm’ –target-os=mingw32 –enable-avisynth –cross-prefix=i686-mingw32- –cc=’ccache i686-mingw32-gcc’ –enable-memalign-hack libavutil 50.34. 0 / 50.34. 0 libavcore 0.16. 0 / 0.16. 0 libavcodec 52.99. 1 / 52.99. 1 libavformat 52.88. 0 / 52.88. 0 libavdevice 52. 2. 2 / 52. 2. 2 libavfilter 1.68. 1 / 1.68. 1 libswscale 0.12. 0 / 0.12. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ’stagdo-1080p.mp4′: Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.56.0 Duration: 02:28:07.92, start: 0.000000, bitrate: 4567 kb/s Stream #0.0(eng): Video: h264, yuv420p, 1920x800 [PAR 1:1 DAR 12:5], 4400 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 47.95 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 159 kb/s Metadata: creation_time : 1970-01-01 00:00:00From the example we can see the video is 2 hours 28 minutes 7 seconds and 92/100th of a second. We want 2 halves so divide by 2, if you want thirds you’ll have to divide by 3, if you want quarters…. just kidding! A bit of arithmetic and we can work out the start and end times of each section you would like to copy out of the main MP4 file. FFMPEG only ran on one of my 8 cores so if you open 2 command line boxes you can run them at the same time on different cores, so it took the same time to decode both halves as it would have done to decode one half.
ffmpeg -i stagdo-1080p.mp4 -ss 00:00:00 -t 01:04:06 -vcodec copy stagdo-1.mp4 ffmpeg -i stagdo-1080p.mp4 -ss 01:04:06 -t 01:24:06 -vcodec copy stagdo-2.mp4
- -i - input file name. I used MP4 but FFMPEG supports many different video and audio file formats.
- -ss - start time in hours, minutes and seconds.
- -t - time or duration in hours, minutes and seconds.
- -vcodec - video codec to use. We use copy which just copies the data exactly as it’s written.
- Finally the name of the output file.
FFmpeg version SVN-r25924, Copyright © 2000-2010 the FFmpeg developers built on Dec 10 2010 04:13:08 with gcc 4.4.2 configuration: –enable-gpl –enable-version3 –enable-libgsm –enable-pthreads –enable-libvorbis –enable-libtheora –enable-libspeex –enable-libmp3lame –enable-libopenjpeg –enable-libschroedin ger –enable-libopencore_amrwb –enable-libopencore_amrnb –enable-libvpx –disable-decoder=libvpx –arch=x86 –enable-runtime-cpudetect –enable-libxvid –enable-libx264 –extra-libs=’-lx264 -lpthrea d’ –enable-librtmp –extra-libs=’-lrtmp -lpolarssl -lws2_32 -lwinmm’ –target-os=mingw32 –enable-avisynth –cross-prefix=i686-mingw32- –cc=’ccache i686-mingw32-gcc’ –enable-memalign-hack libavutil 50.34. 0 / 50.34. 0 libavcore 0.16. 0 / 0.16. 0 libavcodec 52.99. 1 / 52.99. 1 libavformat 52.88. 0 / 52.88. 0 libavdevice 52. 2. 2 / 52. 2. 2 libavfilter 1.68. 1 / 1.68. 1 libswscale 0.12. 0 / 0.12. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ’stagdo-1080p.mp4′: Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.56.0 Duration: 02:28:07.92, start: 0.000000, bitrate: 4567 kb/s Stream #0.0(eng): Video: h264, yuv420p, 1920x800 [PAR 1:1 DAR 12:5], 4400 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 47.95 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 159 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Output #0, mp4, to ’stagdo-1.mp4′: Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf52.88.0 Stream #0.0(eng): Video: libx264, yuv420p, 1920x800 [PAR 1:1 DAR 12:5], q=2-31, 4400 kb/s, 2997 tbn, 23.98 tbc Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 64 kb/s Metadata: creation_time : 1970-01-01 00:00:00 Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press [q] to stop encoding frame=92212 fps=251 q=-1.0 Lsize= 2044520kB time=3845.97 bitrate=4354.9kbits/s video:2011880kB audio:30079kB global headers:0kB muxing overhead 0.125418%Each 1 hour 4 minute (and 6 second) section took about 6 minutes to copy. Once the files were split they both fitted on my FAT32 memory stick. The first half played very happily on the XBox, but unfortunately the second half was about 0.25 seconds out of audio sync, so if anyone knows what I can do to adjust the audio, I’d be grateful if they would leave a comment.
2 comments
Comment from: Anonymous [Visitor]

Put -ss and -t parameters before -i
Comment from: dave [Visitor]

download and use iDealshare VideoGo to split MP4 files into many tracks on Mac OS X Yosemite; it also applies to splitting MP4 videos on Windows.
Form is loading...