Wednesday, February 24, 2010

Bilingual VCD to DVD

Recently my mum wanted to replace her stack of VCDs to DVD. The VCDs are bilingual which is one language on each of the stereo channel.
Since DVD supports VCD's MPEG 1 PAL (352x288) format as described in the mencoder manual , I thought I could just easily copy the video stream and transcode the audio stream to AC3 with the following mencoder recipe:

mencoder -ovc copy -oac lavc -lavcopts acodec=ac3:abitrate=192 -srate 48000 -af lavcresample=48000 -of mpeg -mpegopts format=dvd:tsaf AVSEQ01.DAT -o AVSEQ01.mpg

However, after burning the first disc with DVDStyler, I found that my Phillips DVD player does not allow switching between left and right channel for DVDs although language switching works fine with the original VCD. Thus, I have to split the single track stereo channel into two separate mono audio channel. After some experimenting with mencoder's audio filter, here's the recipe:

mencoder -nosound -ovc copy -of mpeg -mpegopts format=dvd:tsaf AVSEQ01.DAT -o video.mpg

mencoder -srate 48000 -af channels=1:1:0:0,lavcresample=48000 -ovc frameno -oac lavc -lavcopts acodec=ac3:abitrate=96 -of rawaudio AVSEQ01.DAT -o audio1.ac3

mencoder -srate 48000 -af channels=1:1:1:0,lavcresample=48000 -ovc frameno -oac lavc -lavcopts acodec=ac3:abitrate=96 -of rawaudio AVSEQ01.DAT -o audio2.ac3

Now, instead of single mpg file, we have 3 separate streams. To make the DVD menus, multiplex the streams and generate the ISO image to burn, I found DVDStyler (also available in ubuntu repo) to be useful because I found that most DVD authoring tools seems to insist on re-encoding the video files to MPEG-2. Although default DVDStyler also tries to re-encode them, it has an option to just copy the stream as shown below in the title properties dialog.


With this method, I could combine 6-9 VCDs into a DVD. Of course, the video quality is just as good as its source which is relatively poor for a DVD. Finally, audio track switching works fine on the standalone DVD player and also on PC.