# All About Converting From Several Video Formats To DVD

    This is a tutorial for converting from different video formats (AVI, Real Media, Mkv, Ogg, etc) to a DVD format, playable on any DVD player.

## Versão em Português/Portuguese Version

Para uma versão em português, vá para este link: Tudo Sobre Conversão De Diversos Formatos Para DVD.
For a Portuguese version, go to this link: Tudo Sobre Conversão De Diversos Formatos Para DVD.

## Introduction

I am writing this tutorial because I spent months trying to make good DVDs from fansubbed animes and most of the errors I got (which were a lot) didn't get explained well enough on any of the guides I found.
I intend to deeply cover all the steps and troubleshooting for making good DVDs out of AVIs and Real Media videos.

## Software Needed
### Software Overview
#### TMPGEnc Xpress

This is the software that is going to be used for conversions. One or more video files are loaded on TMPGEnc Xpress, edited (using any of the filters available) and transcoded into MPEG-2 format. The converted videos are then ready to be compiled onto DVD.

#### Avisynth

This software is going to be used to frameserv the original video to TMPGEnc Xpress. This will be explained further in the #Frameserving section.

#### DVD Lab Pro

This is a DVD authoring software. It is used to compile a DVD using MPEG-2 files. It allows you to create several different types of menus including animated, with sound, etc... It is a powerful piece of software, but in this tutorial I am going to stick to the basics, i.e. creating simple good looking menus, chapter selection, etc...

#### Riverpast Audio Converter

Sometimes Avisynth cannot recognize the audio stream from the video file. When that happens, the audio will have to be extracted from the video file, so Avisynth can load the video and audio streams separetly.

#### Divfix

This software will be used in case the video files are corrupt.

#### Real Alternative

This software is necessary if you want to convert Real Media files, because Avisynth cannot recognize these formats (like rm or rmvb) otherwise.

#### GSpot

This software is used to find out which codecs the AVI video requires. You have to download these codecs if you still don't have them in order to play the video.

#### Codecs

These are not strictly essential. Depending on the video, different codecs will be needed. I recommend using the Combined Community Codec Pack. This codec pack has never caused any errors on my PC, and it comes with almost every codec you are ever going to need.

## Conversion Process Overview

This section covers some technical terms and processes involved in the conversion process.

### Frameserving

One of the problems encountered while encoding videos is crashing. TMPGEnc Xpress uses a lot of memory while converting videos, and if you try to convert several videos (for example, encoding several chapters of an anime) and import the video files directly into TMPGEnc Xpress, the chances that the program will crash during conversion are extremely high. Just one tiny reading error during the encoding is enough to stop all the conversion that was already running for several hours. when this happens you will have to start from the beginning.
Frameserving solves that problem. If you try to load the video directly into TMPGEnc Xpress, huge temporary files are created during conversion, which greatly increases the memory usage, and consequently increases the chances that reading problems occur and a lot of time gets wasted. Avisynth is a software that allows you to create scripts to read the video file and send only small parts of it to the decoder. For example, you have a video called Movie.avi, and a script file called Movie.avs. Movie.avs is basically a text file with a few lines that indicate the video to be loaded. So one of the lines will look like this: file = "Movie.avi". Then, when normally you would open Movie.avi in TMPGEnc Xpress, now you will open Movie.avs instead. This way, when the conversion starts, Avisynth starts to frameserv Movie.avi, which is sending tiny pieces of the video file one at a time for TMPGEnc Xpress to read. This way, the space used for the temporary files is minimized, memory usage is reduced, and the chances of crashing is greatly reduced.

### Converting

Most DVD players cannot read AVI/RM/RMVB... etc. files directly. To be able to watch such videos on the TV, you must first convert them to a format that the DVD player can understand. This format is MPEG-2. MPEG-1 is also readable by DVD Players, but they have much lower quality. If you want to make VCDs then that is the format you want to convert to. This tutorial will not be covering the process for creating VCDs.
TMPGEnc Xpress plays the converting part. I also choose this software because it has several features that really makes our life easier, like being able to resize the video and converting several videos together, like chapters, to easily preview and fill the size of one DVD.
One of the most common problems when trying to convert a movie to DVD format is the overscan. Most televisions are made in a way to please the general public. For that reason, everything you see on the TV had the borders cut, top, bottom and sides. This is made to ensure that the image covers the whole screen. That is called overscan. Unfortunately, when you make a DVD, it's borders will most likely be cut too, and if the video had subtitles too close to the bottom, they won't be fully shown.
The solution to that is simple. TMPGEnc Xpress has an option of resizing the video. All you have to do is adjust the size (the size has to be only a little smaller than the original video to fix the overscan). Then the video will get a little smaller with black borders on the sides. Those borders will be on the overscan area and the video will show on the whole screen without the cut borders.
It is always a good idea to test on the TV several different resize values for the video you are converting to know which one will best fill the TV. For that, TMPGEnc Xpress has also the option of cut editing the video. You can then select only a few seconds of video to convert faster, so you can quickly test the results on the TV.

### Compiling the DVD

After the conversion is successfully completed, the files are still not ready to be burned to the DVD. The format is correct, but the files have to be organized in order to be played in a regular DVD player.
The last step before burning it to load the video files onto DVD Lab Pro. Then you can configure the chapters, menus, extras, backgrounds, and any other details you may like to add to the DVD. After that, the DVD will be compiled, a process that usually takes about 15 to 20 minutes. Then the DVD is ready to be burned and played on any DVD Player.

## Making the DVD - AVI

These are the steps to be followed in order to make DVDs out of AVI files. Other formats will be covered later, because only a few modifications of the general process have to be made.

### Creating the script with Avisynth

The first step is to create a script that points to the video that you are going to convert. The script created is going to be processed by Avisynth and can be played like a normal video in most video players, like Windows Media Player. It is also treated like a video by TMPGEnc Xpress, as explained in the section #Frameserving.
This is a basic script that is going to be used in the conversion. This script has been borrowed from the tutorial AVI to MPEG-2 with AviSynth and TMPGEnc Xpress:
    # source AVI file file = "C:\...\Movie1.avi" # use actual filename # open AVI video-only to get correct frame rate AVISource(file, audio = false) # save correct frame rate for DirectShowSource frate = Framerate # reopen in DirectShow for better audio compatibility DirectShowSource(file, fps = frate)
Basically all you have to do is paste this text on the notepad, change the file parameter to point to your movie, and save it with a name like Movie1.avs. The avs extension is important so Avisynth can recognize the script file and load the video.
After you have done that, open the script in Windows Media Player to see if it worked. If you get a error that looks like this:
This kind of error usually means you have made a mistake on the file name or a typo anywhere in the script. Just see what line the error is in and try to correct it. If you copied the script exactly like shown in here, it should work fine, unless the path to the video is incorrect, there is an error in the video or a missing codec. If that's the case, use G-Spot to find out which codec you will need. For help in that, go to G-Spot.
If the video works correctly, that means you are ready to open it in TMPGEnc Xpress. Jump to #Creating a test video
OBS: The video takes longer to open through the script. But it will open much faster if you have the codec ffdshow installed. That's good if you are opening several files on TMPGEnc Xpress, because they all can take a while to load (maybe one minute each) without ffdshow.
If the video plays but has no sound and you have the correct codec installed, then you will have to extract the audio stream to a WAVE file. Riverpast Audio Converter is very easy to use, but use any program you like. For some reason Virtual Dub seems to have problems with TMPGEnc Xpress though, so I don't recommend using it to extract the audio from the movie.
Simply drag and drop the movie onto Riverpast Audio Converter.
On the Audio Format options on the bottom, select the following configurations:
    File Type : WAV - Waveform Compressor : PCM/Uncompressed Stereo Sample Rate : 48khz - DVD Quality Resolution : 16 bits - Normal
Then click Convert.
Now you will have to change the script, so you can load the video and the audio separately. Use the following script and change the path to point to the correct video and audio (that you have just converted).
    # source AVI file file = "C:\(...)Name.avi" # source WAV Audio file audio = WavSource("C:\(...)Name.wav") # open AVI video-only to get correct frame rate AVISource(file, audio = false) # save correct frame rate for DirectShowSource frate = Framerate # reopen in DirectShow for better audio compatibility video = DirectShowSource(file, fps = frate) Normalize(0.98) # combine them into a single clip AudioDub(video, audio)
Test it on the Windows Media Player now. You should see the video and hear the audio just fine.

### Creating a test video

The next step is to test the right configuration so the video will look good on the TV. All these tests seem to be a waste of time, but with a little practice you will be able to do them really fast. And they are important so you can know how the DVD will look like on the TV before actually having to convert the whole thing.
Open TMPGEnc Xpress. Click on Start new project. This step is only a test, so even if you are planning to convert several chapters at once, you should not do that yet. For now, add the same script two or three times. You will use a different configuration for each one, so you can know which one will look better on the TV.
Click on Add File. Add the whateverthename.avs that you created before. Now the following screen will appear:
Before you change any configurations on this page, you have to check the resolution of your video. If you cannot see the resolution in the properties of the file, click on Filter (Marked 3 on the screenshot). In the screen that will appear, right below the timeline, the resolution will be shown (for example, 800x600). Then click on Clip info above, to return to the previous screen.
You must know the resolution so you can select the correct Aspect Ratio (marked 1 on the image above) on TMPGEnc Xpress. For example, if your video is 640 x 480, then you should select Image 4:3. If you don't know which resolution is widescreen (16:9) and wich one is standard (4:3), check this List of common resolutions. Even if the resolution of your video is not listed in there, its easy to know just by watching. If your video is widescreen, select Image 16:9, otherwise, select Image 4:3. Don't click OK yet.
Select Cut-Edit on the top (marked 2 on the image above). The following screen will appear:
What you will do now is select only a small portion of the video to be converted, only a few seconds. This way, you can convert that part of the video really quickly to test the results on the TV without wasting time.
Click on the timeline (marked 1) and drag it to any part of the video that has a good image. Is even better to select a scene with subtitles showing. Then click on Set as Start Frame (Marked 2). In the timeline, go a few seconds further, and then click on Set as End Frame (Marked 3). You should get something like the image shown above. The small triangles bellow the timeline restrict the video that will be converted.
After that, click on Filter (Marked 3 on the first screenshot). The following screen will appear:
This is the screen that you will use to fix the overscan of the film. Select Resize on the left (Marked 1). This setting allow you to resize the video and create black borders around it, so they wont be cut in the TV. In Image position (Marked 2), select Center (Custom size). This means the video will be centralized, and from the new edges to the end of the original size, black borders will be put.
Don't put huge borders. Just look at the original size and take 20 pixels from top and sides. For example, if the video is 640x480, the new size should be 620x460. That is very little, so the movie won't really get stretched the from the disproportional resizes. If you want to get a calculator and find out the proportion to resize correctly, that's ok, but the difference will really be insignificant. When converting widescreen videos, I have learnt that the videos get a better look when stretching the most possible in hight. Usually I make my widescreen videos with a resolution of 694x480, no matter the starting size (again, that is only for widescreen videos). In the preview there will seem like the video will exceed the borders of the screen, but in the output the video will be perfect.
In this example, the original size was 640 x 364 (widescreen). I resized it to 620 x 340. The black borders you see in the center are just a preview. They will look even larger in the TV, so you can't create big borders. But like I said, actually I would use a resolution of 694x480.
You don't have to change the Resize method. Just keep it Adaptive.
Now click OK.
Ok, now do that whole Add file process again. Repeat everything, but now don't use the Resize filter. Now you have two tiny peaces of video, one with borders and the other fullscreen. If wou want, make another file with a different border. But probably just the 20 pixels will be good enough. When you play that on the TV, just see what video looks better, and use that configuration to convert the whole thing.
Next, click on Set Output, on the top. Select Standart Template->DVD->NTSC. On aspect ratio, select the same aspect ratio you have chosen previously (16:9 for widescreen, and 4:3 for Standart). Click on Select on the bottom.
The following screen should appear:
If it doesn't, click there:
Now look at the blue bar (marked 1). That bar cannot pass the limit of the DVD. In the test step, the videos are so small that it is impossible for that to happen. But be careful, when you are converting for real, if you use more than 100% of its capacity, the video will be converted, but later it won't fit in the DVD! Just click the arrow down until it gets to 100%. If you cannot get it down to 100%, that means you are trying to convert too many videos on the same DVD and TMPGEnc Xpress cannot compress anymore, so you will have to delete one or more of them.
Now look at Image resolution (marked 2). Make sure it's on 704 x 480, or else you will get a really ugly output.
That's it! Click OK, then click Encode. On the Output path tab bellow, select Output clips separately. It decreases the chance of crashing and makes it easier to create chapters later. In the Encoder setting tab, in the Preview frequency option, select No preview. The process goes faster when the preview is turned off. Still on the same tab, on both of the Task priority options, select Highest, to accelerate the process even more. Now click on Start Output, and wait. Since this is a test, it should take less than a minute. When you are doing the real thing, though, it will take several hours. You should let it running at night. And don't turn on high memory using programs, like games or anti-viruses while encoding.
The output files will be MPEG files, and are ready to be loaded on DVD Lab Pro and burned.

### Compiling the test DVD

Now open DVD Lab Pro. If you have DVD Lab Standart, you can try to use it. But I had several weird bug problems with the standard version, so I recommend using the Professional version.
At this point, you will make the test DVD, so you don't have to worry with adding chapters, putting backgrounds and all that. But I'll explain how to do those things in advance. So, when you are creating the real thing, just follow these instructions.
When you open it, you will see this screen:
So, to the basics:
1 This is the preview screen. It doesn't really show anything important. Only the video, without audio. It is only useful really if you want to set the chapter points at specific places. Otherwise, you don't need this screen.
2 This is the connections screen. It shows you, for example, what happens when the menu times out, if it goes to the next menu, or the video, etc. It is useful if you want to play one movie after the other. Just drag the little gray ball from movie 1 to movie 2.
3 These are the movies you have on the project. It is an important part. You will have to create one movie for each chapter or movie you want to put on the DVD. By chapter, in this case, I mean each separate MPEG file that you have created in the conversion process.
4 These are the menus you have on the project. If you want to create a main menu and one chapter menu, for example, you will need two menus.
5 This is the Assets screen. It is a very important screen. Any movies, audios, subtitles, etc. will be imported and shown on this screen.
First of all, go to the folder where you have created the MPEG files with TMPGEnc Xpress. Select all of them and drag to the Assets screen. A screen will appear asking if you want to demultiplex the files. This means to separate the audio and the video in two different files. DVD Lab Pro tells you that it is better do demultiplex, but since you used TMPGEnc Xpress to create the movies, you don't have to worry. Demultiplexing takes a while and you really don't need to do it. Just click quick mode without demultiplexing.
Now that your videos are in the Assets screen, you have to add them to the DVD. Suppose you have created three videos. Right click on the Project screen (the one with the numbers 2, 3, and 4 marked). Then select Add movie. Just to that until you have enough movies for each file you want in the DVD (in this case, three).
Now, double click on each movie you added (where I marked 3). This screen will appear in the place where were the Connections screen:
Just drag the movie from the Assets screen to the Movie screen above. If you have demultiplexed, the audio is in a different file and you have to drag it too. If you have a separated file for subtitles, drag it here too. Do that to each movie you have on the assets screen, and drag each one of them the each movie screen that you created.
Now you can add chapters, if you want. The easiest way is to make a text file with the minutes you want to make the chapters. This way, you can use this file to add chapters to every movie you make. Let's say you want to add chapters at every three minutes. Just create a text file like this:
    00:03:00 00:06:00 00:09:00 00:12:00 00:15:00 00:18:00 00:21:00 00:24:00 00:27:00 00:30:00 00:33:00 00:36:00 00:39:00 00:42:00 00:45:00 00:48:00 00:51:00 00:54:00 00:57:00 01:00:00
Now click the menu 'Movie->Import Chapters...', and import the file you saved. This will add chapters every three minutes to your movie until it reaches one hour. If it has less the one hour, DVD Lab Pro will automatically stop adding chapters. If it has more than one hour, or you want place the chapters differently, just change the text. You can also use the preview screen to see exactly where you want to place the chapters, and click on Add chapter point, which is the little + just above the preview screen.
Now, you have to create the menus. Click on menu 1 on the left (marked 4). If you want to make a main menu, and a chapter menu, just add another menu like you added the movies.
This screen will appear:
This is where you will create your menu. First, if you want to put a background, just find a picture you like and drag here. You can resize it to fit that screen.
To make the menu options, click on 1. Then write whatever you like so who is watching the DVD will understand. For example, write PLAY. After that, the option PLAY will be where you have placed it. But that is just a word yet. To actually make that work as an option to 'play', you have to link it. Right click on the word and select Link->Movie 1->Chapter 1(Movie start)', marked 3. That means that when you select PLAY on the DVD player, it will play the Movie 1 from the start. Use the same process to navigate through the menus linking one to another (to link an option to another menu, right click on the word and select Link->Movie 1->Menu 1', marked 4), changing the audio, the subtitles, etc. This is the base to create different and complex menus, so just try more and more features. When you get the hang of it you will be able to easily make a lot of different good-looking menus. Take a look at the features in the menu Menu as well, there are interesting things available there. Just use your imagination!
Now that you made the menus, you might want to test them. Just click on the Simulate button, and on the Follow links button, both marked 5 on the screenshot. Now you can click on the options you have programmed to check if they do what you want.
Now it is time to compile the DVD. Click on the menu Project->Compile DVD. The compile screen will open. Don't change the default options, just set the destination directory you want for your DVD files, and make sure the checkbox Run on Background is unchecked. If you run it in foreground the compilation will be much faster.
After the compilation is done, just burn the compilation with Nero or another program of your choice. In Nero, select the option to create a DVD-Video and just drag the compilation folder in there. Always keep a DVD-RW, so you won't waste the DVDs with the test video. Now you can test the DVD on the TV.

### Creating the real DVD

When you test the DVD on the TV, look which movie looked better on the TV. When you know that, do the same process again. But now, instead of adding the same script twice on TMPGEnc Xpress, add all the videos you want to put on the DVD. Don't use the Cut edit setting, because now you probably want to convert the whole movie. Use the filter settings exactly as you used on the movie that looked better on the TV. Remember all the other details, just as you have seen on #Creating a test video, for they all are important. When everything is set, click on Start Output again. Now is the time you should let it running and go to sleep. It will probably take all night long.
When it is done, just make the compilation as explained on #Compiling the test DVD and burn it. You are done! Now you have your DVD ready to run on any DVD player!

## Making the DVD - Real Media - MKV - others

To convert from real media to MPEG-2, a few things must be changed from the previous instructions. Just do everything you would do to convert from an AVI format. Ill list below the changes you should make for Real Media. I am not an expert at converting from real media to MPEG-2, actually I hadn't done it so much. But I will talk about the errors I encountered when I did.
Obs. Know that Real Media is a very detail poor format, so if you try to convert it to DVD, the result will have probably low resolution and should look bad on the TV. If you are looking for quality, consider using AVI instead.
1 When you load Real Media videos with Avisynth, there is a great chance the audio will get out of synchronization. To fix that I changed the script. I used a script with this single line:
    DirectShowSource("c:\movie.rmvb", fps=23.976, convertfps=true)
That fixed it. Separating the video from the audio didn't. If that doesn't work, you should try different fps values.
2 When loading the converted MPEGs into DVD Lab Pro, the program will ask you to demultiplex the files, and you probably wont have a choice of not doing that. I faced then a strange bug. After you demultiplex the files, only the video stream was created, and no audio. I don't know why that happened, so pay attention if that happens to you too. If only the video files appear on the assets screen (the video files are the ones with the .mpv extension, and the audio files are .mpa) after you demultiplex, you will have to extract the audio from the MPEG yourself. You can use the Riverpast Audio Converter for that. The only problem is that the WAV output file is really big, so you will probably need to convert the WAV to AC3 or MPA first, or the final compilation may not fit in the DVD. Is not hard to find software that convert from WAV to AC3. After you have extracted and converted the audio streams, you will have to add them to the assets screen too, and add them with each video you add in the Video screen, as explained in the section #Compiling the test DVD.
Those are the problems I had when converting from Real Media to DVD. If you have different problems, go to the section #Contact bellow.
Now, to convert mkv, ogg, or most other types of formats, just use this line to load the file:
    DirectShowSource("file.extension", fps=23.976, convertfps=true)
That will open the movie without problems. If you want to load a separate subtitles file into the movie, add the line below:
    TextSub(subtitle file)
In this case, the script would look something like this:
    DirectShowSource("Video.mkv",fps=23.976,convertfps=true) TextSub("subtitle.ass")
Now all you have to do is load this script on TMPGEnc Xpress. DirectShowSource works with most of the video format.

## Troubleshooting

Bellow will be listed common errors you may encounter when converting videos.
* When I try to extract the audio stream from the movie (AVI) with Riverpast Audio Converter, the program says that it doesn't recognize the format of the file.
This could mean an error in the video file. Try using Divfix to fix the file and try to extract the audio again.
So that's it, and I wish you all the best of luck!