Archive for the ‘multimedia’ Category

Fun with media files

Saturday, September 4th, 2010

It has to be said, mplayer is an amazing piece of software.

It can play ISO files as though they were DVDs. First, mount the image;
$ sudo mount -oloop /path/to/dvd_image.iso /media/dvd
Then to play the first programme from the disc;
$ mplayer -dvd-device /media/dvd dvd://1/

Now, the discs created on my standalone DVD+R/RW recorder are a bit weird, in that the .vob files on the disc don’t correspond with the recorded programmes. So I can’t save an individual programme just by copying its .vob file; meaning, if I wanted to keep a whole series together, I would have to record all the episodes on the same disc.

But mplayer has an option, -dumpstream which simply extracts the MPEG data from the source and saves it to a file. The default filename is stream.dump but you can specify an alternative filename with -dumpfile /path/to/somewhere. And without having to display anything, it isn’t constrained by the frame rate. Don’t be alarmed by the “Core dumped ;) ” message — that’s just hacker humour.

So we can extract the second programme from a disc (or a mounted ISO image), and save it as an MPEG file, with a command like the following;
$ mplayer -dumpstream -dumpfile /path/to/saved_file.mpg -dvd-device /media/dvd dvd://2/
Remember, this is the actual MPEG data from the disc, so it’s already a DVD-like MPEG2 file; and therefore suitable for burning to disc with your favourite DVD authoring application. Or just saving onto one of those USB external hard drives with a built-in media player.

Don’t forget also the excellent ffmpeg, which can convert nearly any media file format to nearly any other media file format.