HOWTO Make a video (S)VCD

From LinuxReviews
Jump to navigationJump to search

Introduction

What is a VCD? (Video Compact Disc)

VCD stands for 'Video Compact Disc' and is a CD-format standard for moving pictures and sound.

  • A VCD can hold up to 74/80 minutes of audio and video on 650MB/700MB CDs respectively.
    • VCD display resolution is 352 × 240 pixels (NTSC) or 352 × 288 pixels (PAL).
    • A VCD uses the MPEG-1 encoding standard called MPEG-1 to store the video and audio.
    • The video bitrate is required to be 1150 kilobits per second. Audio is encoded as MPEG Layer 2 (MP2) at 224 kbit/s.
  • A VCD can be played on almost all standalone DVD Players (and on all computers with a DVD-ROM or CD-ROM drive and a standard video player).
  • A VCD must have the correct regional settings, PAL format for DVD players in Europe and NTSC format for the US. Some DVD players can play both PAL and NTSC, but that is not a standard feature.
  • Movies longer than 74/80 minutes must be splitt between two VCDs.

What is a SVCD? (Super Video CD)

SVCD stands for Super VideoCD and is similiar to a VCD.

  • A SVCD can hold about 35-60 minutes of good quality video on a 74/80 min CD. A SVCD can also have 2 stereo audio tracks and also 4 selectable subtitles.
  • A SVCD can be played in most standalone DVD players (and on all computers with a DVD-ROM or CD-ROM drive and a standard media player software).
  • SVCD quality is about two times better than VCD and poorer than DVD.
  • The resolution of SVCD is 480x480 for NTSC or 480x576 for PAL.
  • Video is encoded as MPEG-2, and the video can have a variable bitrate.
    • The bitrate can in theory be up to 2.6 megabits per second, according to the standard. The standard has no lower bound for bitrate. Most SVCD and DVD players are limited to SVCD discs with a bitrate between 300 and 600 kilobits per second.
    • The audio is stored in MP2 constant bit rate format at a bit rate between 32 and 384 kilobits per second.
    • The fixed bitrate on a SVCD allow you to put full-length movies on a single CD; but you get a significant quality loss if you fit more than about 100 minutes of video on one SVCD.

What to make?

Choose SVCD unless you are making a video CD specifically for someone with a very old VCD or DVD player. Make a VCD only if you want to mass-distribute a video and want to be completely sure everybody can play it.

A SVCD can be played by (almost) all DVD players sold today. Many DVD players sold today can also play divx video CDs, but not all. SVCD is still a good choice for making a video CD for people who do not own computers if you, for some reason, do not want to make DVD discs (almost nobody has a SVCD player; those who can play a SVCD can also play a DVD).

  • Burning a normal CD (like SVCDs) is obviously cheaper than burning a DVD disc; however, if your video is longer than 100 minutes, then you will most likely want to burn it on two CDs, and then you're really not saving that much compared to the cost of a DVD...

Requirements

  • ffmpeg - at least version 0.4.9 (previous version do not have the -target command)

Create a VCD

VCD has fixed bitrate, you have no choice but to encode using the default settings of 1150kbit/s for video and 224kbit/s for audio. This is the specification and must be followed.

You need to split the output video file to fit as many CDs as are needed.

ffmpeg -i <movie.avi> -target pal-vcd <filename.mpg>

Create an SVCD

The key to making a SVCD is to set the bitrate. Calculate it using this formula:

  • Number of CDs * CD size * 1024 * 8 / movie length in seconds = bitrate per second.
  • Subtract the desired audio bitrate from this value and you have a number very close to the video bitrate you want.
  • Encode at atleast 1500kbit/s for good quality; only use lower quality if you really want to add more minutes of video at the cost of quality.

ffmpeg will calculate the bitrate setting for you if you use the -target option.

ffmpeg -i <movie.avi> -target pal-svcd <filename.mpg>

Burn The CD

Using K3B

K3B can burn VCDs for you and makes the files necessary - just add the mpeg video files.

File > New Project > New Video CD project

Command-line burning

For SVCD:

vcdimager -t svcd -l "Movie Title" -c <filename>.cue -b <filename>.bin <filename>.mpg
cdrdao write --device <device> <filename>.cue

For VCD:

vcdimager -t vcd2 -l "Movie Title" -c <filename>.cue -b <filename>.bin <filename>.mpg
cdrdao write --device <device> <filename>.cue

Or if cdrecord/wodim is installed rather than cdrdao:

sudo cdrecord dev=<device> cuefile=<filename>.cue -dao

(use "cdrecord -scanbus" to discover the device specifier)

Note: Based on your version of ffmpeg, you may need to prepend pal or ntsc to the target argument.

ffmpeg -i <movie.avi> -target ntsc-vcd <filename.mpg>

Troubleshooting

PROBLEM: How do I split up a big avi to fit many svcd's?

Determine the duration of the movie and use the "-ss" start switch and the "-t" time duration switch to chop the source video into portions.

The following splits up a big avi (1 hour, 55 minutes and 29 seconds long) into three different svcd's (45 minutes each):

ffmpeg -hq -ss 00:00:00 -t 00:45:00 -i <movie.avi> -target svcd ./m1.mpg
ffmpeg -hq -ss 00:45:00 -t 00:45:00 -i <movie.avi> -target svcd ./m2.mpg
ffmpeg -hq -ss 01:30:00 -t 00:25:29 -i <movie.avi> -target svcd ./m3.mpg

or

ffmpeg -i <movie.avi> -target ntsc-vcd <filename.mpg>

the following outputs m1.mpg, m2.mpg and m3.mpg

mpgtx -3 <filename.mpg> -b m

Alternatively, you can use the package avisplit. The command:

avisplit -s 700 -i <file.avi>

Will presplit your avi files into sub-files of 700 megabytes each. The problem with this is that although your split avis will each fit on a CD, the output from ffmpeg will likely be much larger and not fit on an 80 minute CD-R. Split the files smaller with avisplit or use the time start/duration time splitting method built into ffmpeg. With this above method (avisplit), you can test the avi files to see if the sound is out of sync. If it is, read the following:

PROBLEM: How do I keep the sound from being out of sync when splitting into more than one svcd?

This is due to a differing number of audio and video chunks in the avi file. If you encounter a problem with the audio synching, use:

tcprobe -i <file.avi>

This will show you the number of audio and video packets in the file. Also, it will tell the format of the Audio chunks in the avi file. Look on the third line of the output of tcprobe for format=0xAA, and remember this number.

Once you have that, you can reencode the file using chunks all of the same size to fix the problem. Use:

transcode -i <in.avi> -P1 -N 0xAA -y raw -o <out.avi>

Here, 0xAA is, of course, the number you just found with tcprobe. This conversion will take a little while. Once it is done, you can now use the file out.avi, splitting it up as you wish for your video cd.


PROBLEM: How do I retain the letterbox aspect ratio (black bars above and below the frame?)

The recipe above worked beautifully for me, but the original DivX/avi file was in a widescreen format, and ffmpeg -> SVCD created a disk which filled my TV, meaning it was horizontally squeezed. There must be a setting to ffmpeg to solve this.

Using ffmpeg you can type this command to make vcds.

ffmpeg -i <file.avi> -target ntsc-vcd -s 352x176 -padtop 32 -padbottom 32 <file.mpg>

This command will pad the top and bottom of a 16:9 avi and output it to file.mpg

-target "ntsc-vcd", "pal-vcd", "ntsc-svcd", "pal-svcd". This sets other options (e.g. bitrates, codecs) for your chosen output type automatically.
-s, -padtop and -padbottom set the size of the video frame and the black padding at the top and bottom.
The width (352) is always the same. The vertical dimension should add up to 240 for ntsc and 288 for pal

e.g. 176 + 32 + 32 = 240 
     192 + 48 + 48 = 288

Figure out the ratios to keep the aspect ratio correct and keep the padding to multiples of 16.

US widescreen TV coming as:

Stream #0.0, 23.98 fps: Video: mpeg4, yuv420p, 624x352

This worked well:

ffmpeg -i /path/file.avi -target pal-vcd -s 352x192 -padtop 48 -padbottom 48 /path/output.mpg