[mythtv-users] mytharchive and audio sync for HDTV

Patrick Wagstrom patrick at wagstrom.net
Wed May 2 17:15:21 UTC 2007


Howdy,

I've been using MythTV for about 4 years now, but never had a reason to 
try out MythArchive for converting recordings to DVD, at least not until 
yesterday.  First, for background, a little about my setup, where it's 
relevant at least:

WinTV PVR-250 recording at NTSC 720x480 resolution
2x pcHDTV HD-3000 cards recording HDTV
Running MythTV 0.20 with a few transcoding patches:
   http://svn.mythtv.org/trac/ticket/2581
   http://svn.mythtv.org/trac/ticket/2198

Almost everything is recorded off the HDTV cards now, but there are a 
few channels or programs that I get off the analog card.  After 
recording, I clip the commercials from most every program and then 
re-transcode it to save space.  During this process, I typically halve 
the dimensions for HDTV stuff (1920x1080->960x540).  As a result of 
encoding, however, this really makes the files (960x544).  For SDTV I 
typically just change the resolution to 640x480 and cut the commercials.

Now, I'm trying to go and archive an HDTV program to DVD using 
MythArchive.  In theory, this should properly scale the image down to 
DVD resolution, maintain the aspect ratio, and all that jazz.  In 
general, it does it quite well.  The video image is just fine.  The 
audio is just fine too.  What is not just fine is the audio/video sync 
up.  The further I get in the DVD the more off the AV sync becomes.

I did some testing to see if it was just the HDTV stuff, and, from my 
simple test, it was.  I created a DVD with two programs on it, one taken 
directly from the WinTV PVR card that hasn't been transcoded, and the 
HDTV test program.  I put these on the same DVD image, and then tried to 
view it.  The WinTV program was just fine throughout the entirety, the 
HDTV program experienced AV sync issues -- specifically, the video 
lagged behind the audio.

I've done some looking and saw that I should it run everything through 
mythtranscode, which is done no problem.  The log file is quite long, 
and I've included some of the salient parts here.

First, some of the relevant intro stuff:
wantIntro: 1, wantMainMenu: 1, wantChapterMenu:1, wantDetailsPage: 1
Final DVD Video format will be ntsc
There are 2 files to process
Pre-processing file '1009_20070427202900.mpg' of type 'recording'
           NOW
2007-05-02 11:19:22.402 Opening /mnt/store/1009_20070427202900.mpg
[mpeg @ 0xb5b3e800]Parser not found for Codec Id: 94210 !
Input #0, mpeg, from '/mnt/store/1009_20070427202900.mpg':
   Duration: 02:53:18.6, start: 0.289444, bitrate: 887 kb/s
   Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x480, 5500 kb/s, 
29.97 fps(r)
   Stream #0.1[0x69]: Data: 0x0000
   Stream #0.2[0x1c0]: Audio: mp2, 48000 Hz, stereo, 192 kb/s
0: start_time: 0.036 duration: 183.378
1: start_time: 752.475 duration: 183.431
2: start_time: 0.026 duration: 183.345
stream: start_time: 0.289 duration: 10398.662 bitrate=887 kb/s
2007-05-02 11:19:22.417 duration = 10398
Video resolution is 720 by 480
Pre-processing file '3220_20070424205900.nuv' of type 'recording'
           Frontline
2007-05-02 11:19:22.788 Opening /mnt/store/3220_20070424205900.nuv
Input #0, nuv, from '/mnt/store/3220_20070424205900.nuv':
   Duration: 01:39:26.2, start: 0.000000, bitrate: 1411 kb/s
   Stream #0.0: Video: mpeg4, yuv420p, 960x544, 29.92 fps(r)
   Stream #0.1: Audio: mp3, 48000 Hz, stereo, 1411 kb/s
0: start_time: 0.000 duration: 5.966
1: start_time: 0.000 duration: 5.966
stream: start_time: 0.000 duration: 5966.205 bitrate=1411 kb/s
2007-05-02 11:19:22.800 duration = 5966
Video resolution is 960 by 544


That all seems to check out just fine.  Well, mostly, I'm a little 
concerned about it reading the HDTV file as only 29.92fps.  Next, it 
transcodes the SDTV:
*************************************************************
Processing file 1009_20070427202900.mpg of type recording
*************************************************************
File type is 'mpeg'
Video codec is 'mpeg2video'
Running mythtranscode --mpeg2 to fix any errors
2007-05-02 11:19:23.164 Using runtime prefix = /usr/local
2007-05-02 11:19:23.189 New DB connection, total: 1
2007-05-02 11:19:23.202 Enabled verbose msgs: important
2007-05-02 11:19:23.207 New DB connection, total: 2
2007-05-02 11:19:23.230 Parser not found for Codec Id: 94210 !
Mux rate: 5.79 Mbit/s
File will be re-encoded using profile LP


Everything there looks fine.  Although, later on I do get some of these 
errors.  Looking up information about the errors indicates they're small 
enough to be almost inconsequential:
video PTS inconsistent:  0:23:43.788  0:23:43.788  0:23:43.855 
0:23:43.355  diff:  0:00:00.066·
video DTS inconsistent:  0:23:43.755  0:23:43.755  0:23:43.821 
0:23:43.321 diff:  0:00:00.066·


Now, processing the second (HDTV) file:
*************************************************************
Processing file 3220_20070424205900.nuv of type recording
*************************************************************
File type is 'nuv'
Video codec is 'mpeg4'
2007-05-02 11:48:30.197 Opening /mnt/store/3220_20070424205900.nuv
Input #0, nuv, from '/mnt/store/3220_20070424205900.nuv':
   Duration: 01:39:26.2, start: 0.000000, bitrate: 1411 kb/s
   Stream #0.0: Video: mpeg4, yuv420p, 960x544, 29.92 fps(r)
   Stream #0.1: Audio: mp3, 48000 Hz, stereo, 1411 kb/s
0: start_time: 0.000 duration: 5.966
1: start_time: 0.000 duration: 5.966
stream: start_time: 0.000 duration: 5966.205 bitrate=1411 kb/s
2007-05-02 11:48:30.257 duration = 5966
Preferred audio languages eng and eng
Video id: 0x0, Audio1: [1] 0x1 (MP3, N/A), Audio2: [-1] - 0x-1 (N/A, N/A)
Unknown aspect ratio 3.137250 - Using 16:9
Re-encoding audio and video from nuv file
Encoding profile (LP) found
mythtranscode started PID = 22266
Waiting for mythtranscode to create the fifos


Later on it goes through to mux files together, and that looks okay.  I 
see some of the same DTS/PTS errors, and value slowly increases, but at 
most hits 0.233 of a second, which is close enough for this case:
2007-05-02 12:24:55.709 Opening /mnt/store/tmp/work/2/newfile2.mpg
Input #0, mpeg, from '/mnt/store/tmp/work/2/newfile2.mpg':
   Duration: 00:55:17.9, start: 0.500000, bitrate: 1087 kb/s
   Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 352x480, 104857 kb/s, 
29.97 fps(r)
   Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, 192 kb/s
0: start_time: 0.045 duration: 298.612
1: start_time: 0.045 duration: -9223372036854.775
stream: start_time: 0.500 duration: 3317.915 bitrate=1087 kb/s
2007-05-02 12:24:55.741 Calculating frame count
2007-05-02 12:25:02.081 frames = 99439
2007-05-02 12:25:02.090 duration = 3317
Preferred audio languages eng and eng
Video id: 0x1e0, Audio1: [1] 0x80 (AC3, N/A), Audio2: [-1] - 0x-1 (N/A, N/A)
Splitting MPEG stream into audio and video parts
Running: mythreplex --demux  --fix_sync -o /mnt/store/tmp/work/2/stream 
-v 224 -c 128 "/mnt/store/tmp/work/2/newfile2.mpg"
Reading from /mnt/store/tmp/work/2/newfile2.mpg
Input file length: 429.98 MB
Checking for TS: failed
Checking for AVI: failed
Checking for PS: confirmed(maybe)
Video: aspect ratio: 2.21:1  size = 352x480  frame rate: 29.970 fps  bit 
rate: 104.86 Mbit/s
   vbvbuffer 671744
Sequence Extension: chroma 4:2:0   size = 352x480  bit rate: 104.86 
Mbit/s  vbvbuffer 671744  frame rate: 29.970
starting with video PTS:  0:00:00.500·
AC3 stream:  bit rate: 192 kb/s  freq: 48000 Hz
   frame size 768
starting audio PTS:  0:00:00.500·
Video output File is: /mnt/store/tmp/work/2/stream.mv2
AC30 output File is: /mnt/store/tmp/work/2/stream0.ac3


Finally, when it gets to running DVDAuthor, I can tell that there is 
something strange going on, because I see a lot of warning like this:
STAT: Processing /mnt/store/tmp/work/details-1.mpg...
WARN: Discontinuity in audio channel 8; please remultiplex input.
WARN: Previous sector: 0.178 - 0.178
WARN: Current sector: 0.256 - 0.256


So, where exactly should I start looking on this?  Have other folks used 
MythArchive to make DVDs of HDTV programs?  Do they also get programs 
reported with incorrect framerates?  Are there other hints for looking 
into this?

As another aside, which may be easy to fix, I've noticed that no matter 
what the quality I tell it to make the DVD, they always end up about the 
same size.  Whether it's highest or lowest, the DVD for just the one 
program is always about 700MB, even though the logs say it is using the 
different encoder profiles.  Of course, that could be something I did.

Anyway, any help would be appreciated.

--Patrick


More information about the mythtv-users mailing list