1

I am developing a service to concat a video (mine) with a another from a user (he/she upload it) and return to user.

First I tried to use Concat demuxer because I don't want to re-encode videos if it is not needed. It is supposed that with same codec it should concat videos almost immediately.

Users may upload different videos with different codecs so I will need to convert that video to a certain codec. The problem that I have now is that even having videos with same codec concat is not working well, so I would like to know what else is needed.

My mylist.txt

file './myVideo1.mp4'
file './userVideo1.mp4'

Command:

ffmpeg -f concat -i mylist.txt -c copy mergedVideo.mp4

It didn't work because there were different audio codecs (pcm_u8 vs aac) so I converted myVideo1 audio to aac with;

ffmpeg -i myVideo1.mp4 -map 0:0 -map 0:1 -acodec libfaac -vcodec copy myVideo1_aac.mp4

This was an intermediate task, I mention it because I had a warning:

Codec for stream 0 does not use global headers but container format requires global headers

At this point I have two videos with same audio and codec, lets see details: myVideo1_aac.mp4 userVideo1.mp4 info

I tried to concat videos as before...

ffmpeg -f concat -i mylist.txt -c copy mergedVideo.mp4

... and there were no errors shown, but when I played the video I saw first video normal however 2nd was super slow, only few frames per second, in fact mergedVideo.mp4 has 4 minutes and 34 seconds when it should have 39s (5.38 + 33.79).

Here is mergedVideo.mp4 info: enter image description here

Can you tell me what is wrong?

  • Your videos run at different framerates (25 and 27.54) and have different tbr/tbn/tbc. I'd suggest you reencode your second video to match those of the first one. – Ely Jul 31 '15 at 1:46
  • Do you know the command to do it? I Changed the frame rate but I still need to change tbr/tbn/tbc. Thanks – Mikel Aug 4 '15 at 9:27

Your Answer

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

Browse other questions tagged or ask your own question.