Quickly create a simple DVD from a single file

Here’s a script I use for creating a DVD with no menu from a single MPEG file. It puts chapter marks every 10 minutes.

#! /bin/bash
rm -rf tmp.mpg dvdfiles
ffmpeg -i “$1.mpg” -target dvd -vcodec copy -acodec copy tmp.mpg
dvdauthor -t -c 0:0,10:0,20:0,30:0,40:0,50:0,60:0,70:0,80:0,90:0,100:0,110:0,120:0 tmp.mpg -o dvdfiles
dvdauthor -T -o dvdfiles
mkisofs -dvd-video -udf -o “$1.iso” -V “$1″ ‘dvdfiles’
rm tmp.mpg
rm -rf dvdfiles

I call it smallerdvd, and use it like this:

smallerdvd moviefile

Where

moviefile.mpg

is the input file (don’t specify the .mpg), and it will create a DVD image called

moviefile.iso

.


]]>

Quickly put lots of small MPEG files into a DVD image

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
echo ‘‘ >> dvd.xml
echo ‘‘ >> dvd.xml
echo ‘ ‘ >> 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 ‘‘ >> dvd.xml
echo ‘‘ >> dvd.xml
echo ‘‘ >> dvd.xml
echo ‘‘ >> dvd.xml

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.


]]>

Using the command line utilities bundled with SmallDVD

SmallDVD includes precompiled utilities of several useful utilities. To use these directly from the command line, just add the directory to your path. So if you put SmallDVD in the Applications folder, do this:

export PATH=$PATH:/Applications/SmallDVD.app/Contents/Resources

Add this to your .profile file if you want it to happen every time you open a terminal window.

The utilities included are:

  • ffmpeg: video & audio conversion, and remultiplexing
  • dvdauthor: creates DVD folders from video files
  • mkisofs: creates an ISO disk image from the DVD folders
  • mplex: video/audio multiplexing (no longer used by SmallDVD)
  • bbdmux: demultiplexes video/audio (no longer used by SmallDVD)

And a few others used in the creation of DVD menus,

spumux

,

mpeg2enc

,

png2yuv


]]>

Removing the track number from the filename in iTunes 8

iTunes 8, in it’s usual Apple-think-they-know-best wisdom removed the option to specify whether the track number is included in the filename when copying a CD. So it always creates something like 01 first track.mp3… and I don’t want it to. Luckily there is a solution:

defaults write com.apple.iTunes create-filenames-with-tracknumber –bool FALSE

(found on an Apple discussion forum along with a few other “lost options” that I don’t care so much about)

]]>

Download and convert BBC radio programmes

[ update 17th Oct 08: there is an easier way to do this now that iPlayer Downloader supports radio programmes. Just use the same procedure described on the BBC iPlayer page to get an MP3 file. ]

EyeTV, which I normally use for recording from DVB, has crashed a few times recently, leaving me with missing episodes from audio series on BBC7.

Luckily, you can “listen again” to everything on BBC7 from the last 6 days. Unluckily it’s all in the stupid RealMedia format. But that’s OK, here’s a way of downloading it and saving it as an mp3 file.

To do this, we need mplayer. SmallDVD doesn’t use mplayer, but Mac users can it from MPlayerOSX. The mplayer binary is buried away deep in the application files at:

/Applications/MPlayer OSX.app/Contents/Resources/External_Binaries/ mplayer_intel.app/Contents/MacOS/mplayer

Then find the URL of the RealMedia stream on the

BBC7 site

. It will be something like: http://www.bbc.co.uk/bbc7/listenagain/tuesday/rams/0900.ram

To download the stream as a wav file:

mplayer curl http://www.bbc.co.uk/bbc7/listenagain/tuesday/rams/0900.ram -vo null -ao pcm:file=output.wav

(note the backquotes)

Then you can convert it to mp3 with lame (included in the SmallMP3 distribution):

lame –b 64 output.wav output.mp3

…although I use SmallMP3 to trim the files first.

Probably no point using a bitrate higher than 64k, as that’s what the RealMedia files were in.


]]>

Unwidescreening

BBC Four often show old programmes (like Doctor Who and Batman) that are transmitted in widescreen, but with black borders down the sides to keep the original 4:3 aspect ratio of the main picture. As the screen on my Archos (and my phone) are 4:3, it seems silly to play the widescreen broadcast in letterbox, and leave the picture in a tiny box in the middle.
So this screen crops the borders off the side, thus converting a widescreen broadcast to a 4:3 DivX.
It also works for things that really are widescreen – when converting for a 4:3 display, it’s sometimes more watchable to have a bigger image with the side of the picture missing, than being able to see the whole picture, smaller.
This does a two pass encode for better quality.

ffmpeg -i inputfile.mpg -vtag DIVX -f avi -vcodec mpeg4 -aspect 4:3 -cropleft 100 -cropright 100 -pass 1 -s 640×480 -b 1000k -acodec mp3 -ab 128000 -ar 48000 -ac 2 outputfile.avi

rm outputfile.avi

ffmpeg -i “$f” -vtag DIVX -f avi -vcodec mpeg4 -aspect 4:3 -cropleft 100 -cropright 100 -pass 2 -s 640×480 -b 1000k -acodec mp3 -ab 128000 -ar 48000 -ac 2 outputfile.avi

rm ffmpeg2pass*


]]>