Add XVid support,

Add vcodec, stereo and asrate options,
Implement vpass option,
Implement only and skip in apass option,
Add an example in dvd2divx script header.
This commit is contained in:
agibert 2005-06-13 07:44:42 +00:00
parent 979b380f63
commit d8bbe0f655
4 changed files with 148 additions and 78 deletions

View File

@ -1,13 +1,25 @@
# $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.2 $
# $Revision: 1.3 $
# $Name: $
# $Date: 2004/06/23 14:28:09 $
# $Date: 2005/06/13 07:44:42 $
# $Author: agibert $
--------------------------------------------------------------------------------
dvd2divx V 2.0.0-1 - A. Gibert - 2005/06/13
--------------------------------------------------------------------------------
Add XVid support,
Add vcodec, stereo and asrate options,
Implement vpass option,
Implement only and skip in apass option,
Add an example in dvd2divx script header.
--------------------------------------------------------------------------------
dvd2divx V 1.1.0-1 - A. Gibert - 2004/06/23
--------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/bin/bash
# dvd_device divx_root divx_title dvd_title chapter angle alang slang vbr abr xsize aspect buffer stereo apass vpass deint
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
dvd2divx - barry_lyndon 1 1 1-24 1 fr - - - - - o - - - -
dvd2divx - barry_lyndon 2 1 25- 1 fr - - - - - o - - - -
dvd2divx - barry_lyndon 1 - - - - - 920 128 480 4/3 n y 1 2 n
dvd2divx - barry_lyndon 2 - - - - - 920 128 480 4/3 n y 1 2 n
# dvd_device divx_root divx_title dvd_title chapter angle alang slang vcodec vbr abr xsize aspect stereo asrate deint buffer apass vpass
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
dvd2divx - barry_lyndon 1 1 1-24 1 fr - - - - - - - - - o - -
dvd2divx - barry_lyndon 2 1 25- 1 fr - - - - - - - - - o - -
dvd2divx - barry_lyndon 1 - - - - - lavc 920 128 480 4/3 y - n s y 2
dvd2divx - barry_lyndon 2 - - - - - lavc 920 128 480 4/3 y - n s y 2

View File

@ -1,34 +1,34 @@
#!/bin/bash
# dvd_device divx_root divx_title dvd_title chapter angle alang slang vbr abr xsize aspect buffer stereo apass vpass deint
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#dvd2divx /dev/cdrom1 cobra 1 10 1- 1 fr - - - - - o - - - -
#dvd2divx /dev/cdrom1 cobra 2 11 1- 1 fr - - - - - o - - - -
#dvd2divx /dev/cdrom1 cobra 3 12 1- 1 fr - - - - - o - - - -
#dvd2divx /dev/cdrom1 cobra 4 13 1- 1 fr - - - - - o - - - -
#dvd2divx /dev/cdrom1 cobra 5 14 1- 1 fr - - - - - o - - - -
#dvd2divx /dev/cdrom1 cobra 6 15 1- 1 fr - - - - - o - - - -
# dvd_device divx_root divx_title dvd_title chapter angle alang slang vcodec vbr abr xsize aspect stereo asrate deint buffer apass vpass
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#dvd2divx /dev/cdrom1 cobra 1 10 1- 1 fr - - - - - - - - - o - -
#dvd2divx /dev/cdrom1 cobra 2 11 1- 1 fr - - - - - - - - - o - -
#dvd2divx /dev/cdrom1 cobra 3 12 1- 1 fr - - - - - - - - - o - -
#dvd2divx /dev/cdrom1 cobra 4 13 1- 1 fr - - - - - - - - - o - -
#dvd2divx /dev/cdrom1 cobra 5 14 1- 1 fr - - - - - - - - - o - -
#dvd2divx /dev/cdrom1 cobra 6 15 1- 1 fr - - - - - - - - - o - -
#dvd2divx - cobra 1 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 2 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 3 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 4 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 5 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 6 - - - - - 1000 128 480 4/3 n n 1 2 y
#dvd2divx - cobra 1 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx - cobra 2 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx - cobra 3 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx - cobra 4 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx - cobra 5 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx - cobra 6 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 13 10 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 14 11 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 15 12 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 16 13 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 17 14 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 18 15 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 13 10 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 14 11 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 15 12 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 16 13 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 17 14 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 18 15 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 19 10 1- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 20 10 3- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 21 10 5- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 22 10 7- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 23 10 9- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 24 10 11- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 31 10 13- 1 fr - 1000 128 480 4/3 d n 0 2 y
#dvd2divx /dev/cdrom1 cobra 19 10 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 20 10 3- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 21 10 5- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 22 10 7- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 23 10 9- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 24 10 11- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
#dvd2divx /dev/cdrom1 cobra 31 10 13- 1 fr - xvid 1000 128 480 4/3 n - y s y 2
dvd2divx - cobra pre2 11 1 1 fr - 1000 128 480 4/3 d n 0 2 y
dvd2divx - cobra post2 11 2- 1 fr - 1000 128 480 4/3 d n 0 2 y
dvd2divx - cobra pre2 11 1 1 fr - xvid 1000 128 480 4/3 n - y s y 2
dvd2divx - cobra post2 11 2- 1 fr - xvid 1000 128 480 4/3 n - y s y 2

136
dvd2divx
View File

@ -2,12 +2,12 @@
#-----------------------------------------------------------------------------------------------------------------------------------
# DVD2DivX
#
# (C) 2004 Arnaud G. Gibert
# (C) 2004-2005 Arnaud G. Gibert
#-----------------------------------------------------------------------------------------------------------------------------------
# $RCSfile: dvd2divx,v $
# $Revision: 1.2 $
# $Revision: 1.3 $
# $Name: $
# $Date: 2004/06/23 14:28:09 $
# $Date: 2005/06/13 07:44:42 $
# $Author: agibert $
#-----------------------------------------------------------------------------------------------------------------------------------
@ -29,6 +29,19 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#-----------------------------------------------------------------------------------------------------------------------------------
# Usage exemple
#-----------------------------------------------------------------------------------------------------------------------------------
# #!/bin/bash
# # dvd_device divx_root divx_title dvd_title chapter angle alang slang vcodec vbr abr xsize aspect stereo asrate deint buffer apass vpass
# #--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#
# # Read only
# dvd2divx /dev/cdrom1 cobra 1 10 1- 1 fr - - - - - - - - - o - -
#
# # Don't read, compress only
# dvd2divx - cobra 1 - - - - - xvid 1000 128 480 4/3 n - y s y 2
#
#-----------------------------------------------------------------------------------------------------------------------------------
dvd_device=$1 # -|/dev/dvd|...
@ -39,15 +52,17 @@ chapter=$5
angle=$6
alang=$7 # en|fr|...
slang=$8 # -|en|fr|...
vbr=$9
abr=${10}
xsize=${11}
aspect=${12} # 4/3|16/9|...
bufferize=${13} # o|y|n|d (only|yes|no|direct)
vcodec=$9 # -|lavc|xvid
vbr=${10}
abr=${11}
xsize=${12} #
aspect=${13} # -|4/3|16/9|...
stereo=${14} # y|n
apass=${15} # 0|1
vpass=${16} # 1|2
deint=${17} # y|n
asrate=${15} # -|xxx (resample audio)
deint=${16} # y|n
bufferize=${17} # o|y|n|s (only: bufferize and stop | yes: bufferize an continue | no: read directly from disk | skip: bufferize previously done)
apass=${18} # o|y|n|s (only: compress and stop | yes: compress and continue | no: compress mp3 whith video | skip: mp3 previously compressed)
vpass=${19} # 1|2
@ -57,10 +72,9 @@ divx_name=$divx_root-$divx_title.avi
tmp_name=$divx_root-$divx_title.vob
out_name=$divx_root-$divx_title
echo "device: [$dvd_device] DivX: [$divx_name] title: ($title) chapter: ($chapter) angle: ($angle)"
echo "alang: ($alang) slang: ($slang) vbr: ($vbr) abr: ($abr) xsize: ($xsize) aspect: ($aspect)"
echo "bufferize: ($bufferize) stereo: ($stereo) apass: ($apass) vpass: ($vpass) deint: ($deint)"
echo "device: [$dvd_device] DivX: [$divx_name] title: ($title) chapter: ($chapter) angle: ($angle) alang: ($alang) slang: ($slang)"
echo "vcodec: [$vcodec] vbr: ($vbr) abr: ($abr) xsize: ($xsize) aspect: ($aspect) stereo: ($stereo) asrate: ($asrate) deint: ($deint)"
echo "bufferize: ($bufferize) apass: ($apass) vpass: ($vpass)"
if [ "$dvd_device" != "-" ]
@ -82,6 +96,13 @@ else
stereo_mode=3
fi
if [ "$asrate" == "-" ]
then
aresample=""
else
aresample="-srate $asrate -af lavcresample=$asrate"
fi
if [ "$deint" == "y" ]
then
vf_opt="-vf-add lavcdeint"
@ -89,20 +110,44 @@ fi
vf_opt="$vf_opt -vf-add scale -zoom -xy $xsize"
read_opt="$device_opt dvd://$title -chapter $chapter -dvdangle $angle -alang $alang $slang_opt"
audio_opt="-oac mp3lame -lameopts cbr:br=$abr:aq=0:mode=$stereo_mode"
audio_opt="-oac mp3lame -lameopts cbr:br=$abr:aq=0:mode=$stereo_mode $aresample"
if [ "$vcodec" == "lavc" ]
then
video_opt="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbr:vhq:v4mv"
video_opt1="-ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$vbr:vhq:v4mv"
video_opt2="-ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=$vbr:vhq:v4mv"
else
if [ "$vcodec" == "xvid" ]
then
video_opt="-ovc xvid -xvidencopts bitrate=$vbr:chroma_me:chroma_opt:hq_ac:vhq=4"
video_opt1="-ovc xvid -xvidencopts pass=1:bitrate=$vbr:chroma_me:chroma_opt:hq_ac:vhq=4"
video_opt2="-ovc xvid -xvidencopts pass=2:bitrate=$vbr:chroma_me:chroma_opt:hq_ac:vhq=4"
else
if [ "$vcodec" != "-" ]
then
echo "invalid video codec: [$vcodec]"
exit 0
fi
fi
fi
#-----------------------------------------------------------------------------------------------------------------------------------
echo "Cleanup..."
\rm frameno.avi
\rm divx2pass.log
if [ "$aspect" == "-" ]
then
video_opt=$video_opt":autoaspect"
video_opt1=$video_opt1":autoaspect"
video_opt2=$video_opt2":autoaspect"
else
video_opt=$video_opt":aspect=$aspect"
video_opt1=$video_opt1":aspect=$aspect"
video_opt2=$video_opt2":aspect=$aspect"
fi
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "$bufferize" != "d" ]
if [ "$bufferize" != "n" ]
then
if [ "$bufferize" == "y" ] || [ "$bufferize" == "o" ]
then
@ -122,32 +167,45 @@ fi
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "$apass" == "1" ]
if [ "$apass" != "n" ]
then
if [ "$apass" == "y" ] || [ "$apass" == "o" ]
then
echo "Cleanup..."
\rm frameno.avi
echo "Compressing MP3..."
mencoder $read_opt $audio_opt -ovc frameno $vf_opt -o frameno.avi >$out_name.2.log 2>&1
fi
$audio_opt="-oac copy"
if [ "$apass" == "o" ]
then
exit 1
fi
audio_opt="-oac copy"
fi
#-----------------------------------------------------------------------------------------------------------------------------------
echo "Compressing DivX pass 1..."
mencoder $read_opt $audio_opt -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$vbr:vhq:v4mv:aspect=$aspect $vf_opt -o $divx_name >$out_name.3.log 2>&1
#-----------------------------------------------------------------------------------------------------------------------------------
echo "Compressing DivX pass 2..."
mencoder $read_opt $audio_opt -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=$vbr:vhq:v4mv:aspect=$aspect $vf_opt -o $divx_name >$out_name.4.log 2>&1
#-----------------------------------------------------------------------------------------------------------------------------------
echo "Cleanup..."
\rm frameno.avi
\rm divx2pass.log
\rm xvid-twopass.stats
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "$vpass" == "1" ]
then
echo "Compressing DivX..."
mencoder $read_opt $audio_opt $video_opt $vf_opt -o $divx_name >$out_name.3.log 2>&1
else
echo "Compressing DivX pass 1..."
mencoder $read_opt $audio_opt $video_opt1 $vf_opt -o $divx_name >$out_name.3.log 2>&1
echo "Compressing DivX pass 2..."
mencoder $read_opt $audio_opt $video_opt2 $vf_opt -o $divx_name >$out_name.4.log 2>&1
fi