Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One way to author DVDs from the command line UNIX
There are a lot of ways to author a DVD, like iDVD or SmallDVD. They are quite powerful and require a lot of interaction from the user. But how could we author a DVD without using a GUI? The objective of this hint is create a simple DVD to view some DivX (or other formats) in a DVD player. I do not need fancy things, like menus. I just want a DVD like a VHS tape, one movie is after the other, but more comfortable to use because we can access the movies using the Chapter button on the DVD player's remote.

The best part of not using a GUI is that you just spend one minute preparing everything, and then there is no more interaction until the end of the proccess. I prepare my DVDs during the night. That is great because the Mac could need several hours to prepare the DVD. To use this hint, you must be comfortable using Terminal (only a little, you don't need to be an expert -- I am not) and installing applications using Fink.

First you should install DVDauthor and mkisofs, both available in Fink, and MPlayer.

After that, you should follow this protocol...
  1. Convert the DivX files to mpeg2, the format used in DVDs:
    mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd 
     -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts 
     vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:
     aspect=16/9 -ofps 25 -o movie1.mpg movie1.avi
    Note that these are the settings I use to prepare a PAL (not NTSC) 16x9 DVD. In case you wanted to prepare a different DVD, ie NTSC or 4x3, you could find the right setting for every situation on this page.

  2. If you don't want to add subtitles, go to the next step. To add subtitles (in any format compatible with Mplayer):
    1. We have to create a file called subtitle.xml with the following contents:
      <subpictures>
              <stream>
                <textsub filename="movie1.srt" characterset="ISO8859-1" 
                fontsize="18.0" font="Arial.ttf" horizontal-alignment="center" 
                vertical-alignment="bottom" left-margin="60" right-margin="60" 
                top-margin="20" bottom-margin="30" subtitle-fps="25" 
                movie-fps="25" movie-width="720" movie-height="576"/>
              </stream>
            </subpictures>
      Notice that 25 is the fps of a PAL video, and that 720x576 is the resolution of a PAL 16x9 DVD.

    2. Type this instruction in the Terminal to add the subtitles: spumux -s0 subtitle.xml > movie1.mpg > movie1sub.mpg.
  3. Author the DVD:
    1. Create a folder called DVD"

    2. Prepare a new file called dvdauthor.xml with the following contents:
      <dvdauthor dest="DVD"> 
            <vmgm /> 
              <titleset> 
                <titles> 
                  <video format="pal" aspect="16:9" /> 
                    <pgc> 
                      <vob file="Movie1sub.mpg"/> 
                      <vob file="Movie2.mpg"/> 
                      <vob file="Movie3sub.mpg" /> 
                    </pgc>
                  </titles> 
                </titleset> 
              </dvdauthor>
      The DVD in this example has three movies. The first chapter will be Movie1, the second Movie2, and the third chapter will be Movie3. The first and the third one have subtitles.

    3. Prepare the file structure of the DVD with the command: dvdauthor -x dvdauthor.xml
  4. Next, we should create the DVD image (dvd.iso): mkisofs -dvd-video -V Title -o dvd.iso DVD. Finally, we then burn the DVD. You could use a command line command like cdrecord, but I prefer to use Burn or LiquidCD to do this task. I like to check twice that I am not deleting the wrong rewritable DVD.
To prepare a DVD, I spend a couple of minutes to prepare all the XML files and a small batch file called DVDcode with all the commands (all the files must be in the same folder where the movies are):
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd 
-vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:
vbitrate=5000:keyint=15:aspect=16/9 -ofps 25 -o Movie1.mpg "movie 1.avi"

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf 
scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts 
vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:
keyint=15:aspect=16/9 -ofps 25 -o Movie2.mpg "movie 2.avi"

dvdauthor -x dvd.xml
mkisofs -dvd-video -V 24 -o dvd.iso DVD
Beware that the mencoder commands must each be in one long line. In this case, there were no subtitles added. Execute the file using ./DVDcode in the Terminal.

Probably a better bash or AppleScript file could be created to automate the authoring task, but I leave this to the readers ;-). If anybody is interested, I think that this hint works on a Linux box, too. To prepare this hint, I used these tutorials: [robg adds: I haven't tested this one...]
    •    
  • Currently 2.00 / 5
  You rated: 1 / 5 (4 votes cast)
 
[20,246 views]  

One way to author DVDs from the command line | 5 comments | Create New Account
Click here to return to the 'One way to author DVDs from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to author DVDs from the command line
Authored by: boredzo on Oct 23, '06 01:50:06PM

You could also use drutil burn to do the burning step.



[ Reply to This | # ]
One way to author DVDs from the command line
Authored by: haakin on Oct 23, '06 02:23:23PM
There is one typo in the step 2.2. It should say:

spumux -s0 subtitle.xml < movie1.mpg > movie1sub.mpg

[ Reply to This | # ]

One way to author DVDs from the command line
Authored by: chyna4xena on Oct 23, '06 10:59:53PM

While I think this hint is great, and I am always happy to see alternative means to achieve ends, I was surprised to see you say that the GUI programmes require "a lot of interaction from the user".

It seems to me that the time taken for your command-line method, and the interaction (typing) involved, would vastly exceed that of either iDVD or SmallDVD.

It also appears as though there are several sequential steps to your process, so there is no way it could all happen overnight, without interaction.

GUI programmes can convert the source files, mux, author and burn all in one go, once you're ready to proceed, whereas this process needs a command to be entered for each of those steps.



[ Reply to This | # ]
One way to author DVDs from the command line
Authored by: haakin on Oct 25, '06 11:20:07PM

Although it could seem that the process of this hint requires several steps, in fact it requires only one. To make a DVD I only need 2-5 minutes to prepare the DVDcode and dvdauthor.xml files. Obviously you can do all the process step by step, but it has no advantages. Well, it's good to learn the process, but once you have there is no need to do it manually.

The first 3 steps were just a way to explain the DVDcode batch file.

Once you have used this hint there is no much typing involve because you reuse the files. You should only to change the name of the files and, sometimes cut'n'paste one or two lines.



[ Reply to This | # ]
One way to author DVDs from the command line
Authored by: chyna4xena on Oct 26, '06 07:28:51PM

True, but even though you can batch the instructions, they still have to be altered (and the xml file also needs changing) depending on the number of files, their filenames, and presence of subtitles in each.

So it might be set-and-run, but the 'set' portion each time requires a fair amount of interaction. Like I said, it is very useful to have alternative means to same ends, but I think the typing and cut-and-pasting involved in this method - the interaction - outweighs the time and effort required with a GUI.



[ Reply to This | # ]