Ffmpeg merge two mov files with iPhone

I am trying to combine two videos recorded on an iPhone into a single file with ffmpeg.

I tried everything I could find, and I cannot get something to work correctly.

My current line

ffmpeg -i 'concat:output.mov|capturedvideo.MOV' -vcodec copy -acodec copy output2.mov

This will not work at present. The end result should play on the iPhone.

+5
source share
1 answer

Since you are not transcoding, you cannot merge two mp4 containers in exactly the same way. See this page .

Essentially, you need to convert the files (without transcoding) to MPEG transport streams:

ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

You will need the latest version ffmpeg. Try sudo apt-get update; sudo apt-get install ffmpeg(on Ubuntu Linux) or brew update; brew install ffmpeg(on Mac OS X)

+7
source

All Articles