2

I have two files that need to be merged.

I can do this using the ffmpeg concat protocol

creating a text file and setting the files in there.

Like so:

files_to_be_merged.txt

file '/home/user/Videos/video1.mov'
file '/home/user/Videos/video2.mov'

and them using the following command.

ffmpeg -f concat -i mylist.txt -c copy output.mov

But I want to do that without having to create a text file.

I tried this command:

ffmpeg -i 'concat:video1.mov|video2.mov' -codec copy output.mov

But the resulting file is just the first video, not both together.

I get this warning while doing this command;

[mov @ 0x35933c0] Codec for stream 0 does not use global headers but container format requires global headers

[mov @ 0x35933c0] Codec for stream 1 does not use global headers but container format requires global headers

Community
  • 1
  • 1
f.rodrigues
  • 3,499
  • 6
  • 26
  • 62

1 Answers1

0

The two methods are different.

The one which uses the text file (-f concat) is the concat demuxer which is more flexible. It works if you have the same codecs but accepts different containers and more importantly works with any container format.

The second one (-i 'concat:file1|file2') is the concat protocol. It only works for formats that can be directly concatenated such as mpg or mpegts.

The mov format cannot be directly concatenated, so you must pass by the demuxer.

See the wiki for more info.

If you don't want to use a text file you can just extend the existing demuxer to add the functionality. It's an open-source project after all.

aergistal
  • 29,947
  • 5
  • 70
  • 92