From d3d69604ce4a320b1f6c4a057e96bf1a5a5048a0 Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Sat, 4 Feb 2012 20:54:41 -0700 Subject: [PATCH] Added support for making MKV files via handbrake. Fixed a few typos as well. --- rip_dvd | 57 ++++++++++-------------------------------------- rip_dvd_menu.xml | 16 +++++++------- 2 files changed, 20 insertions(+), 53 deletions(-) diff --git a/rip_dvd b/rip_dvd index 7c6bc3c..24d881e 100755 --- a/rip_dvd +++ b/rip_dvd @@ -113,7 +113,7 @@ fi ############################################################################################## # Command line processing ############################################################################################## -while (($#)) && getopts 162wmvifkzx:ht:n:d:b:B:s:t:a:p:e:j:l:r:R: opt "$@" +while (($#)) && getopts 162wmvifkzx:hT:t:n:d:b:B:s:t:a:p:e:j:l:r:R: opt "$@" do case $opt in (n) dvdname=$OPTARG;; @@ -140,6 +140,7 @@ do (l) aid_override=$OPTARG;; (r) drc=$OPTARG;; (w) set -x;; + (T) minimum_feature_title_length=$OPTARG;; (h) show_usage=1;; (:) echo >&2 "$0: $OPTARG requires a value"; errors=errors+1;; (\?) echo >&2 "$0: invalid option '$OPTARG'"; errors=errors+1;; @@ -167,9 +168,9 @@ function usage() { echo >&2 " - iphone = MP4, x264 codec, 2 pass encoding, forced 480:320 scaling" echo >&2 " - ipod = MP4, x264 codec, 2 pass encoding, forced 320:240 scaling" echo >&2 " Handbrake Only Encoder Profiles:" - echo >&2 " - mkvvhq = MKV, very high quality encoding (0.95 quality)" - echo >&2 " - mkvhq = MKV, high quality encoding (0.90 quality)" - echo >&2 " - mkv = MKV, high quality encoding (0.85 quality)" + echo >&2 " - mkvvhq = MKV, very high quality encoding, x264 codec, 2 pass encoding" + echo >&2 " - mkvhq = MKV, high quality encoding, x264 codec, 2 pass encoding" + echo >&2 " - mkv = MKV, high quality encoding, x264 codec, 2 pass encoding" echo >&2 " - mp4vhq = MP4, very high quality encoding, x264 codec, 2 pass encoding" echo >&2 " - mp4hq = MP4, high quality encoding, x264 codec, 2 pass encoding" echo >&2 " - mp4 = MP4, fast encoding, x264 codec, 2 pass encoding" @@ -207,6 +208,7 @@ function usage() { echo >&2 " By default, all intermediary files are deleted. Only the final image is kept" echo >&2 " -l Specify the audio AID language ID to rip from the source DVD" echo >&2 " -t Specify the main feature title to pull from the DVD (only required if this script can't figure it out)" + echo >&2 " -T <length> Specify the minimum feature title length in minutes. This is used when picking which title to rip." echo >&2 " -w Set the sh Execute/Verbose flag (causes every command to be echoed)" echo >&2 "" exit 2 @@ -264,7 +266,7 @@ if [ -z "$encoder" ]; then encoder="mencoder"; # If we can't find handbrake, set mencoder as the default [[ -x `which $handbrake_xvid` ]] && [[ "$profile" =~ "xvid" ]] && encoder="handbrake"; [[ -x `which $handbrake_mp4` ]] && [[ "$profile" =~ "mp4" ]] && encoder="handbrake"; - [[ -x `which $handbrake_mp4` ]] && [[ "$profile" =~ "mk4" ]] && encoder="handbrake"; + [[ -x `which $handbrake_mp4` ]] && [[ "$profile" =~ "mkv" ]] && encoder="handbrake"; [[ -x `which $handbrake_mp4` ]] && [[ "$profile" =~ "ip" ]] && encoder="handbrake"; [[ -x `which $handbrake_mp4` ]] && [[ "$profile" =~ "hb" ]] && encoder="handbrake"; fi @@ -743,11 +745,12 @@ function encode_vob_file_handbrake { fi fi - # MP4 profile - if [[ "$profile" =~ "mp4" ]]; then + # MP4 || MKV profile + if [[ "$profile" =~ "mp4" ]] || [[ "$profile" =~ "mkv" ]]; then found_profile=1 handbrake_cli="$handbrake_mp4" - final_output_file="$dest/$dvdname.mp4" + [[ "$profile" =~ "mp4" ]] && final_output_file="$dest/$dvdname.mp4" + [[ "$profile" =~ "mkv" ]] && final_output_file="$dest/$dvdname.mkv" PASSES="$PASSES -T" # Handle custom parameter overrides @@ -775,43 +778,6 @@ function encode_vob_file_handbrake { fi fi - # MKV profile - if [[ "$profile" =~ "mkv" ]]; then - found_profile=1 - handbrake_cli="$handbrake_mp4" - final_output_file="$dest/$dvdname.mkv" - PASSES="" - - # Handle custom parameter overrides - if [ $custom_video_bitrate == 1 ]; then - handbrake_opts[0]="-b $target_video_bitrate" - fi - if [ $custom_audio_2ch == 0 ]; then - audio_2ch=0 - fi - if [ $custom_audio_6ch == 0 ]; then - audio_6ch=0 - fi - - # Very High Quality - if [ "$profile" == "mkvvhq" ]; then - handbrake_opts[0]="-q 0.95" - fi - # High Quality - if [ "$profile" == "mkvhq" ]; then - handbrake_opts[0]="-q 0.90" - fi - # Fast - if [ "$profile" == "mkv" ]; then - handbrake_opts[0]="-q 0.85" - fi - - # Common options to all profiles above - handbrake_opts[1]="--strict-anamorphic" - handbrake_opts[2]="--crop 0:0:0:0" - - fi - # iphone and ipod MP4 profiles if [ "$profile" == "iphone" ] || [ "$profile" == "ipod" ]; then found_profile=1 @@ -1912,6 +1878,7 @@ if [ $mirror_mode -eq 0 ]; then # Create our "vobfile" using makemkv if told to do so if [[ "$isofile" =~ "iso" ]] && [[ "$ripper" == "makemkv" ]]; then + echo "-> Creating VOB/MKV file from $isofile" vobfile="$tmpdir/$dvdname.mkv" make_dvd_mkv_image "$vobfile" "iso" "$isofile" fi diff --git a/rip_dvd_menu.xml b/rip_dvd_menu.xml index ed79a51..725d67d 100644 --- a/rip_dvd_menu.xml +++ b/rip_dvd_menu.xml @@ -15,49 +15,49 @@ <button> <type>DVD_RIP</type> <text>Rip Netflix DVD (MKV->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap netflix -b 2000 -z -R makemkv -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap netflix -b 2000 -z -R makemkv -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Netflix DVD (ISO->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap netflix -b 2000 -z -R ddrescue -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap netflix -b 2000 -z -R ddrescue -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Kid's DVD (MKV->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap childrens -b 2000 -z -R makemkv -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap childrens -b 2000 -z -R makemkv -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Kid's DVD (ISO->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap childrens -b 2000 -z -R ddrescue -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap childrens -b 2000 -z -R ddrescue -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Our DVD (MKV->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap collection -b 2000 -z -R makemkv -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap collection -b 2000 -z -R makemkv -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Our DVD (ISO->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap collection -b 2000 -z -R ddrescue -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap collection -b 2000 -z -R ddrescue -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Church DVD (MKV->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap church -b 2000 -z -R makemkv -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap church -b 2000 -z -R makemkv -p mkvhq</action> </button> <button> <type>DVD_RIP</type> <text>Rip Church DVD (ISO->MP4)</text> - <action>EXEC /myth/video/bin/rip_dvd.wrap church -b 2000 -z -R ddrescue -p mp4hq</action> + <action>EXEC /myth/video/bin/rip_dvd.wrap church -b 2000 -z -R ddrescue -p mkvhq</action> </button> </mythmenu> -- 2.34.1