27 Mar 2009

Tutorial on Converting and Burning an AVI File onto DVD


This is going to be a quick tutorial on how to convert an avi movie so that it can be burned onto a DVD, all done via the terminal in Linux. For Extra credit I will also show you how you can to this on a remote computer.





For this you will need the following tools:



Optional: Setting up a remote connection

On my setup at home my Desktop PC has the tools and the avi on them, but my laptop is over by the comfy sofa. So what I do is ssh in to my PC from my laptop on the sofa. I also use a program called Screen.
This is an example of what I do.
screen ssh <ip of desktop of pc>

Convert the AVI into MPEG

As DVD films are more or less in the mpeg format and the film we want to burn is an avi. We need to convert it into a mpeg.
First we use the screen program this allows us to set a program running and then close the terminal window and the program continues to run.
screen

Now we need to use Tovid. This will convert the avi into the desired mpeg format. On my system a two hour film takes just over two hours to convert.
tovid -dvd -pal -in movie.avi -out movie
Don't forget this is going to take a long time.  I shall now explain the switches used.

The dvd switch basicly converts the avi into dvd screen resolution. The pal switch converts the avi in to the PAL format. Tovid defaults to NTSC. The in switch is the path to the avi, and the out switch is the prefix of the mpeg file we wish to create.

When this is done we will have a shiney new file called movie.mpg which we can convert into the DVD format.

Convert the mpeg into DVD file format

OK the last step took about two hours, but don't worry the next couple of steps are going to take 10 minutes tops.

Before we burn the mpeg file on to the DVD we need to create a DVD filesystem. We do this;
dvdauthor -t -v pal movie.mpg  -o movie/

The t switch gives the DVD a title. All DVD files need a tile so we give it a blank one. The v pal switch is just to make sure it remains in the PAL format. Then we have the name of the mpg file, finally the o switch is the path to the DVD filesytem.

Once we have done this we just run;
dvdauthor -T -o movie/

This just gives the the DVD a table of contents, which as far as I'm aware is just needed so we can burn the DVD.

Lets burn this baby to disc

Now we have the DVD filesytem on our PC we need to get it on to a coaster.
growisofs -dvd-video -Z /dev/dvd movie/
/dev/dvd is the path to your DVD writer and movie/ is the path to your movie DVD filesytem we created in the previous step.

In Summary

Well thats it we managed to burn an avi file onto a dvd just using the terminal, and we didn't even need to use a GUI. This process usually takes about 2.5 hours, so using screen comes in handy as we can just let it run in the background.

Now lets have all the commands we used in one place.
screen
tovid -dvd -pal -in movie.avi -out movie
dvdauthor -t -v pal movie.mpg  -o movie/
dvdauthor -T -o movie/
growisofs -dvd-video -Z /dev/dvd movie/

picture credit john_a_ward