encoding video for dvd burning

Larry Grover lgrover at zoominternet.net
Tue May 17 03:19:07 UTC 2005


Michael Beattie wrote:
>>For mencoder, something like this should work:
>>
>>mencoder MOVIE.avi -oac lavc -ovc lavc -lavcopts \
>>vcodec=mpeg2video:acodec=mp2 -of mpeg -o MOVIE.mpg
>>
>>This assumes you don't need to do anything fancy, like change aspect
>>ratio, frame rate, etc
>>
>>Good luck!
>>
> 
> 
> Thanks for this.  It made an mpeg.  But dvdauthor still doesnt like
> it.  It complains like...
> 
> WARN: Skipping sector, waiting for first VOBU..   (This one a bunch of times).
> ERR:  SCR moves backwards, remultiplex input.

Ugh.  It seems that dvdauthor is quite picky about mpeg files.  From 
the dvdauthor home page (http://dvdauthor.sourceforge.net/):

"Mjpeg Tools has the best multiplexer around. Others will often throw 
warnings with dvdauthor."

> mplex wont take the file as input and I am unsure of how else to
> "remultiplex" it.  Any ideas?
> 

Yes, see below. I've tried this with several different videos, and it 
seems to work.

You'll need the following packages:  mplayer, mjpegtools, ffmpeg.

(1) Convert your file to mpeg2 video in DVD format:

mplayer -ao null -noframedrop -vo yuv4mpeg AVI.avi

(2) Step one will create a file called "stream.yuv" in the current 
directory, the next command will convert it to an mpeg2 video (all one 
command, watch out for line wrapping):

cat stream.yuv | yuvfps -r 30000:1001 | yuvscaler -n n -O DVD | 
mpeg2enc -n n -f 8 -F 4 -o out.m2v

Alternatively, if your original file has correct fps (29.970 for NTSC) 
and the scaling is OK (720x480 for NTSC), you can simplify this to:

cat stream.yuv | mpeg2enc -n n -f 8 -F 4 -o out.m2v

(3) Next you need to get the audio from your original video file:

mplayer -ao pcm -vo null -vc dummy AVI.avi

(4) The result will be a new file called "audiodump.wav", the next 
command will convert it to MP2 format:

ffmpeg -ab 224 -ac 2 -ar 48000 -i audiodump.wav audiodump.mp2

NOTE:  you should be able to substitute "mp3enc" for "ffmpeg", but I 
haven't tested it, so I can't verify that it works; mp3enc is part of 
the mjpegtools package, and would allow you to avoid installing an 
extra package (the ffmpeg package).

(5) Finally, multiplex the new video and audio files:

mplex -f 8 -o ready-to-master.mpg out.m2v audiodump.mp2

(6) I don't know the dvdauthor program very well at all, but the 
following should allow you to make a dvd which will start up 
automatically and play the mpeg2 video you just made, with no menus or 
other fancy stuff.

Create a file called "dvdauthor.xml", containing:

<dvdauthor>
     <vmgm />
     <titleset>
         <titles>
             <pgc>
                 <vob file="ready-to-master.mpg"/>
             </pgc>
         </titles>
     </titleset>
</dvdauthor>

(7) Use dvdauthor to create the DVD filesystem:

dvdauthor -o output_dir/ -x dvdauthor.xml

(8) Use mkisofs to make an image, then burn with growisofs (useful for 
checking that the image is correct, and finding any errors before you 
burn a coaster):

mkisofs -dvd-video -o image.iso output_dir
growisofs -dvd-compat -Z /dev/dvd=image.iso


...or else use growisofs to master and burn in one step:

growisofs -Z /dev/dvd -dvd-video /target-dir-for-dvd-filesystem-image


That's a lot of work, but should be more reliable that just using 
mencoder, as I originally suggested (apologies in advance for any 
typos/errors above).

You should be able to do basically the same thing with transcode (and 
probably other tools as well).

Regards,
Larry




More information about the ubuntu-users mailing list