Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg to combine two mov files from iPhone

Tags:

ffmpeg

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.

like image 617
Jason Stallings Avatar asked Apr 09 '13 17:04

Jason Stallings


People also ask

Can you concatenate mp4 files?

mp4 and file2. mp4 . You can concatenate these files using the concat demuxer (documentation) easily if their properties match. That is, they have the same height, width, pixel formats, codecs, etc.


1 Answers

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)

like image 124
Krumelur Avatar answered Sep 16 '22 21:09

Krumelur