[FFmpeg-user] Mjpeg to h264 audio sync problem

Petr Tresnak peter.cherry at quick.cz
Thu Dec 4 09:41:02 CET 2014

I am trying to convert Canon MJPEG to MP4 (h264/AAC) but after conversion, the start of the audio is cut and sound is not synchronized.
ffmpeg  -i mjpeg.avi -c:v libx264 -preset slow -crf 13 -pix_fmt yuvj420p -c:a libfdk_aac -b:a 192k output.mp4
ffmpeg -async 1 -i mjpeg.avi -avoid_negative_ts 0 -c:v libx264 -preset slow -crf 13 -pix_fmt yuvj420p -c:a libfdk_aac -b:a 192k output.mp4

If I convert just audio, the aac file is fine (not cut)
ffmpeg  -i mjpeg.avi -c:a libfdk_aac -b:a 192k output.aac

Here you have INPUT and OUTPUT properties (I see problem with start in mp4 file?):

Duration: 00:00:14.30, start: 0.000000, bitrate: 14883 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x480, 14823 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream #0:1: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11024 Hz, 1 channels, u8, 88 kb/s

Duration: 00:00:14.49, start: 0.185760, bitrate: 11124 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 640x480, 11197 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc (default)
handler_name    : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 11025 Hz, mono, fltp, 66 kb/s (default)
handler_name    : SoundHandler

Thanks for help

More information about the ffmpeg-user mailing list