[libav-tools] Converting video format when audio is out of sync

Luca Barbato lu_zero at gentoo.org
Thu Apr 23 18:06:56 CEST 2015


On 21/04/15 16:08, Derrell Lipman wrote:
> I have a .mkv file that plays properly using avplay 0.8.17 from Ubuntu
> (with no specified command-line options), but plays with video/audio out of
> sync when using any other program I've tried. I have been unsuccessful at
> finding avconv options that will convert this file to .mp4 with proper
> video/audio sync. *What are the avconv options that are equivalent to the
> defaults of avplay?*
> 
> The file is an hour-long video, so it would be useful, for testing, to use
> the -t option to convert only the first N seconds of the video, but that
> option seems to have no effect.
> 
> Your help will be greatly appreciated! Following is the output of avprobe
> on my .mkv file.
> 
> 
> avprobe version 0.8.17, Copyright (c) 2007-2014 the Libav developers
>   built on Apr 21 2015 09:23:53 with gcc 4.6.3

Update to a recent version please

    https://launchpad.net/~motumedia/+archive/ubuntu/libav-daily

Then some caveats:

-t works before or after -i, the current version of libav has avconv
working correctly in both, but keep in mind that in one case it relies
mainly on the demuxer in the other takes the decoder output as input to
decide the time.

you can look at

https://www.libav.org/avconv.html#asyncts

that is the replacement for

‘-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.

    avconv -i your_video -af asyncts -c:v libx264 -c:a libfdk_aac out.mp4




More information about the libav-tools mailing list