When I’m recording movies with MythTV, one of the things I have to watch out for is that the bitrate is appropriate. A higher bitrate means better quality, but if it’s too high, it takes up too much space and might not even fit on a DVD. You need a balance, but sometimes it’s not so easy to get.
For now I’ve just been setting up two of MythTV’s profiles for different cases: the High Quality profile uses a bitrate appropriate for movies less than two hours long, and the Low Quality profile for movies between two and two and a half hours long. It’s still not ideal though; a movie that’s only an hour and a half long will leave over a gig of wasted space on the disc, a movie just slightly over two hours will be forced into the lower quality profile, a three-hour movie will have to use my very-low-quality default ‘TV episode’ profile and would still leave wasted space, etc…
There is a better way, though. What I *could* do is record at the very highest quality possible with this card (which can do up to 12 Mbps), and then re-encode it down to a bitrate specially selected to be an optimal fit for the DVD. This should also result in a better quality output since cheap real-time encoders such as the one used by this card tend to do poorly at any specific bitrate compared to a proper, slower encoder. When I was recording Clone Wars episodes onto VCD, I got far better-looking results by recording at a very high bitrate and then re-encoding down to the VCD rate rather than recording directly at the VCD rate.
However, I’ve typically had two problems with this approach: 1) re-encoding quirks, and 2) speed.
The re-encoding quirks come about because of the way this tuner card produces MPEG streams. Apparently it occasionally drops frames (it might sometimes fail to finish encoding one before it has to start on the next one), and the audio and video streams get slightly out of sync. This is actually allowed by the MPEG standard, and there are timestamps in the stream to allow players to resync them properly. However, it seems that a lot of the open-source tools out there just don’t handle this case properly, so they ignore the timestamps and produce streams that aren’t resynced properly. Nuts.
However, while fiddling around recently I gave ffmpeg a whirl, and it looks like it *does* produce properly synced output from this card’s streams. Furthermore, it can also convert the audio stream to AC3 for better DVD compatibility. Perfect! It took a bit of fiddling to finally get the proper Magic Command Line which would do the re-encoding I wanted, but this seems to do the trick:
ffmpeg -target ntsc-dvd -i $1 -y -b $2 -aspect 4:3 -ilme -ildct -s 720x480 -hq -acodec ac3 -ab 224 -f dvd $1.new
where $1 is the original MPEG stream and $2 is the desired video bitrate. With this, I can then re-encode recordings into a file that will just fit on a DVD at the highest bitrate possible, and will be accepted by ‘dvdauthor’ as-is so that I no longer need the ‘replex’ stage.
Unfortunately, the downside to this is also that second problem: it’s slow. *Very* slow. It takes about eight hours of re-encoding for every one hour of source material, and double that for two-pass encoding for even better quality. That’s not too bad for the occasional movie, but not very practical for also getting higher quality TV episodes.
An old box like this one is indeed still good for a lot of tasks, but sometimes speed *does* matter…