[MEncoder-users] sync problem while encoding bluray with dts audio to avi then to mkv

James Hastings-Trew jimht at shaw.ca
Sat Apr 4 16:50:18 CEST 2009


Alexander Schwarzkopf wrote:
> Hi,
>
> I am building a script to make conversion of HD content from BluRay, HDDVD, HDTV, ... in linux as simple as possible. 
>
> I use mencoder to convert (and optionally downsize, add black borders to meet 16/9 aspect ratio, ...) video and recode to x264 in AVI container. Audio is processed with -oac copy by default, but I did also try to reencode. Then I use mkvmerge to repackage the results to Matroska. 
>
> Now I encountered a sync problem when converting sources containing DTS audio. The AVI seems o.k., at least it plays correct using mplayer or vlc. But as soon as I convert it to Matroska the DTS stream is way out of sync (most of the time the audio gets stretched by MINUTES, making the result much longer than the original video). This does not happen at all when the source has AC3 audio and it even works for approx. 50 % of the sources with dts audio in .TS format. Sources with dts in Matroska container almost always fail. 
>
> I've been trying for weeks now (still long runtimes per movie, even with a Core i7 ;-) ), trying every tip I could find (using -vf harddup , -mc 0 -noskip, encoding to raw formats, reencoding audio to mp3, aac, 6ch aac, ...) but nothing did solve the problem. 
>
> As it works sometimes (even if it are rare occasions) I think it does not have much to do with mkvmerge. More likely it has something to do with erroneous source streams.
>
> Is there a known problem witch -oac copy / DTS audio / maybe inconsistent source streams? 
>
> If there isn't, how can I help in resolving this issue? If it would fail in 10% of the cases I'd say: "get another source", but it's more like 90%, so it seems to me to be a more fundamental problem. 
>
> I'm using the following commands for twopass encoding:
> /usr/bin/mencoder xxx_1080p.mkv -alang ger -oac copy -ovc x264 \
> -x264encopts subq=4:bframes=4:b_pyramid:weight_b:pass=1:psnr:bitrate=6000:vbv_maxrate=9500:vbv_bufsize=2000:direct_pred=auto:keyint=100:turbo=1:threads=auto\
> -passlogfile xxx_1080p_2pass.log -vf expand=1920:1080,harddup -fps 23.976 -ofps 23.976 -o /dev/null
> /usr/bin/mencoder xxx_1080p.mkv -alang ger -oac copy -ovc x264 -x264encopts \
> frameref=6:analyse=all:me=umh:subme=7:trellis=2:bframes=4:b_pyramid:subq=6:mixed_refs:weight_b:no_fast_pskip:direct_pred=auto:mixed_refs:keyint=100:nr=200:vbv_maxrate=9500:vbv_bufsize=2000:bitrate=6000:threads=auto:pass=2\
>  -passlogfile xxx_1080p_2pass.log -vf expand=1920:1080,harddup -fps 23.976 -ofps 23.976 -o xxx_1080p.avi
>
> Thanks for reading this rather long text, and thanks in advance for any hints,
> Alexander Schwarzkopf
>   
You didn't mention how you were getting the streams off the bluray discs 
in the first place. I've used eac3to, and on titles with complex program 
structures (Wall-E comes to mind) eac3to often has to make 2 passes on 
the audio to resolve overlaps where the program is spread out over 
numerous discrete files on the bluray disc. These overlaps, if not 
processed properly, could possibly result in AV sync drift on a long 
title. Just a thought. Here's a link to a small article (windows 
centric, but the general principle is the same) I posted about bluray 
conversions: http://videogeek.shacknet.nu/index.php?entry=entry090204-064824

Mind you, I'm converting the audio to aac which is probably not what you 
are aiming for in the end, but I believe your sync issues are 
originating at the extraction phase, which is what is convered in the 
article I linked to above.

I've also noticed, for whatever reason, that when dealing with audio 
from a .mkv source, the audio always seems to be about 3 frames behind 
the video, and I have to compensate for that with a -delay value. Also, 
you are specifying your -fps and -opfs values wrong: use 24000/1001 
instead of 23.976.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 3987 (20090404) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




More information about the MEncoder-users mailing list