0

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?

  • The videostream ist not H.264 (MPEG 4 AVC) bit H.263 (MPEG4 ASP aka xvid/divx) – stoney Jul 14 '17 at 12:14
  • you can try this answer – akraf Jul 14 '17 at 12:15
  • I can't, the problem is for first/second commands... – pirmax Jul 14 '17 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 '17 at 13:28
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.