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.
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With