vcd.sh

Download vcd.sh here




#!/bin/sh
#
################################################################################
#
# create video cd image (SVCD) from a given mpeg file
#
# Ian Portsmouth ian at psys dot co dot uk
#
# This can take quite a long time to run, depending on the 
# processor speed. eg 1.2ghz duron 5 minutes for a 30 second clip
#
################################################################################

if [ $# -lt 3 ] ; then
	echo ""
	echo "Usage:"
	echo "$0 [-r] infile outfile"
	echo "-r: scale according to rotated (portrait) format"
	echo ""
	exit
fi

rot=0
if [ "$1" == "-r" ] ; then
	shift
	rot=1
fi

infile=$1
outfile=$2

# bump up frame rate to vcd std
mencoder -fps 20 -ofps 25 -nosound -ovc copy $infile -o out1.avi

echo "*** Starting lav2yuv ***"
if [ $rot == 1 ] ; then

	echo "*** Portrait scaling selected ***"

	lav2yuv +p out1.avi | \
	yuvscaler -M RATIO_1_1_4_7 -O SVCD -np | \
	mpeg2enc -f 4 -F 3 -o svcd.m2v

else
	
	echo "*** Normal scaling selected ***"

	lav2yuv +p out1.avi | \
	yuvscaler -O SVCD -np | \
	mpeg2enc -f 4 -F 3 -o svcd.m2v

fi


# sound
lav2wav -I +p $infile | mp2enc -V -o foo.mp2 

# make final file
mplex -f 4 svcd.m2v foo.mp2 -o $outfile

# Create the iso image and cue file
# videocd.bin
# videocd.cue
#
# NB can define multiple mpeg files here which will appear
# on the final cd as different tracks
#
#echo "*** Starting vcdimager ***"
#vcdimager final.m2v

# delete intermediate files
rm -f foo.mp2 out1.avi svcd.m2v

# burn it to disk
# need to  check device id and driver for cdrw. see cdrdao(1)
#cdrdao write --device 0,0,0 --driver generic-mmc videocd.cue