Jason Stallings
Jason Stallings

Reputation: 1473

ffmpeg to combine two mov files from iPhone

I'm trying to combine two videos recorded on an iPhone into one file with ffmpeg.

I've tried everything I could find and I can't get anything to work right.

My current line is

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

This currently won't work. The end result needs to be played on an iPhone.

Upvotes: 6

Views: 6416

Answers (1)

Krumelur
Krumelur

Reputation: 32497

Since you are not transcoding, you cannot concatenate two mp4 containers just like that. See this page.

In essence, you have 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'll need a recent version of ffmpeg. Try sudo apt-get update; sudo apt-get install ffmpeg (on Ubuntu Linux) or brew update; brew install ffmpeg (on Mac OS X)

Upvotes: 11

Related Questions