How to convert a video file to an iso to burn to dvd

5486

I have been looking for this stuff for a while, and while it is out there, the documentation is fragmented. I am posting here the steps that I am using to create dvds from regular video files with completely free software. I use Linux, and I don’t know if the tools are available in Windows or not. This tutorial is for linux. There are probably gui tools to do all of this stuff, but I have found that the command line tools are much more efficient and just work a lot better. They don’t crash near as often, and give you a lot better errors if you have errors.

Use your package manager to install ffmpeg, dvdauthor, growisofs and genisoimage. You may want to install vlc just to test that the iso file is what you want before you burn it. I use debian, so my commands would be like this:

sudo apt-get install ffmpeg dvdauthor genisoimage growisofs vlc

Now, you have all the tools you need to convert your video file to an iso to burn to a dvd and it will play on regular dvd players.

Before you begin, it is best to do a

export VIDEO_FORMAT=NTSC

so that you don’t get errors from dvdauthor. You can set this in /etc/profile if you want. Of course, if your default video format is PAL, replace NTSC with PAL.

There is a trick that I have found to getting widescreen movies to format right for the dvd, and that is to pass the “-aspect 16:9” option to ffmpeg. It will make the .mpg file look squished, but the dvd will burn correctly. This is why I recommend installing vlc to test the .iso file before you waste a dvd.

Ok, lets get to it!
Get you a video file. I have used all kinds, but mostly I convert .mkv files to mpg to use. I don’t really care how you got the video file either.

Now that you have a video file, you want to convert it to a dvd readable format, which is .mpg. We will use ffmpeg to do this, and this is how:

ffmpeg -i yourfile.mkv -target ntsc-dvd yournewfile.mpg

First, we call the program, “ffmpeg”. The “-i” just declares your input file, and the “-target ntsc-dvd” defines the type of dvd we are making.

Depending on the size of the file you are converting, it could take a while. I usually convert 8+ GB files so it takes an hour or so.

If you have a widescreen movie, then you will want to declare “-aspect 16:9” in the command so that it will keep the widescreen format when you convert it to iso.

ffmpeg -i yourfile.mkv -target ntsc-dvd -aspect 16:9 yournewfile.mpg

We have that down now. We can convert regular and widescreen movies to a dvd friendly format. We aren’t done with ffmpeg just yet. There is one more trick that has come up for me, and that is “-map”.

When you have more than one audio track, ffmpeg will use the first one as default. It doesn’t matter if it is your native tongue, it still uses it. We can change that with “-map”.

Let’s say we have a file with two audio tracks. One is german, one is english, and german is the first one. The video track is usually the first one (0.0), so we will define two maps because ffmpeg wants you to define all the maps that are being output, which is usually two.

The german audio will be (0.1) and the english audio will be (0.2). By default, with no specification, ffmpeg will use the german audio track because it is first. Here is how we specify for ffmpeg to use english:

ffmpeg -i yourfile.mkv -target ntsc-dvd -aspect 16:9 -map 0.0 -map 0.2 yournewfile.mpg

You notice that we defined the video track (0.0) and the english audio track (0.2). If your video only has one video track and one audio track, you don’t need to use map at all.

Now, run the command (whichever one you need) and wait. When it is done, you should have a nice new .mpg file to play with. You should know that ffmpeg does much more than this, but that would exceed the scope of this tutorial. Maybe when I experiment more with video editing, I will explain more of ffmpeg in other tutorials.

We can move on to dvdauthor now.

Dvdauthor takes the .mpg files and creates a dvd file structure suitable for playing in dvd players. To create a simple structure from one of your .mpg files, you need to create a directory to put your dvd file structure in. I usually make a folder with the same name as the project I am working on.

mkdir dvd
dvdauthor -o dvd -t yournewfile.mpg

The “-o” switch defines the output folder, and the “-t” switch defines the title file. You will do this command for every file you want to put on your dvd. You can put as many as you want, as long as you have enough space on your disk.

When you add your files, you can then create a TOC (table of contents) so that genisoimage can read it to create the .iso file. That command is:

dvdauthor -o dvd -T

The “-o” switch once again defines the output folder, and the “-T” switch defines a TOC.

We are now ready to convert your dvd to an .iso file to burn.

The command we use to convert all of that is:

genisoimage -dvd-video -o yourimage.iso dvd

The “-dvd-video” switch tells genisoimage to create a dvd video image, and the “-o” switch is once again the output file. The last bit at the end is the folder that genisoimage will read from to create the .iso image.

Now, use vlc and open the file and see if it is what you wanted it to be. If not, go through the steps and see if you can’t change something to get it right.

Once you have created the .iso image, you can use whatever you want to burn it, but I have been happy with growisofs. I find that command line burners are faster and just more convenient.

growisofs -dvd-compat -Z /dev/sr0=yourimage.iso

The “-dvd-compat” switch means maximum compatibility with dvd video players, and the “-Z” switch means open an initial session to burn onto. /dev/sr0 is your dvd burner, and yourimage.iso is the file you created.

Now, go watch your movie!