Previously I posted, pointing to a tutorial on converting AVI files to DVD. The tutorial below builds on that one, using different tools for the conversion of the input file to an MPG format.  Please be aware that the DVD created by following these steps will not have a menu.

Step 1: Convert the file to MPG

Instead of using transcode to rip apart the input file and then multiplexing the new files back together with mplex, you can use ffmpeg to do the full conversion. It should work for any video file. I have had success using it on AVI, MKV and FLV files, regardless of the codecs inside the wrapper.

For the sake of this tutorial, we will generate an output file with the name “output.mpg” that we will then reference in other commands. Change “input.file” to the name of the file that you want to convert.

ffmpeg -i input.file -target dvd -copyts -aspect 16:9 output.mpg

Note: if your file’s aspect ration is 4:3, use that ratio instead of 16:9. Also, if you need PAL instead of NTSC, change the -target dvd to -target pal-dvd.

Now if you get an error (like many Ubuntu 9.04 users have) indicating “Unknown encoder ‘mpeg2video’”, try this trick that I found at the Paper Inside blog. Basically, it wipes out the ffmpeg that you currently have (with stripped libraries) and reinstalls it with the unstripped libraries. Be sure to capture the full line on the last command, as it goes on for quite a bit.

sudo apt-get purge ffmpeg

sudo apt-get update

sudo apt-get install libavcodec-unstripped-52 libavdevice-unstripped-52 libavformat-unstripped-52 libavutil-unstripped-49 libpostproc-unstripped-51 libswscale-unstripped-0 ffmpeg

Note: Paper Inside’s command installs libavcodec-unstripped-51 and mine installs libavcodec-unstripped-52. I guess the repos must have changed since his post, as I couldn’t find 51. The 52 library worked perfectly for me, though.

Step 2: Make a folder for your your titlesets to go into

The folder needs to be in the same location as your MPG file you just made. For this example, we’ll create a folder called DVD:

mkdir DVD

Step 3: Make an XML file

Again, in the same location as the file and folder you just made, create a text file called dvdauthor.xml:

touch dvdauthor.xml

And then populate that file with the following content, using your favorite text editor:

<dvdauthor dest="DVD">
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="output.mpg" chapters="0,5:00,10:00,15:00,20:00"/>
</pgc>
</titles>
</titleset>
</dvdauthor>

Note the double quotes around the name of your MPG file. You can make the chapters at whatever increments you want by editing the time values. Also, if you want your finished DVD to play more than one video, just add a second pgc section to you dvdauthor.xml file like this:
<dvdauthor dest="DVD">
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="output.mpg" chapters="0,5:00,10:00,15:00,20:00"/>
</pgc>
<pgc>
<vob file="output2.mpg" chapters="0,5:00,10:00,15:00,20:00"/>
</pgc>

</titles>
</titleset>
</dvdauthor>

Step 4: Convert the MPG file to DVD titlesets

This dvdauthor command will populate the DVD folder you made with an AUDIO_TS and VIDEO_TS folder and populate the VIDEO_TS folder with the .vob and other files necessary for DVD playback.

dvdauthor -x dvdauthor.xml

Step 5: Convert the titlesets into an ISO

This mkisofs command will take the DVD titleset folder you just made and copy it over to an ISO file that will be ready to burn to a DVD. The syntax for mkisofs is pretty straightforward, though different from some other input/output tools. In order to generate my .iso files, I use the following options in mkisofs:

  • -o to indicate the output file location and name
  • -V to set the volume label on the .iso file (which some DVD players and media players will display when they begin playing the DVD or ISO file)
  • -dvd-video to generate a DVD-Video compliant UDF file system

In the command below, change the output argument (after the -o) to whatever you want the ISO file to be called and the volume label argument (after the -V) to whatever you want the volume label to read. The final argument is the input, and it references the DVD folder that we made above (the one we populated with our titlesets,) so leave it the same unless you put your titlesets somewhere else.  If so, remember that the input for mkisofs should reference the folder that contains the AUDIO_TS and VIDEO_TS folders.

mkisofs -dvd-video -o mydvd.iso -V MYDVD DVD

Step 6: Burn the ISO file to a disc

Now you have a DVD image ready to be burned to a DVD disc. You can check the image before burning by opening it with VLC. It should play in VLC just like any other video file. And while there are probably command line tools for burning to DVD, I always use Brasero’s “burn image” option. You can burn the ISO to a DVD-RW disc to try it out in your DVD player before committing the image to a DVD-R.

Advertisements