Help answer threads with 0 replies.
Go Back > Linux Answers > Applications / GUI / Multimedia
User Name


By ptesone at 2005-08-30 14:58
here's 6 basic steps to convert a .AVI to DVD so you can watch your movies on your home player, not just your computer. . .But first we need to figure out if it's a fullscreen movie or letterbox movie. . .Movies normally come in two sizes: 4:3 (fullscreen) or 16:9 (letterbox) which they call aspect ratio. . .They also come in two formats PAL (Non-US) and NTSC (US). . .The following examples are for NTSC Only!

what you need first:
some hardrive space

in this example I will be using a 16:9 movie.avi for our conversion. . .

1.) Split the .avi file into 2 separate files, one for video and one for audio:

transcode -i movie.avi -y ffmpeg --export_prof dvd-ntsc --export_asr 3 -o movie -D0 -s2 -m movie.ac3 -J modfps=clonetype=3 --export_fps 29.97
this will make:
movie.m2v (video)
movie.ac3 (audio)

note: if you're doing a fullscreen (4:3) movie then simply change --export_asr 3 to --export_asr 2

2.) (optional) Extract 5.1 Audio:

tcextract -d2 -i movie.avi -a0 -x ac3 | tcextract -d2 -x ac3 -t raw > movie.ac3
This is an extra step if you know your .avi file actually has 5.1 surround sound. (Step one only produces a stereo .ac3 file !)
How can you tell? Do this first:

mplayer -vo dummy -identify movie.avi 2> /dev/null | grep "5.1 ("
if you get this output then you have 5.1:

AC3: 5.1 (3f+2r+lfe) 48000 Hz 384.0 kbit/s
if you don't, just ignore this step!

3.) Put the video & audio file back together:

mplex -f 8 -o dvd_movie.mpg movie.m2v movie.ac3
this will make dvd_movie.mpg ready for DVD authoring. . .

4.) open your favorite text editor and paste the following:

<dvdauthor dest="DVD">
  <vmgm />
         <vob file="dvd_movie.mpg" chapters="0,15:00,30:00,45:00,1:00:00"/>
save the file as: dvdauthor.xml
in the same directory as your movie files
(you can also change the chapters to fit the times of your movie)

5.) Create a DVD directory where your movie files are and do this:

dvdauthor -x dvdauthor.xml
this will create two AUDIO_TS and VIDEO_TS directories in your DVD directory. . .

6.) Test it & Burn it:

to test it:
xine dvd:/full/path/to/DVD/VIDEO_TS/
to burn it:
growisofs -Z /dev/dvd -dvd-video DVD/
note: I like to use DVD-RW discs for a test before I use a real disc. . .
If all goes well, the above will produce movie with no menus, just the movie that should play when you put in your disc. . .and if there's more than one .avi then simply do this in your dvdauthor.xml file:

<dvdauthor dest="DVD">
  <vmgm />
         <vob file="dvd_movie_part1.mpg" chapters="0,15:00,30:00,45:00,1:00:00"/>
         <vob file="dvd_movie_part2.mpg" chapters="0,15:00,30:00,45:00,1:00:00"/>


by Emmanuel_uk on Thu, 2005-09-15 02:11

Great exposition for a topics many will be interested in, thanks.
Thanks as well to the people who suggested you to post this.
I explain first my experience and then go on to all links and comments I have.

Your tutorial is coming at the time I am trying to put 20s video clips from my camera together onto a dvd. I first tried with my meagre knowledge of transcode and ffmpeg. Eventually managed to get some mpeg movies, but then dvdauthor complained (something to do with headers of file and padding; I had read about the -f 8 option, but somehow this is not enough to get the header right.). Anyhow, I did more searches, found your thread and some others.

Linux is great there is always more than 1 method. Here are some comments:
- Somebody will ask how to do the conversion to PAL (I will try to figure out for myself)
- "avi to vob" is a keyword you might want to add to your tutorial
"avi to mpeg" as well on top of "avi to dvd"
Possibly none of these "keyword" is absolutely correct,. but it will help newbies' searches (containers, codec, format, this a steep learning curve when one starts)
- I would state in the tutorial that this method does not (does?) work with divx (divx are avi files, are they not?)

- ffmpeg with option pal-dvd worked great to convert camera's avi to mpeg, but still I had this file header problem (the file plays with mplayer but dvdauthor cannot find the first vobu).
There must be some solution to convert avi to dvdauthor compliant file with ffmpeg
(not found it yet fully spelt out with google, need to look)

I suggest you add these links at the end of the tutorial A army knife video suit

A batch script AVI to VOB (I have not tried yet)

I have heard of avidemux and did some searches and found (cross-ref with some LQ threads below)
LINUX: AVI to DVD Encoding and Authoring : BASIC (using avidemux)

{edit added QCreateVOB seems to be another solution. Not tried
heard of as well
<<a GUI for generating VCD/SVCD/DVD-compliant MPEG files from an AVI, MPEG, Quicktime or whatever file using transcode and mplex>>

---------- LQ Threads ---------------
A thread about tools

Thread with links

---------- Further readings ---------------
---------- Further readings background ---------------

by Emmanuel_uk on Fri, 2005-09-16 13:58
with MEncoder 1.0pre7-3.4.3 (C) 2000-2005 MPlayer Team
(I could net get it to work with 1.0pre6-3.4.3. maybe the feature was just added)

mpegopts is documented in
and it all does it in one line ! :-) Good guys at mplayers really

This is the example they give for avi to DVD PAL compliant

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,\
harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:\
abitrate=192:aspect=16/9 -ofps 25 \
-o movie.mpg movie.avi

by bglnelissen on Sun, 2005-10-23 08:40
Automated BASH-script for PAL.
(For NTSC change: Look in the code at STEP 1)

Just made this overnight, some things can be made better and ofcourse you may.

have fun.

# made by CousinCocaine (bglnelissen)
# All this info comes from one of my favorite websites:
# more specific:
# thnx ptesone ;)

# STEP 0
# Say hello
# give worning for the dependencies
# setting-up the right directories, variables etc

function echolightgray {
	echo -e "\033[37;0m $1 \033[0m"
function echodarkgray {
	echo -e "\033[30;1m $1 \033[0m"
function echolightblue {
	echo -e "\033[34;1m $1 \033[0m"
function echolightgreen {
	echo -e "\033[32;1m $1 \033[0m"
function echolightcyan {
	echo -e "\033[36;1m $1 \033[0m"
function echolightred {
	echo -e "\033[31;1m $1 \033[0m"
function echolightpurple {
	echo -e "\033[35;1m $1 \033[0m"
function echoyellow {
	echo -e "\033[33;1m $1 \033[0m"
function echowhite {
	echo -e "\033[37;1m $1 \033[0m"
#emptying terminal

echo -e "Hello world!"

echoyellow "Welcome to \"avi-2-DVD\""
echolightcyan "\t Your 6 Steps guide for converting avi-2-DVD"
echolightgreen "Read Me:"
echo -e "Just do everything this program asks you to do and it will work like a charm.
Make sure you have installed these programs before trying to converd avi-2-DVD:
	\t - transcode
	\t - mplex
	\t - dvdauthor
	\t - k3b"
echo ""
echo -e "This program can be quit anytime using \"ctrl-c\".
No wildcards and there (still) are no error correction for misspelled path's or filenames.
Make shure you've got enough free disc-space.
Files are not yet cleaned afterwards.
Settings now used are for PAL format, NTSC settings can be found in the source of this script.
Enough said, lets start your avi-2-DVD project!"
echo ""
echoyellow "What's the name of your new avi-2-DVD project?"
read project
echo ""

echoyellow "In which FOLDER is the \".avi\" file you want to convert?"
echo -e "Type it's path here: 
	\r\t (like: /home/myname/movies)"
read workingdir
cd  "$workingdir"
echo ""

echoyellow "Which of the following movie(s),listed below, do you want me to convert?"
echo -e "Remember, no wildcards and there (still) are no error correction for misspelled path's or filenames."
echo ""
echolightgreen "List all \".avi\" movies in this folder:"
ls | grep .avi
echo ""
read avimovie
echo ""

echo -e "To make shure the process does not conflict with other files ill make a new working directory:"
echolightgreen "\"$workingdir/DVD $project\""
mkdir "DVD $project"
mv "$avimovie" "DVD $project"
cd "DVD $project"
# STEP 1
# Split the .avi file into 2 separate files, one for video and one for audio
# (This AINT 5.1, see website for details)
echo ""
echolightcyan "\t Step 1"
echoyellow "Split the .avi file into 2 separate files, one for video and one for audio:
\t - 1 video file, '.m2v'
\t - 1 audio file, '.ac3'"
sleep 2
transcode -i "$avimovie" -y ffmpeg --export_prof dvd-pal --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 25 
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-pal --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 25 
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-ntsc --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 29.97

# Moving back videofile
echolightgreen "Restoring original videofile: $avimovie"
mv $avimovie ../

# STEP 2
# Put the video & audio file back together
# This will make dvd_movie.mpg ready for DVD authoring. . .
echo ""
echolightcyan "\t Step 2"
echoyellow "Put the video & audio file back together (MPEG)"
sleep 2
mplex -f 8 -o dvd_movie.mpg "$avimovie".m2v "$avimovie".ac3

# STEP 3
# open your favorite text editor and paste the following
# save the file as: dvdauthor.xml
# in the same directory as your movie files '
echo ""
echolightcyan "\t Step 3"
echoyellow "Now i am gonna create a \"dvdauthor.xml\" file.
The 'dvdauthor' program uses this file to create the right DVD structure"
sleep 2
echo -e "<dvdauthor dest=\"DVD\">  
	  <vmgm /> 
	         <vob file=\"dvd_movie.mpg\" chapters=\"0,15:00,30:00,45:00,1:00:00\"/> 
	 </dvdauthor>" > "dvdauthor.xml"

# STEP 4
# using the dvdauthor.xml file to create a DVD from the dvd_movie.mpg file
echo ""
echolightcyan "\t Step 4"
echoyellow "Starting up dvdauthor and using your \"dvdauthor.xml\" file..."
sleep 2
dvdauthor -x dvdauthor.xml

# STEP 5
# starting-up k3b for burning the whole project
echo ""
echolightcyan "\t Step 5"
echoyellow "Starting k3b with additional options for buring your dvd"
echoyellow "Click 'Burn' and again, click 'Burn' to start burning your disc"
cd "$workingdir/DVD $project/DVD"
sleep 4
k3b --videodvd ./*

# STEP 6
echo ""
echolightcyan "\t Step 6"
echoyellow "Everything is done. Enjoy your DVD"
echoyellow "Your DVD image files and you project files still excist in: \"$workingdir/DVD $project\""
echo -e "Thnx ptesone & CousinCocaine for making this possible"
echo -e "Bye"

by vtecturbo13 on Mon, 2005-10-24 05:33
how would u change this to ntfs, comment out the pal lines ? and uncomment the ntfs ones?

by Emmanuel_uk on Mon, 2005-10-24 05:40
ntfs has nothing to do with ntsc :-)

othwerise yes to your question.
Just experiment for yourself you will learn, I am sure

by bglnelissen on Mon, 2005-10-24 05:41
original is this:
transcode -i "$avimovie" -y ffmpeg --export_prof dvd-pal --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 25 
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-pal --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 25 
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-ntsc --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 29.97
change it into this for NTSC:
transcode -i "$avimovie" -y ffmpeg --export_prof dvd-ntsc --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 29.97
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-pal --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 25 
#transcode -i "$avimovie" -y ffmpeg --export_prof dvd-ntsc --export_asr 2 -o "$avimovie" -D0 -b224 -N 0x2000 -s2 -m "$avimovie".ac3 -J modfps=clonetype=3 --export_fps 29.97
i keep them both commented out just for backup, so you can always change it back.

good luck.

if it does not work, just say it.


by vtecturbo13 on Mon, 2005-10-24 05:51
wow did i really type in ntfs , man i need to goto sleep

by mucktuck on Sun, 2005-12-04 16:59
how on earth would you do multiple files at once? I attempted and it only did the first file I entered in. I am supposed to put comma's inbetween each name? or does this not support multiple files? or am I just inept at shell script(very likely).

by Tinkster on Tue, 2006-01-31 15:08
Quick question regarding step 4)

What exactly does one paste? :}


by bglnelissen on Wed, 2006-02-01 03:49
whow, this is some while ago, let me take a look. I suppose that you dont need to copy anything.

the actual code is:
dvdauthor -x dvdauthor.xml

this means:
the program: dvdauthor
does option: -x
to the file: dvdauthor.xml

and i suppose that the file dvdauthor.xml is already made earlier in the script.

Good Luck.


All times are GMT -5. The time now is 08:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration