Video Convertor Nautilus Script 

http://ubuntuforums.org/showthread.php?t=193754&page=3

Here are few of my command line options for *DVD*s:

Mencoder 

mencoder -ofps 24000/1001 -mc 1 -ovc lavc -oac lavc \
-lavcopts acodec=ac3:abitrate=160:vcodec=mpeg2video:lmin=1:l max=10:\
keyint=15:trell:vmax_b_frames=2:mbd=2:precmp=2:sub cmp=2:cmp=2:dia=-10:\
predia=-10:cbp:mv0:dc=10:vstrict=-1:vrc_buf_size=1835:vbitrate=6000:\
vrc_maxrate=9800:vqscale=4 -af volume=+0dB,volnorm=2,lavcresample=48000 \
-srate 48000 -channels 2 -sws 9 -vf denoise3d=1.33:1:2,pp=hb/vb/dr/al/lb,\
scale=716:476,expand=720:480,scale=720:480,harddup -of mpeg -mpegopts \
format=dvd:vaspect=16/9:telecine:init_vpts=400:init_apts=400 \
-mc 1 -o output_file.mpg input_file.avi

Explanation:

This is NTSC encoded file with 3:2 pulldown. Means that file is encoded at 23.976 fps (24000/1001), while dvd player is tricked to think it is 29.97 (that's what 'telecine' option does in mpegopts). This way we have much smaller file with same quality. For PAL encodings use '-ofps 25' and exclude 'telecine' in mpegopts.

In lavcopts we have some settings set to achieve very high quality encodings. You can change abitrate to ie 224 if you want higher quality sound. Option vqscale sets constant quantizer (4 in this case), lower the quant, better the quality, but also bigger file. Quantizer 1 is not recomended (compatibility issues). If you want fixed size file, you should use 2-pass encoding.

Video filters ('-vf' option) sets some filters. Include 'al' (autolevels) only if your video source has washed-up look. 'scale' settings are set to give 2px border around video (giving smaller size encoding, those 2 pixels are not visible on most tvs).

Note that those settings are tweaked for widescreen material, you should change few things (like autoaspect option in lavcopts), but I did not bother to check. Also '-of mpeg' is still in experimental stage, so output file might need to be remultiplexed (this issue might be solved in mencoder pre8 that's been released recently). Read man for more info.

Transcode 

transcode --print_status 5 --export_fps 23.976,1 -J hqdn3d=4:3:6:4:pre,pp=hb:vb:dr:al,normalize,text=string="My Cool Video":fade=2:range=150-350:font=/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf:pos=500x50:points=10 --video_max_bitrate 7500 -V -j0,-2 --export_prof dvd-ntsc --export_asr 3 -y mpeg2enc,ffmpeg -F 8,"-K kvcd" -N 0x2000 -R 3 -w 7,12,90 --pulldown -E 48000 -D 0 -b 160 -i input_file.avi -o output_file -m output_file.ac3

Recently I've discovered that transcode with mpeg2enc gives even better results than mencoder, only it can be very slow sometimes. Source is also ntsc pulled down to 29.97. Some cool options are in '-J'. First - filters used are mplayer ones, same as mecoder; do not use 'al' unless for washed-up videos. 'normalize' will normalize your sound. 'text' is the easiest way to add text to your video (range is frame start/end).

  • '—export_asr 3' is for widescreen.
  • '-y' tells transcode to use mpeg2enc module for video and ffmpeg for audio. You can use ffmpeg for video to get some speed, but will lose some quality.
  • -F is for passing options to mpeg2enc module.
  • '8' is for dvd format
  • "-K kvcd" is for matrix (very powerfull feature; kvcd is matrix used for tweaking mpeg to produce smaller files - around 15%; other options are tmpgenc|default|hi-res - check man mpeg2enc).
  • '-N 0x2000' is for ac3 output.
  • '-R 3' in combination with '-w' gives constant quantizer (7 in this case, mpeg2enc related, corresponds to mencoder's q4).
  • '12' is keyframe setting and '90' is crispness/smoothness factor.

Again change '-b' option to 224 if you want higher quality sound.

Once encoding is finished, you need to multiplex video/audio files:

mplex -S 4700 -f 8 -M -V -o output_file.mpg video.m2v audio.ac3

Transcode will ensure that you have very compliant dvd video with superb quality.

Last edited by encho : July 5th, 2006