Yet More Video Junk

In the previous chapter of our saga, I was still trying to find a method of making the MPEG-2 streams DVD-compliant without re-encoding, and I think I’ve finally got it.

The main problem was that after using either ‘gopdit’ or ‘gopchop’ to edit out the commercials, ‘dvdauthor’ still wouldn’t accept the MPEG-2 stream (spewing out messages like ‘WARN: Skipping sector, waiting for first VOBU…’) since it wasn’t quite formatted properly for DVDs. The usual recommendation in these cases is to run it through ‘dvb-mplex’ and specify the DVD profile for the output. Which worked, except that the output would often have audio/video sync problems that would get worse as time went on.

It turns out that the MPEG-2 stream generated by this capture card (the WinTV PVR-250) often has minor little corruptions in it. I have no idea if it’s a bug in the ivtv driver, or the firmware on the card itself, or if it’s just not pulling data off fast enough because of the system speed, but it’s beyond my control anyway. They’re fairly small errors, just a minor glitch in the video or audio here or there, but corruption nonetheless, and running it through a remuxer like above causes it to drop the corrupted packets and that puts the audio and video slightly further out of sync each time. This wasn’t a problem before since ‘transcode’ would do the extra processing to ensure that a/v sync was retained in the new stream, but I’m trying to avoid using it here.

Fortunately, not all is lost. I eventually went back and tried ‘replex’ from the DVB tools, and it has an option to force it to keep ‘bad’ information in the stream. Technically the output is still corrupt, but at least everything’s still in sync and MPEG players can generally recover from minor errors.

So, the new workflow is:

1) Record the show using MythTV at either a 352×480 or 720×480 profile.

2) Edit out the commercials. I’m leaning towards preferring ‘gopchop’ for this since I think it’s a bit easier to use.

3) Resync the timestamps in the stream using ‘gop_fixup’. This is really an optional step, but without it times will look a bit screwy on the DVD player (e.g., if I cut out 2:35 of commercials, the time display on the DVD player would suddenly jump ahead by 2:35 at that point).

(Update: gop_fixup isn’t always working, often failing partway through with some internal assertion failure, so for now I make a copy of the file, run gop_fixup on it, and if it fails delete it and just continue using the original.)

4) Run the stream through ‘replex’, using the -k parameter to keep broken packets:

replex -t DVD -k -o foo.vob foo.mpg

5) Run ‘dvdauthor’ and ‘mkisofs’ and burn it, same as before. ‘dvdauthor’ still complains about the audio stream “moving backwards,” but it generates a disc that works anyway.

I’ll still have to use ‘transcode’ on all of the older recordings though, since they’re at 480×480 and have to be resized, which forces a re-encoding. At least the process will be much faster for new recordings.

4 thoughts on “Yet More Video Junk”

  1. Ah, thank you! I’m still trying to fix whatever’s corrupting the stream in the first place, so this will certainly help.

  2. I’ve found this to be very useful. However, I am unable to get requantization of the movies to work. Have you had any success in using tcrequant, vamps, or similar tools for shrinking the movies to get more on a single DVD? I have not had success with using tcrequant either before or after the gopdit stage.

  3. Unfortunately no, I haven’t done much experimenting with requantizing yet. I think the last time I tried it, it failed to re-mux the files due to some audio stream error…

    There’s a ‘postproc’ script in the tovid tools which might help drive it though.

    Also, ‘avidemux’ is supposed to do requantizing, but I’ve been having A/V sync problems with it.

Leave a Reply

Your email address will not be published. Required fields are marked *