mardi 30 décembre 2014

ffmpeg video and audio duration differ

I am converting a jpg picture and an mp3 audio into a video, like so:



ffmpeg -y -loop 1 -i pics\jam_03.jpg -i mp3\jam_03.mp3 -shortest -c:v mpeg4 -b:v 4000k -c:a libmp3lame jam_03.mp4


When concatenating several of such videos to one (a narrated presentation) like this:



ffmpeg -i "concat:jam_00.avi|jam_01.avi|jam_02.avi|jam_03.avi|jam_04.avi|jam_05.avi|jam_06.avi|jam_07.avi|jam_08.avi" -c:v copy -c:a copy out.mp4 -y


video and audio successively get out of sync. Indeed using ffprobe



ffprobe -show_streams jam_03.avi


different length are shown for video and audio e.g. 5.12 and 5.19 sec. I have tried a lot: x264 and aac codecs instead of the above ones, avi or mp4 container format, cutting the video using -t 5.12, also several variants of audio and video synchronisation (-async 1, -async 25, -async 100, -vsync 1, -vsync 2, ...) all yield more or less the same. My idea is that each video frame is 1/25 sec long and audio must be multiple of this. However, 5.12sec (=multiple of 1/25sec) shows no success.


Any ideas?


thanks


Aucun commentaire:

Enregistrer un commentaire