Quickly put lots of small MPEG files into a DVD image
Friday, September 26, 2008
I’ve got about 200Gb of cartoons for my children to watch, stored on a NAS drive. But when we go on holiday, I don’t take the NAS drive with me! So I wanted to dump a load of them (each file is only 5 or 10 minutes long) onto a DVD quickly.
Here’s a script to do that – it assumes the input files are MPEG2 (although could be changed to do conversion as well). And I think it probably requires the input filenames to not have any spaces in them.
#! /bin/bash
rm -rf /tmp/mkdvd
mkdir /tmp/mkdvd
pushd /tmp/mkdvd
echo '' > dvd.xml ' >> dvd.xml
echo '<titleset>' >> dvd.xml
echo '<titles>' >> dvd.xml
echo '' >> dvd.xml ' >> dvd.xml
let a=1
for f in $
do
ffmpeg -i "$f" -target dvd -vcodec copy -acodec copy $a.mpg
echo '' >> dvd.xml
let a=a+1
done
echo '
echo '</titles>' >> dvd.xml
echo '</titleset>' >> dvd.xml
echo '
dvdauthor -x dvd.xml
dvdauthor -T -o dvdfiles
popd
mkisofs -dvd-video -udf -o "dvd.iso" -V "dvd" '/tmp/mkdvd/dvdfiles'
rm –rf /tmp/mkdvd
Save it as
mkdvd
, then use it with a command line:
mkdvd /my/video/files/pingu.mpg
It will leave a DVD image file call
dvd.iso
in the current directory.

