# Possible fix to MKV audio sync issues



## mdbundy (Oct 5, 2005)

Found this suggestion on a PS3 site, and tried it with Tivo.net -- should also work with pyTivo.

1. Downloaded ffmpeg revision 12572 from this source (posted by another user):

http://ffdshow.faireal.net/mirror/ffmpeg/

(Note that I tried the latest release, but it wasn't able to decode mkv/h264 streams at all)

2. Added the following parameter to my command line: -copyts

This apparently tells ffmpeg to synchronize video/audio by comparing timestamps. My tests so far have fixed all of the audio sync issues I've had -- including drifting audio and even some samples that I couldn't get in sync playing on my PC. (I'm not an ffmpeg expert).

FYI -- the total command I am using is:

-threads 2 -i <FILE> -vcodec mpeg2video -qscale 1.2 -maxrate 8192k -bufsize 1024k -acodec ac3 -ab 256k -ar 48000 -f vob -copyts -

I'd be interested to see if this fixes other's problems, too... Good luck.

Also, this command has been working with my other videos as well (divx/xvid, etc.).


----------



## Rdian06 (Apr 12, 2008)

pyTivo has had the -copyts flag fix in place for a few months now so if you're using a recent pyTivo fork version, this is fixed automatically for you.

Also the ffmpeg link you provided is quite old given recent ffmpeg development. It still uses liba52 for AC3 decoding instead of the native decoder. The liba52 decoder causes that command line you're using to incorrectly map the channels in a 5.1 audio stream (because liba52 decodes to one order while the native AC3 encoder encodes to a different order).

I have a custom Windows ffmpeg build based on SVN 15216 that drops liba52 in favor of the ffmpeg native AC3 decoder and a small additional patch to fix 5.1 channel mapping problems when transcoding from DTS/AAC to AC3.

You can get my ffmpeg build from the pyTivo forum here (you want the rdian06-0.95 version):

http://pytivo.krkeegan.com/rdian06-s-ffmpeg-builds-t468.html


----------



## mdbundy (Oct 5, 2005)

Awesome, thanks! 

I saw v0.93 of your fix, but I only have stereo out so the mapping doesn't appear to be a problem for me -- but I'll grab it anyway. I did look into using that version to fix the sync problems I was having, but as I don't use pyTivo I didn't see that the -copyts fix was in there already... Been a while since I looked at pyTivo, but the starting point of the arguments I am using were from some version of it.


----------

