Sean’s Obsessions

Sean Walberg’s blog

DivX -> VCD Conversion

For a while now I’ve been wondering how to convert an .AVI file into a VCD, having tried once or twice but ending up stuck. Recently, a friend sent me a show he taped from TV, which prompted me to try again. I succeeded, and here’s how I did it. The basic steps in converting any digital movie into a VCD seem to be the following:

  • Transcode the file into an MPEG II audio and MPEG I video stream
  • Recombine the audio and video streams into one file
  • Create a VCD image out of the resulting file
  • Burn the image to CD

Note that there are lots of other things that can be done, such as titles, effects, multiple movies, etc, but this is the simplest case. The first step is what caused me the most grief, since the file I had wasn’t in a format that transcode knew about

1
2
3
4
5
6
7
8
9
10
11
# tcprobe -i RevolutionOS.avi
[tcprobe] RIFF data, AVI video
[avilib] V: 29.970 fps, codec=DX50, frames=3595, width=720, height=480
[avilib] A: 44100 Hz, format=0x11, bits=4, channels=2, bitrate=355 kbps,
[avilib]    3595 chunks, 3681280 bytes, CBR
[tcprobe] summary for RevolutionOS.avi, (*) = not default, 0 = not detected
import frame size: -g 720x480 [720x576] (*)
       frame rate: -f 29.970 [25.000] frc=4 (*)
      audio track: -a 0 [0] -e 44100,4,2 [48000,16,2] -n 0x11 [0x2000] (*)
                   bitrate=355 kbps
           length: 3595 frames, frame_time=33 msec, duration=0:01:59.953

Note the third line of the output, “format=0x11”, meaning that the software couldn’t figure out what the codec was. I ended up converting it to PCM with

1
mencoder RevolutionOS.avi  -o RevolutionOS_pcm.avi -noskip -ovc copy  -oac pcm

Then, I could transcode and create the vcd with this script (note that this site offers an easier version that uses mplayer for everything… wish I knew about that!)

Basically, this script tries to calculate all the clipping needed to scale your video into the size needed for VCDs. It also figures out how many CDs you need. The basic transcoding goes like this:

1
transcode -i FILE -x VIDEOCODEC,AUDIOCODEC -y mpeg2enc,mp2enc -o BASENAME

The input A/V codecs can be autodetected. After the transcode step, you’ll have two files, BASENAME.{m1v,mpa} containing the video and audio streams respectively. Note, to extract the audio to an mp3, you can do something like

1
transcode -i FILE -x NULL -y null,lame -o foo

which will generate foo.mpg. You can use -E and -b to specify the sampling frequency and bitrate respectively. After you have the video and audio streams, you put them back together:

1
2
tcmplex -i BASENAME.m1v -p BASENAME.mpa -o BASENAME.mpg \
  -m 1 -F template

where there is a file called “template” containing the words

1
maxFileSize = 795

for an 80 min CD, or 735 for a 74 min CD. This multiplexes the streams as a VCD into BASENAME-nn.mpg Then, convert each .mpg to a VCD:

1
vcdimager -t vcd2 -c BASENAME-nn.cue -b BASENAME-nn.bin BASENAME-nn.mpg

The VCDs can then be burned with:

1
cdrdao write --device 1,0,0 --speed 8 BASENAME-nn.cue

1,0,0 is the SCSI ID of your burner, you can get it by running “cdrecord –scanbus”.

Again, most of this is automated through divx2vcd… However if you run into problems like I did, you may have to do it the long way.

All the software such as transcode was obtained from Freshrpms.net.

Sean

Comments

I’m trying something new here. Talk to me on Twitter with the button above, please.