Reading an article on how to backup stuff from your PVR onto DVD's in a local PC magazine using Windows tools got me thinking about how to achieve the same thing using a Mac (without Windows). I had always been looking for a compressed XviD-based method, but a DVD solution has 2 important advantages:
- No transcoding necessary. We essentially just unwrap the PVR files and put them on discs. Saves time and quality.
- Easier playback. Practically everyone has a DVD player these days and for many, popping a disc in would make much more sense than messing about with some media streaming solution.
This is also a good method for backing up to hard drives because a DVD is a standard format and we can always compress it more later.
The tools and the process
There's 3 stages involved - splitting the AVR files up into video, sound and subtitle data, authoring the DVD (putting all of that stuff together, but in a different way) and then burning the actual disc (or saving the image file). The first one is easy - we use ProjectX (mentioned here before)which, being a pure Java app, runs exactly the same on any JRE-supported platform.
The authoring process is a bit more involved. We'll have to take the output from ProjectX, put it together again, do special voodoo in case of subtitles and then actually author the VOB files and DVD folder structure.
Burning is of-course a piece of cake for which we have many good free and commercial alternatives to choose from.
Bring your AVR file into ProjectX (File > Add or D&D). Click on CutControl if you want to trim your source or remove ads. Just remember you're marking the regions you want to keep, not remove (the green bar). The particular broadcaster who's material I'm testing this with alternates between 16:9 and 4:3 aspect ratio between the show and ads so I leave one extra black frame after the ad finishes, which is where they switch back to widescreen.
The way I've understood it, there's two ways of transferring subtitles in digital TV - teletext and DVB native encoding. To use the former (which is more popular among satellite broadcasters), click PreSettings > Subtitle > “re-build TTX-PTS from 1st MpgAudio Stream” (Image 1).
DVB subs can be either baked into the video (easier to use for us, but can't disable them or change the language) or bitmaps that are then layered on the video (more flexible but much more difficult to handle). Check below on how to handle the layered version.
Click on prepare», make sure “demux” is selected and hit the big Play/Pause button.
If all went well, you should have 2 or 3 extra useful files (depending on the subtitle encoding method) in your AVR file's parent directory now:
ls -l R&A- Backstage (K15)_#001_200704032100* -rwxrwxrwx 1 filipp filipp 1G Apr 3 22:22 R&A- Backstage (K15)_#001_200704032100.AVR -rw-r--r-- 1 filipp filipp 1G Aug 18 09:40 R&A- Backstage (K15)_#001_200704032100.m2v -rw-r--r-- 1 filipp filipp 119M Aug 18 09:40 R&A- Backstage (K15)_#001_200704032100.mp2
Next we have to put the video and audio together. I first tried doing this with the fabulous MPEG Streamclip but no matter which variant of MPEG export I tried, I always got a muxed file that played fine in VLC, but was not recognized properly by dvdauthor. So I ended up using mplex from the mjpegtools package (available from MacPorts):
$ sudo port install mjpegtools $ mplex -f 8 R&A- Backstage (K15)_#001_200704032100.m2v R&A- Backstage (K15)_#001_200704032100.mp2 -o backstage.mpg
As the final authoring step, we create the DVD structure. I use dvdauthor from MacPorts for this, but other options are available (including Toast and even DVDSP):
$ sudo port install dvdauthor
Then I create the dvdauthor project file, as per instructions:
> cat > ./movie.xml << EOF > <dvdauthor> > <vmgm /> > <titleset> > <titles> > <pgc> > <vob file="backstage.mpg" /> > </pgc> > </titles> > </titleset> > </dvdauthor>
… which is then run through dvdauthor:
$ dvdauthor -o movie -x movie.xml
This most basic DVD layout creates a movie with one big chapter - dvdauthor is actually capable of much more, but this is what I need for now. The result should be a folder named “movie” which can even be opened with Apple's DVD Player application:
You can burn that with any burning app that knows what UDF stands for. I tested this with Burn and it worked fine, as long as you didn't use the Video tab, but selected Data > DVD (UDF) and dropped the contents of folder “movie” (AUDIO_TS and VIDEO_TS) into the file list.
Handling split files
Most PVR devices have a file size limit of 2 GB, which at 5Mb/s (+224kBit/s audio) is just around (16000/5,224/60=51) minutes worth of show so longer ones will be split into separate files. Luckily this is not a problem as mighty ProjectX handles can handle split material per collection. Just drag the pieces in, make sure they're in the right order.
Those pesky subtitles, revisited
Using those separate DVB subtitle tracks can be tricky because ProjectX rips subtitles into SUP files, which currently has no Mac native editor. I even tried DVD Studio Pro, which didn't do anything (kind of a silly idea, I know). I tend to record more “obscure” material like foreign (French, Russian etc) films and documentaries and so subtitle support is essential. There's two pieces of good news however - I think I've found a way to use SUP files on the Mac and in my testing I've found that many broadcasts actually have the subtitles already encoded into the video, so no additional processing is required.
To author a dvd using dvdauthor, the subtitles should be converted from the SUP format. The utility pxsup2dast will convert every subtitle to a separate PNG file based on the SUP and IFO files from Project X:
$ python pxsup2dast.py mymovie.sup*
That will will create a folder mymovie.d with all the PNG files and the spumix project file. Then we just add these subtitles to the previously converted MPEG file, using spumix which is bundled with dvdauthor:
$ spumux spumux.xml < ../movie.mpg > movie_with_subs.mpg
The whole process came out a bit more involved than I was hoping, but it's totally doable, with free tools from start to finish. This is one of those areas where an old Mac geek like myself must confess that both Linux and Windows have the upper hand currently as far as tools go. dvdauthor has GUIs for both of those platforms (it seems the Windows-based DVDAuthorGUI also bundles mplex). Looks to me like yet another cool software project. ;)
Hopefully this information will come in useful for someone else as well. If you have any questions or comments about the process, dont't hesitate to leave them in the comments. :)