[mythtv-users] Audio out of sync in Mytharchive generated DVD

Rod Smith mythtv at rodsbooks.com
Mon Apr 9 22:41:37 UTC 2007


On Monday 09 April 2007 17:38, Chris Weiland wrote:
> I'm trying to archive a few of my recordings to DVD using Mytharchive,
> which worked beautifully, except that the audio was out of sync by about
> 3-5 seconds.

This is a serious problem with every tool I've tried to make DVDs, although 
it's worse with some tools and source files than with others. That said, a 
3-5 second sync problem is pretty awful. The usual pattern for me is that the 
audio sync starts out OK but slowly drifts over the course of the recording.

In any event, I've had better luck using mencoder to create MPEG-2 files from 
MPEG-4 and non-Myth sources than using MythArchive's tools (namely ffmpeg). I 
still use MythArchive to create the DVD, but not to transcode into MPEG-2 
format. Here's the command I use:

mencoder -vf kerndeint,softskip,scale=720:480,harddup -ofps 30000/1001 -aspect 
${aspect} -ovc lavc -lavcopts 
vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9600:vbitrate=${vbitrate}:keyint=18:turbo:trell:dc=10:autoaspect=1 -oac 
lavc -lavcopts acodec=ac3:abitrate=192 -of mpeg -o ${dest} ${src}

Note that's one big long line; it'll be split across multiple lines by the 
e-mail transfer. Replace ${aspect} by the source's aspect ratio (1.3333 or 
1.7777), ${vbitrate} by your desired bitrate (such as 4771000 to fit two 
hours on a 4GB DVD), ${dest} by the destination filename, and ${src} by the 
source filename. Of course, I've got this in a script, myself. I'm not yet 
100% satisfied with my parameters; I'm still fiddling with them, but it's a 
slow process. It's also possible to add a crop option to crop the 
letterboxing off of letterboxed NTSC source material.

Once I've transcoded a recording, I use MythArchive with the "always 
transcode" option DISABLED and the "don't re-encode" quality setting; the 
whole point of using mencoder is to bypass the buggy ffmpeg step.

Nine times out of ten, the DVDs I get from this process have better audio sync 
than they do if I'd used MythArchive with its ffmpeg transcoding. I also get 
better deinterlacing (due to the kerndeint option) -- MythArchive/ffmpeg 
tends to produce hideous interlacing artifacts. I still have occasional 
problems with this approach, but they're less common and usually less severe 
than what MythArchive/ffmpeg produces.

All of this applies to material that wasn't originally in MPEG-2 form or that 
needs processing to reduce its size or otherwise modify it. As I've got two 
tuners with hardware MPEG-2 encoders, when I know I'll be making a DVD from 
material obtained from them, I prefer to set the recording bitrate 
appropriately and then use MythArchive with the "always transcode" option 
disabled and the quality set to "don't re-encode". When I do this, though, 
I'm sure to set the recording resolution to a DVD-compatible one (typically 
720x480).

> The wiki
> article also suggests setting "Always use Transcode", which was on in both
> tries.

I disagree that this is a good idea, at least in my experience. Maybe it helps 
with source files recorded with certain hardware and/or software, but not 
with the files I've used.

FWIW, I've run across a few instances where my MPEG-2 hardware encoder 
produces audio that's about 100-200ms out of sync when played by MythTV, but 
when transcoded with mencoder and a DVD created, the audio sync is much 
better. Thus, I try not to judge the audio sync until I've got a DVD image on 
disk (see below).

> Other than that, I don't really know what to make of it.  I don't really
> want to mess around with it until I know what to do because each try takes
> about 2 hours to burn, plus the disk.

Try "burning" to an .iso image rather than directly to disc. You can then move 
the .iso file to your Myth Video directory to test it. If it's good, you can 
then burn that image to disc:

growisofs -dvd-compat -Z /dev/dvd=mythburn.iso

Replace mythburn.iso with the source filename, if you change it or need to 
refer to it by its complete pathname. If you were to do this blindly, it 
wouldn't take much longer than telling MythArchive to burn the disc directly. 
If you find a problem, though, it'll be quicker and easier to correct when 
you do it this way, and you won't waste a disc in the process.

As an alternative to all of this, you could try creating a MythTV native 
backup rather than a conventional DVD. This will be quicker and will preserve 
the files in their original form, so if audio sync is correct when you play 
the recording normally, it should be OK in the DVD you burn, too. The trouble 
is that the DVD won't be playable on a standard DVD player; you'll need a 
computer capable of playing the files that MythTV records. (It doesn't 
necessarily have to be a MythTV system itself, though.)

-- 
Rod Smith
http://www.rodsbooks.com


More information about the mythtv-users mailing list