http://www.satlug.org/~bigjnsa/vcd-linux.htm
There are some limitations on VCD's Like bitrate for video 1152kBit and for audio 224kBit.
For audio use:
lav2wav stream.avi | mp2enc -V -o sound.mpg
-V force VCD compatible output (same as: -b 224 -r 44100 -s) For hardware players, you should stick to 44.1 224kBps Stereo layer 2 Audio.
For the video use:
lav2yuv stream.avi | yuvscaler -O VCD | mpeg2enc -s -r 16 -o video.mpg
For an VCD compatibel output the -s (Generate a sequence header for every GOP) is needed. Never try for VCD -m or -b It seems that many VCD players (Avex for example) are not able to play MPEG streams that are encoded with an search radius greater than 16. But -r 16 workes fine.
Mplex with:
mplex -f 1 sound.mpg video.mpg -o vcd_out.mpg
The -f 1 option turns on a lot of weird stuff that otherwise has no place in a respectable multiplexer!
Creating the CD:
The multiplexed stream has to be converted to an VCD combatible. This ist done by vcdimager (Aviable from freshmeat)
Example
vcdimager testvideo.mpg
Creates an videocd.bin, the data file, an a videocd.cue which is used as controllfile for cdcdao.
In Linux you can use cdrdao to burn the image. Aviable at: http://cdrdao.sourceforge.net/index.html
For MPEG-1 encoding a typical (45 minute running time) show or 90 odd minute movie from an analog broadcast a constant bit-rate of around 1800 to be ideal. The resulting files are around 700M for 45 minutes which fits nicely as a raw XA MODE2 data track on a CD-R. For pure digital sources (DTV or DVD streams and similar) VCD 1152 works fine.
If you record the data as XA mode 2 tracks you can fit appreciably more on a CD (at the expense of error correction/detection). You can use vcdimager to do this and readvcd to extract the resulting files.
For better Quality there are SVCD and XVCD and DVD.
Currently only SVCD is fully supported with a pre-set format in mplex and tools to create disks. MPEG streams that can be played by DVD player hardware and software can readily produced using mpeg2enc/mplex but there is currently no means to make a properly structured disk image.
If your player doesn't support SVCD however, you may well find it can handle VCD streams that have much higher than standard bit-rates.Often as much as 2500kBit/sec is possible. With higher bit-rates and good quality source material it is worth trying mpeg2enc's -h flag which produce a stream that is as sharp as the limits of the VCD standard permits. The -h flag seems to help also if there is a low quality stream, the video does not look that sharp using the flag, but there are not that much gitches as without it.
However, if your player supports it and you have the patience for the much longer encoding times SVCD is a much better alternative. Using a more efficient MPEG format SVCD more than doubles VCD's resolution whilst typically producing files that are rather less than twice as big.
Record at full TV resolution (means: -d 1 for PAL this ist 720x568) Convert the sound with:
lav2wav stream.avi | mp2enc -V -o sound.mp2
Convert the video with:
lav2yuv -s 2 stream.avi | yuvscaler -O SVCD| mpeg2enc -m 2 -F 3 -s -b 2500 -V 400 -o video.m2v
-s 2 is vital. This reduces the 720 squares pixels in a standard TV image to the peculiar 480 rectangular format that SVCD expects.
-F 3 tell mpeg2enc to assume that the original signal is field interlaced video where the odd rows of pixels are sampled a half frame interval after the even ones in each frame. The -F 0 (progressive output (no field pictures)) option will also for PAL.
-F 1 and -F 2 will work but are currently handicapped by rather dumb code to choose the type of motion compensation.
You can use lower bitrates, but the SVCD standard limits total bit-rate (audio and video) to 2788800 Bit/sec. So with 224Kbps audio and overheads 2550 may already be marginally too tight.
An other possibility for movies in PAL (European style 25 frames/50 fields per sec) video is:
lav2yuv -s 2 stream.avi | yuvscaler -O SVCD | mpeg2enc -m 2 -F 0 -s -b 2500 -V 400 -o video.m2v
Movies are shot on film at 24 frames/sec. For PAL broadcast the film is simply shown slightly "too fast" at 25 frame/sec (much to the pain of people with an absolute pitch sense of pitch). The -F 0 flag turns off the tedious calculations needed to compensate for field interlacing giving much faster encoding.
Unfortunately, movies broadcast in NTSC (US style 30 frames/60 fields sec) video this will produce very poor compression. The "pulldown" sampling used to produce 60 fields a second from a 24 frame a second movie means half the frames in an NTSC *are* field interlaced.
Multiplex with:
mplex -f 3 sound.mp2 video.m2v -o vcd_out.mpg
Creating the CD:
Example:
vcdimager -t svcd testvideo.mpg
Creates an videocd.bin, the data file, an a videocd.cue which is used as controllfile for cdcdao.
In Linux use cdrdao to burn the image.
Note: If you want to build "custom" VCD/SVCD you should try the mplex -f 2 and -f 5 switches.
Note: The VCD SVCD stuff may work on your HW player or not. There are many reports that it works quite well. Don't be woried if it does not work. Nor am I responsible for unusable CDs.
Big J