Linux.com

Feature

Convert any video file to DVD with open source tools

By Manolis Tzanidakis on April 27, 2006 (8:00:00 AM)

Share    Print    Comments   

You've just downloaded the new episode of your favorite video podcast, and you'd like to watch it on your big-screen TV. Unfortunately, the video is encoded in XviD or QuickTime format, which your DVD player doesn't support. Don't worry -- here's how you can convert any video file to DVD using dvdauthor and MPlayer.

Packages for both programs are available for most Linux distributions and BSDs, so you can install them on your favorite OS easily. Compiling the programs from source isn't difficult, as long as you get their dependencies right. Both programs provide adequate documentation about the installation. You can burn the final files to a DVD disc with the help of the growisofs utility from the dvd+rw-tools suite.

Converting the files to MPEG-2

First, you must convert your file to MPEG-2 for the video and to AC3 for the audio, in order to be compliant with the DVD video specifications. If the audio on your file is already encoded in AC3 format, you can use it as is without re-encoding it. Run this command to check the audio format of the file:

mplayer -vo dummy -ao dummy -identify your_video.avi 2>&1 | grep AUDIO_FORMAT | cut -d '=' -f 2

If it returns hwac3, the audio part of your file is encoded in AC3, and you can convert the file to MPEG-2 with the following command:

mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 \
-ofps 25 -o your_video.mpg your_video.avi

If it isn't encoded in AC3, run this command:

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:\
acodec=ac3:abitrate=192 -ofps 25 -o your_video.mpg your_video.avi

The previous commands create an MPEG-2 file in phase-alternating line (PAL) format with an aspect ratio of 16:9. PAL is used in most of Europe (except France). If you want to create a National Television System Committee (NTSC) DVD, which is the North American video standard, replace scale=720:576 with scale=720:480, keyint=15 with keyint=18, and -ofps 25 with -ofps 30000/1001. If you don't have a wide-screen TV, you should encode your file with an aspect ratio of 4:3 by replacing aspect=16/9 with aspect=4/3.

For more information, check the MPlayer's man page, which provides detailed explanations about each option used in these commands.

This process should take some time to finish. My 1.5GHz Centrino laptop took about 25 minutes to convert a file with a one-hour runtime that was encoded in XviD.

Creating the DVD structure

Now you can use dvdauthor to create the layout of the DVD from the MPEG-2 file of your video. Although you can pass any options to dvdauthor directly from the command line, it's easier and more flexible to create an XML file with the appropriate options instead. Open your favorite editor and create a file called dvd.xml with the following contents:

<dvdauthor>
  <vmgm />
    <titleset>
      <titles>
        <pgc>
          <vob file="your_video.mpg" chapters="0,0:10,0:20,0:30,0:40,0:50" />
        </pgc>
      </titles>
    </titleset>
</dvdauthor>

I split my hour-long video into six 10-minute chapters. Adjust the chapters= option for your video, or remove the option from your XML file if you don't want chapters.

Type dvdauthor -o dvd -x dvd.xml to create the layout of the DVD; the -o switch defines the output directory, and -x is used for the XML file. This command takes five to 10 minutes, depending on your video size and your CPU speed. Once it completes, you'll have a directory named dvd with two subdirectories: AUDIO_TS and VIDEO_TS. Before burning the video to a disc, you can check it by running mplayer dvd:// -dvd-device ./dvd.

If the video plays correctly, you can burn it onto a DVD disc with growisofs by running growisofs -dvd-compat -Z /dev/dvdrw -dvd-video ./dvd/. Make sure to replace /dev/dvdrw with the device name of your DVD recorder.

The only thing left is to make some popcorn, get your favorite beverage, and enjoy the show.

Share    Print    Comments   

Comments

on Convert any video file to DVD with open source tools

Note: Comments are owned by the poster. We are not responsible for their content.

Wicked Cool, But...

Posted by: Anonymous Coward on April 27, 2006 10:28 PM
if, for some strange reason, you wanted to use Linux/OSS tools to edit your video file before creating your opus of a DVD, then you would use...

Queue the crickets.

P.S. Kino show promise but, it's alpha at best.

#

Re:Wicked Cool, But...

Posted by: Anonymous Coward on April 27, 2006 10:59 PM
<a href="http://heroinewarrior.com/cinelerra.php3" title="heroinewarrior.com">Cinelerra</a heroinewarrior.com> or <a href="http://lives.sourceforge.net/" title="sourceforge.net">lives</a sourceforge.net> might be what you'd need as well. IIRC there's some gnome/mono-based app on the way as well.

#

Re:Wicked Cool, But...

Posted by: Anonymous Coward on April 27, 2006 11:29 PM
<a href="http://fixounet.free.fr/avidemux/" title="fixounet.free.fr">Avidemux2</a fixounet.free.fr>, but it isn't that complex.

#

Re:Wicked Cool, But...

Posted by: Anonymous Coward on April 27, 2006 11:37 PM
VirtualDub[Mod] via WINE? It's open source, too, so it's only a matter of time before a replaceable mplayer-based library is made for it.

#

Re:Wicked Cool, But...

Posted by: Anonymous Coward on April 30, 2006 06:59 AM
Jahshaka, Cinelerra, MainActor, etc.

Reference: "Software for 3D/2D Artists, Designers, etc." here <a href="http://www.linuxforum.com/forums/index.php?showtopic=53452" title="linuxforum.com">http://www.linuxforum.com/forums/index.php?showto<nobr>p<wbr></nobr> ic=53452</a linuxforum.com>

#

Re:Wicked Cool, But...

Posted by: Anonymous Coward on January 10, 2007 05:23 PM
or you can visit and try <a href="http://www.vhs-to-dvd.com/vhs-to-dvd.html" title="vhs-to-dvd.com">VHS to DVD</a vhs-to-dvd.com> and transfer your home video tapes to dvd. You can get a pretty good conversion at a reasonable price from a lot of places. But what are most of these companies lacking? Care and attention to detail! Other ways you get totally amateurish product done with domestic equipment.
link: <a href="http://www.vhs-to-dvd.com/" title="vhs-to-dvd.com">http://www.vhs-to-dvd.com/</a vhs-to-dvd.com>

#

Re:Wicked Cool, But...

Posted by: Administrator on April 28, 2006 01:30 AM
There's a project being programmed in Mono called <a href="http://www.diva-project.org/" title="diva-project.org">Diva</a diva-project.org>. From the sample videos it looks very promising.

#

Small correction.

Posted by: Anonymous Coward on April 27, 2006 11:23 PM
If grepping for AUDIO_FORMAT gives a mysterious number instead of the codec, grep for AUDIO_CODEC instead.

#

dvdauthor xml file

Posted by: Anonymous Coward on April 28, 2006 12:22 AM
"Open your favorite editor and create a file called dvd.xml with the following contents:"

I don't see any contents below this statement. Is it just me? I am at work and using IE6.

#

Re:dvdauthor xml file

Posted by: Anonymous Coward on April 28, 2006 12:45 AM
Better to use qdvdauthor to master DVD.
<a href="http://qdvdauthor.sourceforge.net/" title="sourceforge.net">http://qdvdauthor.sourceforge.net/</a sourceforge.net>

Works really well

#

Re:dvdauthor xml file

Posted by: Anonymous Coward on April 28, 2006 07:32 AM
It's not just you. I'm reading it at home in Mozilla, and also was weirded out by the fact that no content follows that statement.

Can the author please fix the article?

#

Re:dvdauthor xml file

Posted by: Anonymous Coward on April 28, 2006 03:21 PM
Yep Firefox 1.5 here and I can't see anything either.

#

Re:dvdauthor xml file

Posted by: Administrator on April 28, 2006 09:23 PM
Same here with Firefox 1.5

#

Or you could do it the lazy way...

Posted by: Anonymous Coward on April 28, 2006 02:46 AM
...you could transcode with AVIDemux2, and author/burn the DVD with DVD Styler. If you must burn using a separate program, you can be lazy and use k3b. Dead simple. Not l33t, but then again, this article isn't exactly an 'enterprise Linux resource' either.<nobr> <wbr></nobr>;-D

And yes, you can edit those viral Intarweb videos with AVIDemux2.

If you're making home movies and you're doing NTSC DVDs, I suggest using Kino, which makes it nearly as dead-simple. You can burn with k3b or use growisofs directly.

I keep intending to write up how I pull my home videos down to 480x480 23.976fps with noise filtering using transcode, but I'm far too lazy to do that.

#

Check out this link..

Posted by: Anonymous Coward on April 28, 2006 03:16 AM
<a href="http://forums.gentoo.org/viewtopic.php?t=117709" title="gentoo.org">http://forums.gentoo.org/viewtopic.php?t=117709</a gentoo.org>

An awesome work from Gentoo Forums guys, excellent, too.

Best

Juan

#

Doing it the hard way, it can be easier...

Posted by: Anonymous Coward on April 28, 2006 04:00 AM
Get ToVid <a href="http://tovid.org/" title="tovid.org">http://tovid.org/</a tovid.org> and conversion is as simple as:

Assuming your video is named myvideo.avi and is wide-screen...

tovid -dvd -pal -wide -in myvideo.avi -out mydvd

will get you a 16:9 PAL DVD-compatible file named mydvd.mpg.

You can then get DVDStyler <a href="http://dvdstyler.sourceforge.net/" title="sourceforge.net">http://dvdstyler.sourceforge.net/</a sourceforge.net> and craft menus and branching logic if you are up to something complicated. The result can be a DVD structured directory, an ISO or a direct burn to disc.

#

Re:Doing it the hard way, it can be easier...

Posted by: Anonymous Coward on April 28, 2006 04:59 PM
Or just use tovidgui (from the same site)

Creating a multi-chapter, multi-file from mpg, avi, wmv with a nice front-end menu is just a drag and drop operation.

I've used it several times and always got good results.

#

Re:Doing it the hard way, it can be easier...

Posted by: Anonymous Coward on April 30, 2006 07:08 AM
Agree. After all while it can prove useful to use a command script from a Terminal in certain situations it's not ideal for everyone. Especially since the Linux community is trying to get Windows users to accept "migration" from Windows to Linux as a possibility. It would be easier to accomplish the task of video file conversion and transfer with tools such as those found in the multimedia section here <a href="http://kde-apps.org/" title="kde-apps.org">http://kde-apps.org/</a kde-apps.org>

#

What about a similar yet different situation...

Posted by: Anonymous Coward on April 28, 2006 01:33 PM
What it you had more than one video that you would like to make into one dvd disc with each video being another chapter? Assuming it can be done with multiple files how would you go about it?

Cheers.

#

Re:What about a similar yet different situation...

Posted by: Anonymous Coward on April 30, 2006 05:38 AM
non-gui tools = disaster in a newbie's hands...<nobr> <wbr></nobr>.....

LOL, I have a 13 year old daughter that just copied and pasted the command in, making the appropriate changes and came to show the finished product off to me.

LOL. Email me and I will have her help you if you like.

"Linux...so easy even Windows Users can eventually figure it out."

#

Re:What about a similar yet different situation...

Posted by: Anonymous Coward on May 03, 2006 01:31 AM
I don't think the "newbie" was the target audience for this article. When I read it I thought of it as a "quick recipie" for those who already have a bit of experience with the underlying technologies.

#

Re:What about a similar yet different situation...

Posted by: Anonymous Coward on August 10, 2006 09:10 PM
<a href="http://dvdstyler.sourceforge.net/" title="sourceforge.net">http://dvdstyler.sourceforge.net/</a sourceforge.net>

nuf said.

#

Re:What about a similar yet different situation...

Posted by: Anonymous Coward on September 07, 2006 12:40 PM
use the qdvdauthor to generate the dvdauthor.xml file, then fine tune it. Note you need to remove the aspect option that it puts in there (something like 2.1:2 or something)

#

Did ya ever wonder.....

Posted by: Anonymous Coward on April 28, 2006 10:50 PM
Oh wow, talk about a high ceiling.
What easy commands. I'm sure I'll remember those when I need them.

Please. This is just another reason why many people will never convert to linux, the command structure. While it may be simple for some folks, are you seriously going to remember a 4 line 20 different option command line exactally as the program wants it?

non-gui tools = disaster in a newbie's hands.

#

Re:Did ya ever wonder.....

Posted by: Anonymous Coward on April 29, 2006 04:16 AM
tovid is much slicker than this.

#

Re:Did ya ever wonder.....

Posted by: Anonymous Coward on April 29, 2006 03:56 PM
Exactly - unless he can dumb things down to the point where all us 'point and click' end users can do it, he should just shut up and blow away.

After all, it's not like there are 'power users' any more who are actually comfortable with the technology stuff who get any benefit from this kind of material.

The Internet is the realm of the stupid and ignorant - technically competent people should just get away - it's not like they contributed anything to the world we live in.

#

Re:Did ya ever wonder.....

Posted by: Anonymous Coward on December 17, 2006 07:30 AM
how about book marking pages, copy and pasting and then having the flexibility to understand the command-line & modify it to suit needs, the world is not one-size fits all. But this document is a keeper in the bookmarks - great resource

tuxp3 at leetworks dot com

#

Re:Did ya ever wonder.....

Posted by: Anonymous Coward on September 07, 2006 07:36 PM
If you prefer, you can use encode2mpeg.

And yes, you probably should read some information in the man pages or in the documentation to build a very long command-line...

But I promise :
1) you can create a configuration file, so you only need to reed the documentation once ( or if you got some problem... )
2) You can directly burn the dvd, without using any authoring tool. Just get the source video or videos, some background image for the menu, and that's all you need. You can choose,
use some converting tool ( as tmpgenc ) that is very powerfull, but is not easy at all....,
work with an "friendly graphic interface" for build the DVD , and the DVD after about One hour of manual work.... or learn how to write the command line for encode2mpeg...

3) is OpenSource

I hope I have helped to you.
Best Regards
Luis

#

Re: Did ya ever wonder.....

Posted by: Anonymous [ip: 151.199.60.78] on February 02, 2008 01:38 AM
Ever hear of a shell script moron?

#

lip sync

Posted by: Anonymous Coward on April 28, 2006 11:18 PM
I'm getting lip sync errors using the above conversion commands, any ideas?

#

Re:lip sync

Posted by: Anonymous Coward on May 02, 2006 05:35 AM
My guess is that there's a mismatch in the audio sample rates somewhere along the line. If you create a video that says it has audio sampled at 44 KHz but it's actually sampled at 48 KHz, then the audio would gradually go out of sync, as it would essentially be playing back at the wrong speed. This is the main cause of these types of problems that I've seen in my (admittedly limited) experience with video.

#

Re:lip sync

Posted by: Anonymous Coward on May 02, 2006 08:23 PM
Thanks, its a pity since it much faster than the TMPGEnc method I've been using to do it.

#

Re:lip sync

Posted by: Anonymous Coward on May 09, 2006 05:22 PM
I have one video file with this problem. How can I correct the sampling of the audio in this file? I am still not familiar with all the options...

#

lower back pain

Posted by: Anonymous Coward on May 28, 2006 06:30 PM
<tt>[URL=http://painrelief.fanspace.com/index.htm] Pain relief [/URL]
[URL=http://lowerbackpain.0pi.com/backpain.htm] Back Pain [/URL]
[URL=http://painreliefproduct.guildspace.com] Pain relief [/URL]
[URL=http://painreliefmedic.friendpages.c<nobr>o<wbr></nobr> m] Pain relief [/URL]
[URL=http://nervepainrelief.jeeran.com/pa<nobr>i<wbr></nobr> nrelief.htm] Nerve pain relief [/URL]</tt>

#

Excellent tutorial, thank you

Posted by: Anonymous Coward on May 01, 2006 10:19 PM
Awesome tutorial, I've used mplayer/mencoder as a "power user" for nearly 3 years now, and I still hadn't found a way to encode to MPEG-2, instead having to rely on mjpegtools to do the job. Thank you very much!<nobr> <wbr></nobr>:)

#

Re:Excellent tutorial, thank you

Posted by: Administrator on February 20, 2007 09:10 AM
Same here. I was looking for a way to do this and your tutorial solved my problem. Thank you very much for posting this.

#

Multiple files

Posted by: Anonymous Coward on December 22, 2006 02:19 AM
If you want multiple files, just add more vob tags, like so:

<tt> <tt><dvdauthor>
  <vmgm<nobr> <wbr></nobr>/>
    <titleset>
      <titles>
        <pgc>
          <vob file="vid1.mpg" chapters="0" pause="2"<nobr> <wbr></nobr>/>
          <vob file="vid2.mpg" chapters="0" pause="2"<nobr> <wbr></nobr>/>
          <vob file="vid3.mpg" chapters="0" pause="2"<nobr> <wbr></nobr>/>
        </pgc>
      </titles>
    </titleset>
</dvdauthor></tt></tt>


This will create a disc with three videos, with chapters at the beginning of each, and two seconds delay between each. No menus, though. If you want to split the videos into smaller chapters, you can add more entries in the chapter attribute. Make sure you get the minutes/seconds/hours right! A comment above mentioned that the guide might be wrong about the chapter division.

Oh, and make sure the total size of the videos is less than 4 700 000 bytes. Your file sizes probably show in Gibibytes (1 GiB = 1024³ bytes), DVD's are 4.7 Gigabytes (1 GB = 1000³ bytes).

Wonderful guide! This was much easier and haxx0r-ish than using tovid, which was giving me headache instead of a DVD.<nobr> <wbr></nobr>:)

#

Another Correction

Posted by: Administrator on May 02, 2006 10:16 PM
The line
<tt><vob file="your_video.mpg" chapters="0,0:10,0:20,0:30,0:40,0:50"<nobr> <wbr></nobr>/></tt>
does not create six 10-minute-chapters but five chapters 10 seconds each and one chapter which is 59:10 minutes!
The correct line would be
<tt><vob file="your_video.mpg" chapters="0,10:00,20:00,30:00,40:00,50:00"<nobr> <wbr></nobr>/></tt>
Note: If the first line was right, chapters could only contain full minutes...

Mathis Dirksen-Thedens

#

More tips, including HDTV to DVD

Posted by: Administrator on May 04, 2006 03:29 PM
This article was very helpful and launched me into a related and much needed project: HDTV to DVD.


All of what I learned is documented as a HOWTO in my blog. Partly so I wouldn't forget how I got everything working, haha. Maybe this will be helpful to others.


I used the info here and many hours of research and testing to come up with a satisfactory recipe for archiving HDTV.


The biggest problem I had was audio/lip sync. This is fixed with an excellent tool: ProjectX. ProjectX took me a while to get installed & running and I documented it on my blog. I have spent hours (days?) trying various tools to 'fix' the hdtv mpeg files, and so far only projectx does the corrections automagically. Awesome tool.


PX demuxes & creates two files (from the hdtv/atsc hidef files created by MythTV): One for video, one for audio. This presented a new problem, what tool(s) to use to convert the video file to the DVD standard. After much reading, I settled on avidemux2. The next problem was that I needed to run avidemux2 on my fast P4 server (because encoding takes a lot of cpu), but my fast server is my myth frontend and that has a plasma monitor. The plasma monitor does not support the high resolutions that PC monitors have, and this is important because when you load a HD file in avidemux the window is sometimes so large that you can't see all of the controls/buttons! So, I ran avidemux remotely via X11 over ssh. To get around a weird error with GTK (used by avidemux), I hunted and learned that I needed to run ssh with the "-Y" switch.


Back to video: Following one of the many guides on avidemux, I converted the hdtv mpg video to dvd format. Then I used mplex to mux the dvd format video with the ac3 audio file created by projectx. This<nobr> <wbr></nobr>.mpg file is just like the one described by the article here ("your_video.mpg"). Then I just followed the rest of this article.


I really wanted to use the simpler steps in this article, but was forced to use projectx due to the typical glitches that will be in most atsc/hdtv recordings.


I'm now able to free up disk space on my mythtv backend by archiving (compressing) to DVD. Thanks to this article, I would not have been inspired to climb this mountain. Nice article!


Donn Lee

#

Convert any video file to DVD with open source tools

Posted by: Anonymous [ip: 129.137.166.223] on October 26, 2007 05:54 PM
The mplayer distribution also includes a script wrapper to the -identify option called midentify. This is a much simpler way to get information than directly calling mplayer -identify.

#

Convert any video file to DVD with open source tools

Posted by: Anonymous [ip: 85.73.122.72] on December 05, 2007 11:02 AM
Excellent ..
.. or you can just use DeVeDe and get it over with

#

Convert any video file to DVD with open source tools

Posted by: Anonymous [ip: 212.100.208.147] on January 19, 2008 11:58 AM
Can any help on converting wmv to avi or DVD

#

Convert any video file to DVD with open source tools

Posted by: Anonymous [ip: 124.168.173.211] on January 19, 2008 12:31 PM
This was a fantastic guide, thankyou very much for this! Everything went smoothly thankfully.

#

Convert any video file to DVD with open source tools

Posted by: intel17 on February 28, 2008 04:41 PM
One of the best articles I have ever read!
Thank you all worked amazingly ^_^

Cowboy Bebop Time :D
[Modified by: intel17 on February 28, 2008 04:42 PM]

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya