Sunday, August 29, 2010

AVI, DTS, and Sync

So, as we all know, there are about a million ways to do the same thing in Linux (well, maybe one or two).

I have long been encoding my DVDs for my HTPC with the x264 codec.  I have been using mencoder as the front end.  Recently, I have seriously started to get to work encoding the bulk of my  DVD library so I can put it in storage.

So here has been my problem, DVDs with a DTS track do not encode in sync.  It starts to drift almost immediately and by the end of the film, it can be off by almost 5 mins, as was the case for "Master and Commander".

The solution:

So this is less than ideal, but what I do is I have a "dts" flag for my script, if it is set, mencoder will encode the film with the default audio track (usually AC3), then run mplayer to dump the DTS audio stream. Then when I run mkvmerge, I merge the video track from the avi file from mencoder, leaving out the default audio, and mux in the DTS track.

No sync problems!  It seems a little round-about, but it works and can be implemented into a script just fine. The only "time waste" is the extra time to rip the DTS track, about 10 mins on my system.

So, if you are having problems syncing a DTS track in the avi output of mencoder, this should fix you up!

No comments:

Post a Comment