Compare commits

..

No commits in common. "master" and "dvd2divx-3_0_0-1" have entirely different histories.

5 changed files with 166 additions and 459 deletions

View File

@ -1,7 +1,7 @@
# $RCSfile: ReadMe.txt,v $ # $RCSfile: ReadMe.txt,v $
# $Revision: 1.2 $ # $Revision: 1.1 $
# $Name: $ # $Name: $
# $Date: 2010/02/17 11:01:10 $ # $Date: 2004/06/05 13:29:40 $
# $Author: agibert $ # $Author: agibert $
@ -12,113 +12,7 @@ Welcome to DVD2DivX !
This little shell script is designed for automatise DVD ripping. It uses the great encoder program 'mencoder' from 'mplayer' package. This little shell script is designed for automatise DVD ripping. It uses the great encoder program 'mencoder' from 'mplayer' package.
It currently mainly support: Please read the example file and the comment in the dvd2divx file.
- direct or buffured extraction,
- mp3 audio encoding,
- none or one audio pass,
- audio resampling,
- audio volume correction,
- none, one or two video passes,
- lavc, xvid and x264 codecs,
- video resizing,
- video aspect correction,
- video de-interlacement,
- video quality setup profiles,
- subtitles,
- multi-threading.
Usage:
------
dvd2divx divx_root divx_title input dvd_device dvd_title chapter angle alang slang audio abr asrate stereo volume sub video vcodec vqual vbr crop xsize aspect deint threads vopts
input options:
input: input mode: d | db | dbo | b
d: read directly from disk,
db: bufferize and continue,
dbo: bufferize only,
b: read from a preexisting buffer
dvd_device: input device or file: - | /dev/dvd | ...
-: none
/dev/dvd: dvd device,
...
title: dvd title number
chapter: dvd chapter number
angle: dvd angle number
alang: audio language name or id: - | en | fr | 0 | 1 | ...
-: none,
en: english,
fr: french,
0: id 0,
1: id 1,
...
slang: subtitles language name or id: - | en | fr | 0 | 1 | ...
-: none,
en: english,
fr: french,
0: id 0,
1: id 1,
...
audio options:
audio: audio mode: ap | avp | fvp | n
ap: compress audio during audio pass
avp: compress audio during all video pass
fvp: compress audio during final video pass
n: use input audio stream)
abr: audio bit rate
asrate: audio sampling rate: - | xxx
-: no resampling
...: sampling rate
stereo: audio stereo mode: y | n
y: stereo
n: mono
volume: audio volume gain in db: - | ...
-: no change,
...: gain in db
subtitles option:
sub: subtitles mode: - | f | o
-: no subtitles,
f: file subtitles,
o: OSD subtitles
video options:
video: video mode: 1 | 2a | 2s | n
1: compress video in 1 pass,
2a: compress video in 2 assymetric passes,
2s: compress video in 2 symetric passes,
n: use input video stream
vcodec: video codec: - | lavc | xvid | x264
vquality: video quality profile: 0 | 1 | 2 | 3
0: realtime,
1: fast,
2: High quality,
3: very high quality
vbr: video bit rate
crop: cropping size: - | width:height:x:y
-: no cropping,
width:height:x:y: copping area
xsize: video x size: - | ...
aspect: video aspect: - | 4/3 | 16/9 | ...
deint: deinterlace video: y | n
threads: thread number: - | 1 | ...
vopts: extra video codec options: - | ...
Batch usage example:
--------------------
# divx_root divx_title input dvd_device dvd_title chapter angle alang slang audio abr asrate stereo volume sub video vcodec vqual vbr crop xsize aspect deint threads vopts
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
dvd2divx cobra 1 dbo /dev/cdrom1 10 1- 1 fr - - - - - - - - - - - - - - - -
dvd2divx cobra 1 b - - - - - - fvp 128 - n 10 - 2a xvid 3 1000 - 480 4/3 y 4 cartoon

View File

@ -1,41 +1,13 @@
# $RCSfile: ReleaseNotes.txt,v $ # $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.10 $ # $Revision: 1.4 $
# $Name: $ # $Name: $
# $Date: 2010/02/17 11:19:34 $ # $Date: 2007/05/10 09:56:19 $
# $Author: agibert $ # $Author: agibert $
--------------------------------------------------------------------------------
dvd2divx V 4.0.0-1 - A. Gibert - 2010/02/17
--------------------------------------------------------------------------------
- Major code rewrite,
- New command line interface,
- Args major reorganisation,
- Add x264 codec support,
- New video quality presetings (vqual),
- Add crop support,
- Add OSD sub title support,
- Add extra vcodec option support (vopts),
- Add id support in alang option,
- Add volume control option,
- Fix audio encoding in vfp mode and in 2a or 2s video mode,
- Fix video aspect by using "-force-avi-aspect",
- Add documentation into ReadMe.txt file.
--------------------------------------------------------------------------------
dvd2divx V 3.1.0-1 - A. Gibert - 2008/10/07
--------------------------------------------------------------------------------
Add multi instance support: we can call many dvd2divx in parallel in the same directory.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
dvd2divx V 3.0.0-1 - A. Gibert - 2007/05/10 dvd2divx V 3.0.0-1 - A. Gibert - 2007/05/10
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

7
barry_lyndon_example Executable file
View File

@ -0,0 +1,7 @@
#!/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 threads
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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 4
dvd2divx - barry_lyndon 2 - - - - - lavc 920 128 480 4/3 y - n s y 2 4

34
cobra_example Executable file
View File

@ -0,0 +1,34 @@
#!/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 threads
#--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#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 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx - cobra 2 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx - cobra 3 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx - cobra 4 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx - cobra 5 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx - cobra 6 - - - - - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 13 10 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 14 11 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 15 12 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 16 13 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 17 14 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 18 15 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 19 10 1- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 20 10 3- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 21 10 5- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 22 10 7- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 23 10 9- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 24 10 11- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
#dvd2divx /dev/cdrom1 cobra 31 10 13- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
dvd2divx - cobra pre2 11 1 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4
dvd2divx - cobra post2 11 2- 1 fr - xvid 1000 128 480 4/3 n - y s y 2 4

426
dvd2divx
View File

@ -2,12 +2,12 @@
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# DVD2DivX # DVD2DivX
# #
# (C) 2004-2009 Arnaud G. Gibert # (C) 2004-2007 Arnaud G. Gibert
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# $RCSfile: dvd2divx,v $ # $RCSfile: dvd2divx,v $
# $Revision: 1.13 $ # $Revision: 1.4 $
# $Name: $ # $Name: $
# $Date: 2010/11/24 07:58:02 $ # $Date: 2007/05/10 10:00:01 $
# $Author: agibert $ # $Author: agibert $
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@ -32,74 +32,50 @@
# Usage exemple # Usage exemple
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# #!/bin/bash # #!/bin/bash
# # divx_root divx_title input buf_type dvd_device dvd_title chapter angle alang slang audio abr asrate stereo volume sub video vcodec vqual vbr crop xsize aspect deint threads vopts # # dvd_device divx_root divx_title dvd_title chapter angle alang slang vcodec vbr abr xsize aspect stereo asrate deint buffer apass vpass threads
# #--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # #-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# dvd2divx cobra 1 dbo c /dev/cdrom1 10 1- 1 fr - - - - - - - - - - - - - - - - #
# dvd2divx cobra 1 b - - - - - - - fvp 128 - n 10 - 2a xvid 3 1000 - 480 4/3 y 4 cartoon # # 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 4
#
#-----------------------------------------------------------------------------------------------------------------------------------
dvd_device=$1 # -|/dev/dvd|...
divx_root=${1} # divx_root=$2
divx_title=${2} # divx_title=$3
#------------------------------------------------------------------------------ title=$4
input=${3} # d|db|dbo|b (d: read directly from disk | db: bufferize and continue | dbo: bufferize only | b: read from a preexisting buffer) chapter=$5
buf_type=${4} # c|u (c: compresed | u: uncompressed) angle=$6
dvd_device=${5} # -|/dev/dvd|... alang=$7 # en|fr|...
title=${6} # slang=$8 # -|en|fr|...
chapter=${7} # vcodec=$9 # -|lavc|xvid
angle=${8} # vbr=${10}
alang=${9} # -|en|fr|...|0|1|... (lang or id) abr=${11}
slang=${10} # -|en|fr|...|0|1|... (lang or id) xsize=${12} #
#------------------------------------------------------------------------------ aspect=${13} # -|4/3|16/9|...
audio=${11} # ap|avp|fvp|n (ap: compress audio during audio pass | avp: compress audio during all video pass | fvp: compress audio during final video pass | no: use input audio stream)
abr=${12} # xxx (audio bit rate)
asrate=${13} # -|xxx (resample audio)
stereo=${14} # y|n stereo=${14} # y|n
volume=${15} # -|a/xx|yy (-: no volume change | a: auto normalize at -xx db | add yy db) asrate=${15} # -|xxx (resample audio)
#------------------------------------------------------------------------------ deint=${16} # y|n
sub=${16} # -|f|o (-: no subtitles | f: file subtitles | o: OSD subtitles) 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)
video=${17} # 1|2a|2s|n (1: compress video in 1 pass | 2a: compress video in 2 assymetric passes | 2s: compress video in 2 symetric passes | no: use input video stream) vpass=${19} # 1|2
vcodec=${18} # -|lavc|xvid|x264 threads=${20} # -|1..
vquality=${19} # 0|1|2|3 (0: realtime | 1: fast | 2: high quality | 3: very high quality)
vbr=${20} # xxx (video bit rate)
crop=${21} # -|width:height:x:y
xsize=${22} # -|...
aspect=${23} # -|4/3|16/9|...
deint=${24} # y|n
threads=${25} # -|1..
vopts=${26} # -|... # other vcodec options
#-----------------------------------------------------------------------------------------------------------------------------------
tmpdir_name=$divx_root-$divx_title.tmp
divx_name=../$divx_root-$divx_title.avi
tmp_name=../$divx_root-$divx_title.vob
out_name=../$divx_root-$divx_title
echo "DivX: [$divx_name] title: ($title)"
echo "Input: [$input] buf type: [$buf_type] device: [$dvd_device] title: ($title) chapter: ($chapter) angle: ($angle) alang: ($alang) slang: ($slang)"
echo "Audio: [$audio] abr: ($abr) asrate: ($asrate) stereo: ($stereo) volume: (${volume})"
echo "Sub: [$sub]"
echo "Video: [$video] vcodec: [$vcodec] vquality: [$vquality] vbr: ($vbr) crop: ($crop) xsize: ($xsize) aspect: ($aspect) deint: ($deint) threards: ($threads) vopts: [${vopts}]"
#-----------------------------------------------------------------------------------------------------------------------------------
# DVDRip Setup
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
shopt -s extglob divx_name=$divx_root-$divx_title.avi
tmp_name=$divx_root-$divx_title.vob
out_name=$divx_root-$divx_title
if [ "$buf_type" == "u" ] echo "device: [$dvd_device] DivX: [$divx_name] title: ($title) chapter: ($chapter) angle: ($angle) alang: ($alang) slang: ($slang)"
then echo "vcodec: [$vcodec] vbr: ($vbr) abr: ($abr) xsize: ($xsize) aspect: ($aspect) stereo: ($stereo) asrate: ($asrate) deint: ($deint)"
audio_buf_opt="-oac pcm" echo "bufferize: ($bufferize) apass: ($apass) vpass: ($vpass) theards: ($threads)"
video_buf_opt="-ovc raw"
else
audio_buf_opt="-oac copy"
video_buf_opt="-ovc copy"
fi
if [ "$dvd_device" != "-" ] if [ "$dvd_device" != "-" ]
@ -107,80 +83,11 @@ then
device_opt="-dvd-device $dvd_device" device_opt="-dvd-device $dvd_device"
fi fi
if [ "$sub" == "-" ] if [ "$slang" == "-" ]
then then
slang_opt="" slang_opt=""
else else
if [ "$slang" != "-" ] slang_opt="-slang $slang -vobsubout $out_name -vobsuboutid $slang -vobsuboutindex 0"
then
if [[ "$slang" == +([[:digit:]]) ]]
then
slang_opt="-sid $slang"
else
slang_opt="-slang $slang"
fi
if [ "$sub" == "f" ]
then
slang_opt+=" -vobsubout $out_name -vobsuboutid $slang -vobsuboutindex 0"
else
if [ "$sub" == "o" ]
then
slang_opt+=" -ass"
fi
fi
fi
fi
if [ "$alang" != "-" ]
then
if [[ "$alang" == +([[:digit:]]) ]]
then
alang_opt="-aid $alang"
else
alang_opt="-alang $alang"
fi
else
alang_opt=""
fi
read_dvd_opt="$device_opt dvd://$title -chapter $chapter -dvdangle $angle $alang_opt $slang_opt"
read_buf_opt="$tmp_name"
case "$input"
in
d)
read_opt2="${read_dvd_opt}"
;;
db)
read_opt1="${read_dvd_opt}"
read_opt2="${read_buf_opt}"
;;
dbo)
read_opt1="${read_dvd_opt}"
;;
b)
read_opt2="${read_buf_opt}"
;;
esac
#-----------------------------------------------------------------------------------------------------------------------------------
# Audio Setup
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "$asrate" == "-" ]
then
aresample=""
else
aresample="-srate $asrate -af-add lavcresample=$asrate"
fi fi
if [ "$stereo" == "y" ] if [ "$stereo" == "y" ]
@ -190,119 +97,105 @@ else
stereo_mode=3 stereo_mode=3
fi fi
if [ "$asrate" == "-" ]
#-----------------------------------------------------------------------------------------------------------------------------------
# Video Setup
#-----------------------------------------------------------------------------------------------------------------------------------
video_lavc_header_11="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbr"
video_lavc_header_21="-ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=$vbr"
video_lavc_header_22="-ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=$vbr"
video_lavc_body_0="mbd=2:turbo"
video_lavc_body_1="mbd=2:trell:v4mv:turbo"
video_lavc_body_2="mbd=2:trell:v4mv:last_pred=2:dia=-1:vmax_b_frames=2:vb_strategy=1:cmp=3:subcmp=3:precmp=0:vqcomp=0.6:turbo"
video_lavc_body_3="mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2"
video_xvid_header_11="-ovc xvid -xvidencopts bitrate=$vbr"
video_xvid_header_21="-ovc xvid -xvidencopts pass=1:bitrate=$vbr"
video_xvid_header_22="-ovc xvid -xvidencopts pass=2:bitrate=$vbr"
video_xvid_body_0="turbo:nochroma_me:notrellis:max_bframes=0:vhq=0"
video_xvid_body_1="turbo:vhq=0"
video_xvid_body_2="vhq=2:bvhq=1:chroma_opt:quant_type=mpeg"
video_xvid_body_3="chroma_opt:vhq=4:bvhq=1:quant_type=mpeg"
video_x264_header_11="-ovc x264 -x264encopts bitrate=$vbr"
video_x264_header_21="-ovc x264 -x264encopts pass=1:bitrate=$vbr"
video_x264_header_22="-ovc x264 -x264encopts pass=2:bitrate=$vbr"
video_x264_body_0="bframes=0"
#video_x264_body_0="b_pyramid=1"
video_x264_body_1="subq=4:bframes=2:bframes=0"
#video_x264_body_1="subq=4:bframes=2:b_pyramid=1:weight_b"
video_x264_body_2="subq=5:8x8dct:frameref=2:bframes=0"
#video_x264_body_2="subq=5:8x8dct:frameref=2:bframes=3:b_pyramid=1:weight_b"
video_x264_body_3="subq=9:partitions=all:8x8dct:me=umh:me_range=64:frameref=6:bframes=0"
#video_x264_body_3="subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b"
if [ "$video" != "n" ]
then then
if [ "$video" == "1" ] aresample=""
then else
video_opt1=$(eval echo \${video_${vcodec}_header_11}:\${video_${vcodec}_body_${vquality}}) aresample="-srate $asrate -af lavcresample=$asrate"
else
if [ "$video" == "2a" ]
then
video_opt1=$(eval echo \${video_${vcodec}_header_21}:\${video_${vcodec}_body_0})
video_opt2=$(eval echo \${video_${vcodec}_header_22}:\${video_${vcodec}_body_${vquality}})
else
video_opt1=$(eval echo \${video_${vcodec}_header_21}:\${video_${vcodec}_body_${vquality}})
fi
video_opt2=$(eval echo \${video_${vcodec}_header_22}:\${video_${vcodec}_body_${vquality}})
fi
fi
if [ "$crop" != "-" ]
then
vf_opt="-vf-add crop=$crop"
fi
if [ "$xsize" != "-" ]
then
vf_opt+=" -vf-add scale -zoom -xy $xsize"
fi fi
if [ "$deint" == "y" ] if [ "$deint" == "y" ]
then then
vf_opt+=" -vf-add lavcdeint" vf_opt="-vf-add lavcdeint"
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 $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 fi
if [ "$aspect" == "-" ] if [ "$aspect" == "-" ]
then then
if [ "$vcodec" != "x264" ] video_opt=$video_opt":autoaspect"
then
video_opt1=$video_opt1":autoaspect" video_opt1=$video_opt1":autoaspect"
video_opt2=$video_opt2":autoaspect" video_opt2=$video_opt2":autoaspect"
fi
else else
glob_opt="-force-avi-aspect ${aspect}" video_opt=$video_opt":aspect=$aspect"
if [ "$vcodec" != "x264" ]
then
video_opt1=$video_opt1":aspect=$aspect" video_opt1=$video_opt1":aspect=$aspect"
video_opt2=$video_opt2":aspect=$aspect" video_opt2=$video_opt2":aspect=$aspect"
fi
fi fi
if [ "$threads" != "-" ] if [ "$threads" != "-" ]
then then
video_opt=$video_opt":threads=$threads"
video_opt1=$video_opt1":threads=$threads" video_opt1=$video_opt1":threads=$threads"
video_opt2=$video_opt2":threads=$threads" video_opt2=$video_opt2":threads=$threads"
fi fi
if [ "${vopts}" != "-" ]
then
video_opt1=$video_opt1":${vopts}"
video_opt2=$video_opt2":${vopts}"
fi
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
mkdir $tmpdir_name if [ "$bufferize" != "n" ]
cd $tmpdir_name then
if [ "$bufferize" == "y" ] || [ "$bufferize" == "o" ]
then
echo "Bufferizing..."
mencoder $read_opt -oac copy -ovc copy -o $tmp_name >$out_name.1.log 2>&1
if [ "$bufferize" == "o" ]
then
exit 1
fi
fi
read_opt="$tmp_name"
fi
#-----------------------------------------------------------------------------------------------------------------------------------
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
if [ "$apass" == "o" ]
then
exit 1
fi
audio_opt="-oac copy"
fi
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
@ -313,109 +206,16 @@ echo "Cleanup..."
#-----------------------------------------------------------------------------------------------------------------------------------
# Bufferizing
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
if [ "$input" != "d" ] && [ "$input" != "b" ] if [ "$vpass" == "1" ]
then then
echo "Bufferizing..."
mencoder $read_opt1 $audio_buf_opt $video_buf_opt -o $tmp_name >$out_name.1.log 2>&1
if [ "$input" == "dbo" ]
then
exit 1
fi
fi
#-----------------------------------------------------------------------------------------------------------------------------------
# Audio Volume Setup
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "${volume}" == "-" ]
then
vol_opt=""
else
if [ "${volume/\/*/}" == "a" ]
then
vol_max="$(mencoder $read_opt2 -af-add stats -oac pcm -ovc copy -o /dev/null | grep "stats: max_volume:" | sed -e 's/.*-//' -e 's/ dB.*//')"
vol_opt="-af-add volume=$((${vol_max} - ${volume/*\//})):0"
echo "[${vol_max}] - [${volume/*\//}]"
else
vol_opt="-af-add volume=$volume:0"
fi
fi
#-----------------------------------------------------------------------------------------------------------------------------------
# Audio Final Setup
#-----------------------------------------------------------------------------------------------------------------------------------
audio_comp_opt="-oac mp3lame -lameopts cbr:br=$abr:aq=0:mode=$stereo_mode $aresample ${vol_opt}"
audio_copy_opt="-oac copy"
if [ "$audio" != "n" ]
then
if [ "$video" == "1" ]
then
audio_opt1="$audio_comp_opt"
else
if [ "$video" != "n" ]
then
if [ "$audio" == "avp" ]
then
audio_opt1="$audio_comp_opt"
audio_opt2="$audio_comp_opt"
else
if [ "$audio" == "fvp" ]
then
audio_opt1="$audio_copy_opt"
audio_opt2="$audio_comp_opt"
fi
fi
else
audio_opt1="$audio_comp_opt"
fi
fi
else
audio_opt1="$audio_copy_opt"
audio_opt2="$audio_copy_opt"
fi
#-----------------------------------------------------------------------------------------------------------------------------------
# Audio / Video Compression
#-----------------------------------------------------------------------------------------------------------------------------------
if [ "$video" != "n" ]
then
if [ "$video" == "1" ]
then
echo "Compressing DivX..." echo "Compressing DivX..."
mencoder $read_opt2 $audio_opt1 $video_opt1 $vf_opt $glob_opt -o $divx_name >$out_name.3.log 2>&1 mencoder $read_opt $audio_opt $video_opt $vf_opt -o $divx_name >$out_name.3.log 2>&1
else else
echo "Compressing DivX pass 1..." echo "Compressing DivX pass 1..."
mencoder $read_opt2 $audio_opt1 $video_opt1 -o /dev/null >$out_name.3.log 2>&1 mencoder $read_opt $audio_opt $video_opt1 $vf_opt -o $divx_name >$out_name.3.log 2>&1
echo "Compressing DivX pass 2..." echo "Compressing DivX pass 2..."
mencoder $read_opt2 $audio_opt2 $video_opt2 $vf_opt $glob_opt -o $divx_name >$out_name.4.log 2>&1 mencoder $read_opt $audio_opt $video_opt2 $vf_opt -o $divx_name >$out_name.4.log 2>&1
fi
else
if [ "$audio" == "ap" ]
then
echo "Compressing DivX audio..."
mencoder $read_opt2 $audio_opt1 -ovc copy $glob_opt -o $divx_name >$out_name.2.log 2>&1
fi
fi fi