How to merge 2 mp4 files with 1 atom?

How to merge 2 mp4 files with 1 atom?

I'm merging two mp4 files for video streaming. the problem is, the merged file contains two atoms, 1 atom from each file and that is a problem when it comes to streaming. the client needs to wait until the first atom loads from file1, than when it's time to play second part from file2 client will wait again for the atom to be loaded. when your atom is small you may not notice this, but when you stream a large video, atom could weight 7-10mb.

How can I remove those two atoms from merged file and create a new one?

what i've tried:

ffmpeg -i file1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i file2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc m.file.mp4

MP4Box -add m.file.mp4 -isma mf.file.mp4
mv mf.file.mp4 m.file.mp4

答案1

I'm not sure what you mean by removing the 'moov' atoms/boxes. MP4Box -add merges both 'moov' boxes/atoms into one. If you want to make the initial playback start faster when you download it, you should try fragmenting your file or using MPEG DASH (in particular the onDemand profile)

相关内容