Table of Contents
http://dvdripping-guid.berlios.de/Divx-to-VCD_en.html
by paranouei
LinuxMalaga
News(06/09/2003): New script divx2cvcd available. This new script doesn't use transcode anymore so now supports more codecs and its more customizable. http://dvdripping-guid.berlios.de/divx2cvcd-new
News(20/01/2003): New forum available. You can ask there your questions about this guide.
So you just came from shopping with your brand new DVD player, and now you would like to transcode your Divx files to VCD to enjoy them in your big TV at the living room…
This task can be done in linux, you can even automate it so you just have to type i.e. divx2vcd <file.avi>, go for a walk, and when you are back you have a fresh .bin and .cue files ready to burn.
Ok, let's see a few basic concepts before we begin:
For instance, CVCD is just a VCD with variable bitrate. This way, "easy" scenes take a lower bitrate so you have more space left and you can fit more minutes. You can fit this way more than 90 minutes in a CD.
Also, my scripts use some basic utils like bc (calculator) and perl.
Well, once you've got that, let's start ;)
I wrote the following script "divx2vcd", it takes care of the calculations to get an image with the same aspect ratio (adding black borders if needed). It uses constant, so it's fully VCD standard. The maximum file size (to make them fit in a CD), it's in CDSIZE variable. The script creates the video and audio with transcode, then it multiplexes them with mplex, and finally it creates de images. You can download it from here. I'm gonna paste it here so you can see it (sorry comments are in spanish):
New script Divx2CVCD (16/12/2002). This scripts gets all information from the .avi file, and then calculates automatically the video bitrate to make it fit in a CD in CVCD format (VCD with variable bitrate). You can change the QUANTUM variable. It's the quality (like the CQ-Constant Quality from TMPGenc), it must be between 2 and 31, the smaller it is, the biggest quality. With a value under 8 you get good quality. You can change AUDIORATE too. The script is available here, and I'm pasting it here:
News(06/09/2003): New script divx2cvcd available. This new script doesn't use transcode anymore so now supports more codecs and its more customizable.
For the SVCD creation is basically the same script, I only adjusted it to create a SVCD. You can change CDSIZE, QUANTUM, MAXVIDEORATE and AUDIORATE. You don't need to create an bbmpeg template because it creates it automatically.. Like before, you can download the script from here
If we've got a divx file in a foreign language, and a subtitles file it is also possible to transcode them when we create the *VCD. The subtitles will be recorded as part of the movie (so you can't disable them when watching the *VCD).
The method is quite simple, you just have to have a subtitles file supported by mplayer (subrip, microdvd… mplayer supports almost everything), and put the file in the same folder as the .avi, and rename the file so it has exactly the same name as the .avi file (except the extension of course). This way we make mplayer to autoload the subtitles. You can try if it works before transcoding, just do mplayer <file.avi> and see if the subtitles are autoloaded.
Well, I hope this little guide was helpful for you ;).
$ divx2cvcd ~+1/"f1.avi" [tcprobe] RIFF data, AVI video Video Output: 352x240 alto sin bordes: 180, con borde: 30
INFO: Multiplexing file Pelicula00.mpg *** Multiplexing: 99% - 90263 of 91169 A/V units. (99)% INFO: Finished multiplexing Pelicula00.mpg *** Multiplexing: 100% - 91169 of 91169 A/V units. (100)%
Playing Pelicula00.mpg. Cache fill: 0.00% (0 bytes) MPEG-PS file format detected. VIDEO: MPEG1 352x240 (aspect 12) 23.976 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 MP3lib: init layer2&3 finished, tables done AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 16000->176400 (128.0 kbit) Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
Could not find matching colorspace - retrying with -vf scale... Opening video filter: [scale] The selected video_out device is incompatible with this codec. VDecoder init failed :( Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1 Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2)) ========================================================================== Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
XF86VM: Selected video mode 640x400 for image size 352x264. X11 error: BadMatch (invalid parameter attributes)
MPlayer interrupted by signal 6 in module: decode_video - MPlayer crashed. This shouldn't happen.
$ cat log
*************** FILE INFO *************** Frame Size: 640x360 - FPS: 23.976 Length: 35112 - Seconds: 1464 0 hours, 24 minutes, 24 seconds Recommended averagge video bitrate: 4320 Using max video bitrate: 2000
mplayer -noframedrop -vo yuv4mpeg -ao pcm -waveheader -v -osdlevel 0 "/lfs/dl Cache1/movies/bt/Madlax/[Ayu]_Madlax_02_[F59ADC24].avi" &
(cat stream.yuv | yuvscaler -v 0 -M WIDE2STD -O VCD -n n | mpeg2enc -v 0 -s -f 2 -b 2000 -q 3 -F 1 -n n -4 2 -2 1 -o /lfs/toBurn/tmp/Pelicula.mpv) &