Ubuntu – Avconv ac3 to aac or mp3 is not synced with video

avconv

I'm trying to convert a MPEG2 file to H264/AAC.

No problem about video, but when I convert Audio: ac3, 48000 Hz, stereo, s16, 255 kb/s to MP3 or AAC, with any bitrate, the sound is not synced with the video. The sound is in advanced to video when I play it.
How to fix it please ?

More information : the source video is 1h30 long and 3,4 Gio.

Best Answer

To sync the audio stream with video time stamps we may use the -async option:

-async samples_per_second
Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, the parameter is the maximum samples per second by which the audio is changed. -async 1 is a special case where only the start of the audio stream is corrected without any later correction. This option has been deprecated. Use the asyncts audio filter instead.
Libav documentation

Begin to try with samples per second matching your framerate and decrease until your audio is in sync:

avconv -async 30 -i <infile> <encoding options> -r 30 <outfile>