Automated DVD production

From Organic Design

It would be nice to generate DVD discs from video files or cameras in a simple automated way.

Video specs

  • mpeg2 av muxed stream
  • Bit rate from 4Mb/s - 10 Mb/s

Audio specs

  • mpeg1-layer2
  • AC3
  • PCM
  • Must be 48kHz sample rate


  • A directory of video files numbered to indicate their order


  • A DVD image file, or
  • A finished DVD if the machine has a DVD writer


apt-get install debian-multimedia-keyring dvdauthor mjpegtools imagemagick toolame


High level python scripts that tie it all together - probably won't need the make file any more.


Here is the basis of a Make file that will eventually perform the whole process from file encoding to burning. It does not work at the moment, but is well documented.



menu/menu.mpg: menu/background.png ../common/spumux.xml buttons.png highlight.png selected.png
	dd if=/dev/zero bs=4 count=1920 | toolame -b 128 -s 48 /dev/stdin menu/audio.mp2
	# toolame 
	# -b bitrate in kbps
	# -s audio sample rate in kHz - 48kHz for DVD audio
	convert menu/background.png -quality 8 menu/background.jpg
	jpeg2yuv -n 60 -I p -f 25 -j menu/background.jpg | mpeg2enc -n p -f 8 -o menu/background.m2v

	# jpeg2yuv
	# -n number of frames to process
	# -I interlacing mode p = progressive
	# -f frame rate
	# -j file name or sequence (see man)

	# mpeg2enc
	# -n norm (p|n|s) (pal|ntsc|secam)
	# -f format 8 = "DVD MPEG-2 for ’dvdauthor" (see man)
	# -o ouput filename
	mplex -f 9 -o menu/background.mpg menu/background.m2v menu/audio.mp2

	# mplex
	# -f format 9 = DVD, 8 = DVD with blank blocks
	# -o output filename
	# input video
	# input audio
	spumux ../common/spumux.xml < menu_background.mpg > menu.mpg

	# spumux
	# multiplexes subtitles into existing mpeg2 stream
	# output menu.mpg stream

	mencoder "$(SOURCE)" -of mpeg -vf scale=720:576,harddup -oac lavc -ovc lavc -lavcopts \
	acodec=ac3:abitrate=192:vcodec=mpeg2video:keyint=150:vbitrate=5000:aspect=4/3 \
	-mpegopts format=dvd -srate 48000 -ofps 25 -o "$(DESTINATION)"
	# mencoder
	# vbitrate up to 400 - 9800 for DVD - long play vs image quality (bigger number)

	rm -rf test dvd.img vob/vob1.vob

dvd-structure: pal clean
	dvdauthor -o test -x xml/single.xml

dvd: dvd-structure
	mkisofs -dvd-video -o dvd.img test

	mencoder "$(SOURCE)" -of mpeg -vf scale=720:480,harddup -oac lavc -ovc lavc -lavcopts \
	acodec=ac3:abitrate=192:vcodec=mpeg2video:keyint=150:vbitrate=5000:aspect=4/3 \
	-mpegopts format=dvd -srate 48000 -ofps 30000/1001 -o "$(DESTINATION)"

#	<dvdauthor>
#	    <vmgm />
#	    <titleset>
#	        <titles>
#	            <pgc>
#	                <vob file="video1.mpg" />
#	                <vob file="video2.mpg" />
#	            </pgc>
#	        </titles>
#	    </titleset>
#	</dvdauthor>

See also