Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE

This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Linux How To: Covert any video to DVD using command line

A collection of useful tutorials for some common tasks.

Linux How To: Covert any video to DVD using command line

Postby vmiimu » Sat Jan 18, 2014 6:53 am

Below steps worked for me on Debian Wheezy to convert almost any movie into a decent (not stretchy looking) burnable DVD ISO
The speed of this process was the most appealing factor and made the initial effort worthwhile.
This info wasn't readily available when I went looking so I'll share my findings to help anyone else in the future:

Summary : Process Overview
[Some vid format] --> ffmpeg --> [dvd compatible .mpg] --> dvdauthor --> [dvd structured folder] --> genisoimage --> [burnable .iso file] --> growisofs --> [burnt dvd]

STEP 1 : ffmpeg
The goal is to use ffmpeg to convert almost any common vid format to a dvd compatible mpg
The prepackaged version on Debian (apt-get via. deb-multimedia.org) was too ancient to work for me and apparently it's also been forked:
Who can tell me the difference and relation between ffmpeg, libav, and avconv?

It's important to first make sure you have the latest static build of the ffmpeg binary.

After downloading, simply extract and copy the binary files (ffmpeg, ffprobe) to/usr/bin (so they'll be in your path when you run them later)

Using ffmpeg with defaults was producing inconsistent looking output with different input files, resulting in some output files coming out "stretchy"
Code: Select all
ffmpeg -i input.m4v -target ntsc-dvd output.mpg

Specifying settings for each input file was too tedious and I was looking for a "magic" setting to always make it look good for DVD.
I didn't find anything readily available for this purpose but eventually <jnvsor> in #ffmpeg (irc) passed on the following cheat code using a filter with custom settings which always seems to get it right:
Just use the following command with the appropriate filenames substituted for infile (the original input file) and out.mpg (to your output filename .mpg)
Code: Select all
ffmpeg -i infile -filter:v "scale='if(gt(a,720/480),720,-1)':'if(gt(a,720/480),-1,480)',pad=w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2" -target ntsc-dvd out.mpg

STEP 2 : dvdauthor
dvdauthor -- assembles multiple mpeg program streams into a suitable DVD filesystem

More details on man page
Latest download here.
After compile/installation I had to manually set a environment variable by adding the following to /etc/environment
Code: Select all
# Custom variable for dvdauthor

Consult the man page and adjust above according to your region / needs

With dvdauthor setup, run the following to create the DVD structure folder from the mpg we created earlier.
Substitute "folder_name" for the name of the new dvd folder and out.mpg for the name of the .mpg file we created earlier in step 1
Code: Select all
dvdauthor --title -o folder_name -f out.mpg

Then finish by setting the table of contents with:
Code: Select all
dvdauthor -T -o folder_name

STEP 3 : genisoimage
Create our final DVD ISO using the DVD structure folder created in the previous step.
Substitute movie.iso for the new iso file's name and folder_name to be the same as the previous step.
Code: Select all
genisoimage -dvd-video -o movie.iso folder_name

You should now have a DVD ISO file and you can delete the previously created .mpg file and dvd structure folder if you like.

STEP 4 : growisofs
In case you're wondering how to burn the ISO to a blank DVD
Make sure you have growisofs installed.
I used the below on Debian Wheezy
Code: Select all
apt-get install dvd+rw-tools

Finally, insert a blank dvd and run the following.
Code: Select all
growisofs -dvd-compat -Z /dev/dvd=movie.iso

Future updates:
  • Include instructions for subtitles
  • At some point I'll stick it all into a bash script so it can all just be a single command; if I do I'll post an update here unless someone else can beat me to it.

Also, here's a link to all the references I used to compile my instructions above: http://faturl.com/dvdlinux/
Last edited by vmiimu on Sun Feb 02, 2014 8:11 pm, edited 5 times in total.
Posts: 1
Joined: Sat Jan 18, 2014 5:21 am

Re: Linux How To: Any video to DVD using command line

Postby llogan » Sun Jan 19, 2014 12:02 am

Thanks. I fixed some of your links.
Posts: 2337
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska

Re: Linux How To: Covert any video to DVD using command line

Postby ks_kalvan » Mon Aug 18, 2014 8:19 am

I think you ignored PixelAspectRatio, you will get wrong DisplayAspectRatio.

DAR = Width / Height * PAR

DAR: Display Aspect Ratio
PAR: Pixel (or Sample) Aspect Ratio

DVD-Video Specifications:
720x480, DAR ~20:11 (PAR ~40:33) - Full D1 NTSC 16:9
720x480, DAR ~45:33 (PAR ~10:11) - Full D1 NTSC 4:3
704x480, DAR 16:9 (PAR 40:33) - D1 NTSC 16:9
704x480, DAR 4:3 (PAR 10:11) - D1 NTSC 4:3

For example:

Full D1 NTSC 16:9
Width: 720
Height: 480
Pixel Aspect Ratio: 40:33

ScaleWidth = Min(CustomWidth, CustomHeight / CustomPAR * InDAR) = Min(720, 480 / (40 / 33) * InDAR)

ScaleHeight = Min(CustomHeight, CustomWidth * CustomPAR / InDAR) = Min(480, 720 * (40 / 33) * InDAR)

PadWidth = CustomWidth = 720

PadHeight = CustomHeight = 480

Code: Select all
-filter:v "scale='w=min(720,trunc((480*33/40*dar)/2+0.5)*2):h=min(480,trunc((720*40/33/dar)/2+0.5)*2)',pad='w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2',setsar='r=40/33'"
Posts: 1
Joined: Mon Aug 18, 2014 8:07 am

Re: Linux How To: Covert any video to DVD using command line

Postby derobert » Mon Dec 22, 2014 10:38 pm

When you run that math with, for example, a display aspect ratio of 16/9, you get (before the min) 704×490. I think that's because you actually want to use 704 (the usable image area) instead of 720 (total encode width) in the h= calculation.
Posts: 1
Joined: Mon Dec 22, 2014 10:34 pm

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest