[MEncoder-users] DVD >> MKV with mencoder script.

Federico 'Pain' Pistono fppain at gmail.com
Thu Jun 2 19:05:16 CEST 2005


Ok, I've got some good points and some problems.

Good points: 
(1) Video is great, at 1100 is almost DVD quality.

Bad points:

(1) Audio is not synchronized. 

Creating an mkv file with

mkvmerge -o $TITLE.mkv -A output.avi audio.ogg

makes the audio to daly a bit, even in a few seconds.

If I make an OGM, the dealy is terrible playing with mplayer, but it's 
perfect with xine. (??????)

(2) What's the easiest way to grab the crop and inset into the script 
without making the person do the job before running the script?

Here's the modified code, a sample for only one chapter.:

#!/bin/bash
Usage()
{
echo "
`basename $0` (c) 2004 Federico 'Pain' Pistono

usage: `basename $0` [dvd-device] [dvd title] [bitrate] [crop] [outputfile]
- dvd-device = your dvd-device. Either a on-the-fly copy (/dev/dvd)
or a local directory, created before with vobcopy
- dvd title = the title of the dvd using mencoder (e.g mencoder dvd://1, 
also multiple titles, like 2-6 = from 2 to 6)
- bitrate = the bitrate to use for the ffmpeg compression (DivX, Xvid) 
(best > 900, 1100 is fair enough.)
- crop = That if you wish to crop the black bars. To see the exact ratio use
this command:

[bash]$: mplayer dvd://1 -vf cropdetect

- output file = name of the output file (e.g. Matrix)

Exmaples files:

[bash]$: fppdvdmkv /dev/dvd 1 1100 720:352:0:62 Matrix
[bash]$: fppdvdmkv ~/dvd/Matrix/ 1 1100 720:352:0:62 Matrix

They will produce a file called Matrix.mkv
"
exit 1
}

if [ $# -ne 5 ]; then
Usage
fi


####################################
# Parameter variables for encoding #
####################################
DEVICE=$1
TITLE=$2
BITRATE=$3
CROP=$4
NAME=$5


#####################################
# Variable for the encoding quality #
#####################################
opt=vcodec=mpeg4:psnr:mv0:cbp:trell:mbd=2:keyint=125:naq:v4mv:vlelim=-4:vcelim=7:lumi_mask=
0.05:dark_mask=0.01:tcplx_mask=0.01:scplx_mask=0.01:vratetol=32000:vbitrate=$BITRATE
#opt=vcodec=mpeg4:vbitrate=$3:vqmin=1:lmin=1:v4mv:mbd=2:trell:subcmp=2:cmp=2:precmp=2:mv0:autoaspect:vpass=1:mpeg_quant:psnr:vqcomp=
0.7:vqblur=0.3
#opt="vbitrate=$3:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=
0.07:dark_mask=0.2:scplx_mask=0.1:tcplx_mask=0.1:naq"
#opt="vbitrate=$3"

#################################
# Example with a temporary FIFO #
#################################
mknod fifotemp p&&
oggenc -Q -q 3 -o audio.ogg fifotemp& 
mplayer dvd://$TITLE -chapter 3-3 -aid 128 -vc dummy -vo null -hardframedrop 
-ao pcm:file=fifotemp&&
rm fifotemp&&

############################
# Faster, but needs space. #
############################
#mplayer -dvd-device $1 dvd://$2 -aid 128 -vc null -vo null -hardframedrop 
-ao pcm:file=audio.wav&&
#oggenc -q 3 -o audio.ogg audio.wav&&

mencoder -dvd-device $DEVICE dvd://$TITLE -chapter 3-3 -aid 128 -vf 
crop=$CROP -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:$opt -oac copy -o 
/dev/null&&
mencoder -dvd-device $DEVICE dvd://$TITLE -chapter 3-3 -aid 128 -vf 
crop=$CROP -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:$opt -oac copy -o 
output.avi&&
mkvmerge -o $TITLE.mkv -A output.avi audio.ogg


Federico


-- 
Federico 'Pain' Pistono - Scream for me....
Department of Computer Science - Verona, Italy
My website ::::::::::::::::
www.federicopistono.org<http://www.federicopistono.org>
My personal website :: http://pain.altervista.org
Ex-College Website :::: http://pain.altervista.org/flatnukeuwcad

Linux Registered User #340392
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/mencoder-users/attachments/20050602/a2460375/attachment.htm>


More information about the MEncoder-users mailing list