To merge two MP4 file, it's necessary to pass by .ts file.

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

But, I have this error on first/second command:

Codec 'mpeg4' (13) is not supported by the bitstream filter 'h264_mp4toannexb'. Supported codecs are: h264 (28) Error initializing bitstream filter: h264_mp4toannexb

enter image description here

Have you got an idea?

  • 1
    The videostream ist not H.264 (MPEG 4 AVC) bit H.263 (MPEG4 ASP aka xvid/divx)
    – stoney
    Jul 14, 2017 at 12:14
  • you can try this answer
    – akraf
    Jul 14, 2017 at 12:15
  • I can't, the problem is for first/second commands...
    – pirmax
    Jul 14, 2017 at 13:25
  • I'll tried this sorry, I have result: VLC open file but the time of the video is duplicated, I can't advance in time, and the second file isn't visible/audible.
    – pirmax
    Jul 14, 2017 at 13:28

2 Answers 2


You're trying to do it using the concat protocol which concatenates at the file level.

Do you get better results if you try to concatenate via the demuxer?

You would list your input files in a text file (mylist.txt) and then:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

The -safe 0 is not required if the paths are relative.

This method and the one you tried are both suggested here on ffmpeg.org as well as various other methods of concatenation. Surely there is one there that will work for you? If all else fails you could transcode them to h264 first, which apparently they are not already in.


Here's your problem

Stream #0:0[0x1]: Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),

as stated by @stoney, it needs to be

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661)

You can verify this by first recoding to h264.

ffmpeg -i input1.mp4 output1.mp4
ffmpeg -i output1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts input1.ts

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .