Friday, April 10, 2009

AVI to DVD script

A script I wrote to convert a movie (specifically AVI) to a format that you can easily burn to a DVD and watch in your DVD player.

It's an improved version of this script.

Make sure you install ffmpeg, dvdauthor, and mkisofs before you try it. To do this in Fedora 10 you would type sudo yum install ffmpeg dvdauthor mkisofs.

To convert the movie example_movie.avi to a DVD, one would do sh example_movie.avi movie.iso. This will take a very long time (especially for long movies). When it is done you should be left with a nice fancy ISO file that you can burn to a DVD with your favorite burning program.

Have fun!

Note: This will consume large amounts of /tmp space so do not use this if your hard drive is nearly full. Also if for some reason the script dies before it gets a chance to clean up it's temporary work, navigate to /tmp and delete folders starting with avi-to-dvd.
# Convert an AVI to a ready-to-burn DVD iso.
# Author: Tom Arnold
# License: Public Domain
# Requires: ffmpeg, dvdauthor, mkisofs, and lots of space in /tmp
# References:

RM="rm -rf"

if [ $# -ne 2 ];
echo "Usage: avi_to_dvd [INPUT] [OUTPUT]"
exit 1

## Make a folder in /tmp for us to do work in.
mkdir $TEMP

## Convert the movie to DVD format (NTSC).
$FFMPEG -i "$INPUT" -y -target ntsc-dvd -sameq -aspect 16:9 "$TEMP/out.mpg"

## Create the DVD.
$DVDAUTH --title -o "$TEMP/dvd" -f "$TEMP/out.mpg"
$DVDAUTH -o "$TEMP/dvd" -T

## Make the actual ISO image.
$MAKEISO -dvd-video -o $OUTPUT "$TEMP/dvd"

## Clean up.
echo "Done!"

1 comment:

  1. Hmmmmmmm, I'd say this loooooooks about riiiiiiiight. Yep.