Gentoo Wiki ArchivesGentoo Wiki

MEncoder/DivX_to_DVD

Contents

Intro

This is meant as a supplement to HOWTO Create a DVD, which gives a simple example for transcoding from one video format to a dvd compatible format using mplayer's mencoder. This page serves to repeat that example and give other more complete examples.

QuickStart

Bitrate value 9800 for video stream, set in the parameter vrc_maxrate below is wrong, because it is maximum value for whole mpeg stream. 9800 bits/sec is maximum speed of DVD x1 players, so It should be vrc_maxrate set to 9000.

mencoder -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001\
-ovc lavc -oac lavc -lavcopts \
   vcodec=mpeg2video:\
   vrc_buf_size=1835:\
   keyint=18:\
   vrc_maxrate=9800:\
   vbitrate=4900:\
   aspect=16/9:\
   acodec=ac3:abitrate=192 \
~/Videos/path/to/file-divx.avi -o ~/Videos/path/to/file-divx.mpeg2
mencoder -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001\
-ovc lavc -oac lavc -lavcopts \
   vcodec=mpeg2video:\
   vrc_buf_size=1835:\
   keyint=18:\
   vrc_maxrate=9800:\
   vbitrate=4900:\
   aspect=4/3:\
   acodec=ac3:abitrate=192 \
~/Videos/path/to/file-divx.avi -o ~/Videos/path/to/file-divx.mpeg2
mencoder -of mpeg -mpegopts format=dvd -srate 48000 -ofps 25 \
-ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:\
   vrc_buf_size=1835:\
   keyint=15:\
   vrc_maxrate=9800:\
   vbitrate=4900:\
   aspect=16/9:\
   acodec=ac3:abitrate=192 \
~/Videos/path/to/file-divx.avi -o ~/Videos/path/to/file-divx.mpeg2
mencoder -of mpeg -mpegopts format=dvd -srate 48000 -ofps 25 \
-ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:\
   vrc_buf_size=1835:\
   keyint=15:\
   vrc_maxrate=9800:\
   vbitrate=4900:\
   aspect=4/3:\
   acodec=ac3:abitrate=192 \
~/Videos/path/to/file-divx.avi -o ~/Videos/path/to/file-divx.mpeg2


Using MEncoder

Note #1: you need to compile mplayer with the encode USE flag enabled.

Note #2: for more details, see here.

mencoder -of mpeg -mpegopts format=dvd -srate 48000 -ofps <fps> -ovc lavc -oac lavc -lavcopts \
vcodec=mpeg2video:vrc_buf_size=1835:keyint=<gop>:vrc_maxrate=9800:vbitrate=<vbitrate>:aspect=<ar>:\
acodec=ac3:abitrate=192 \
-vf crop=<crop>,scale=<scale>,expand=<expand> \
<inputfile> -o <outputfile>

MEncoder general options:

libavcodec options:

video filters options:

input and output files:

Determine the crop value

In order to determine the <crop> value, you can use the following command:

Code: $ mplayer -vf cropdetect <inputfile>
...
crop area: X: 4..715  Y: 56..419  (-vf crop=704:352:8:62)%  0.8% 0 0 49%
...

In this case, the <crop> value is: 704:352:8:62.

The following command is for verifying its correctness:

$ mplayer -vf rectangle=<crop> <inputfile>

Determine the scale value

To determine the <scale> value, you need to know:

The general formulae for the <scale> value is:

xscale = xres
yscale = (yres*ar*ycrop)/xcrop

Example (PAL DVD, 4/3):

So your <scale> value is: 720:(576*(4/3)*352)/704 = 720:384

VOBU/NAV

While the method above would give you a stream that would play on your DVD player, you may not be able to seek/search, because the output will not have NAV packets. You can add them by splitting the video from the audio and running them through mplex, from mjpegtools.

(Are these NAV packets real? Perhaps the problem is a lack of chapter points in the dvdauthor xml file?) I find that demux with 'ProjectX -demux' and mux with 'mplex -f 8' does however help with A/V sync.

See Also

Retrieved from "http://www.gentoo-wiki.info/MEncoder/DivX_to_DVD"

Last modified: Fri, 29 Aug 2008 14:52:00 +1000 Hits: 29,067

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.