Code: Select all
HandBrakeCLI \
--input "$1" \
--output "$1/${1}.$TYPE" \
--main-feature \
--min-duration 1800 \
--encoder x264 \
--quality 20.0 \
--audio 1,1 \
--aencoder lame,copy:ac3 \
--ab 160,160 \
--mixdown dpl2,auto \
--arate Auto,Auto \
--drc 0.0,0.0 \
--audio-copy-mask aac,ac3,dtshd,dts,mp3 \
--audio-fallback ffac3 \
--format $TYPE \
--large-file \
--decomb \
--loose-anamorphic \
--modulus 2 \
--x264-preset medium \
--h264-profile high \
--h264-level 4.1
I've been using a process for quite some time, and it usually works quite well. I rip a BD with makemkvcon, making a full-fat backup to a directory on my NAS. I play these files on my Raspberry Pi running OpenELEC with XBMC. Sadly, I cannot play the full M2TS files on the RPi due to its rather limited network bandwidth and RAM. My solution is to grab the largest M2TS file and transcode it to MKV using HandbrakeCLI. This works great, except for seamless branching discs.
Unfortunately these "seamless branching discs" (a new term for me), present a challenge. If I grab the largest M2TS file, that will be a significant chunk of the movie, but always somewhere in the middle of it. I need to refine my process so I get full-length titles from my BDs regardless of whether they're (what I call) "standard," or one of these seamless discs.
Just to document my scripts:
filename: rip
Code: Select all
!/bin/bash
MAKEMKVCON=/usr/bin/makemkvcon
TITLE=$1
#BDROM=/dev/sr0
BDROM=0
MKVOPTS="--messages=-stdout --progress=-stdout --directio=true --decrypt --robot"
echo MAKEMKVCON=$MAKEMKVCON
echo MKVOPTS=$MKVOPTS
echo TITLE=$TITLE
echo BDROM=$BDROM
echo $MAKEMKVCON \
$MKVOPTS \
backup \
disc:$BDROM \
"$TITLE"
$MAKEMKVCON \
$MKVOPTS \
backup \
disc:$BDROM \
"$TITLE"
Code: Select all
#!/bin/bash
# Get options
TEMP=$(getopt --options id: --long ios,dir --name 'bd_convert' -- "$@")
[ $? != 0 ] && echo "Invalid options..." >&2 && \
echo "Usage: $0 [-i|-m] [<BD directory>]" >&2 && \
echo " -i|--ios encode MP4 container" >&2 && \
echo " -m|--mkv encode MKV container (default)" >&2 && \
echo " -d|--dir convert only specified directory (not all)" >&2 && \
#echo " -b|--both (default) encode both types" >&2 && \
exit 1
eval set -- "$TEMP"
IOS=0 # 0: mkv, 1: mp4, 2: both
while true;
do
case "$1" in
-i|--ios) IOS=1; shift ;;
-m|--mkv) IOS=0; shift ;;
#-b|--both) IOS=2; shift ;;
-d|--dir) DIR=$2; shift; shift ;;
--) shift; break ;;
*) echo "Internal option parsing error!" >&2 && exit 127 ;;
esac
done
if [ $IOS -eq 1 ];
then
echo "Processing for IOS (MP4)..."
TYPE="mp4"
elif [ $IOS -eq 2 ];
then
echo "Processing for both IOS and MKV..."
else
echo "Processing MKV"
TYPE="mkv"
fi
convert () {
echo "DEBUG: Processing '${1}'" >&2
# Test if current file is a directory. If not, skip to next file.
[ -d "$1" ] || continue;
#echo "DEBUG: We have a directory in '$1'..." >&2
# Test whether the current directory has a BDMV subdirectory. If not, print
# nonstandard directory name for manual processing, and skip to next file
if [ -d "$1/BDMV" ];
then
#echo "DEBUG: We have a full BD rip in '$1'..." >&2
# Test whether the current directory has already been converted. If so, skip
# to next.
if [ ! -f "$1/${1}.$TYPE" ]
then
# If we're here, we can begin processing
echo "DEBUG: We will process '$1'" >&2;
# Find largest file in $1/BDMV
LARGE=$(ls --size "$1/BDMV/STREAM" |
sort -n |
tail -n 1 |
awk '{print $2}')
echo "$1/BDMV/STREAM/$LARGE will be converted." >&2
# Actually process the file:
HandBrakeCLI \
--input "$1/BDMV/STREAM/$LARGE" \
--output "$1/${1}.$TYPE" \
--encoder x264 \
--quality 20.0 \
--audio 1,1 \
--aencoder lame,copy:ac3 \
--ab 160,160 \
--mixdown dpl2,auto \
--arate Auto,Auto \
--drc 0.0,0.0 \
--audio-copy-mask aac,ac3,dtshd,dts,mp3 \
--audio-fallback ffac3 \
--format mkv \
--large-file \
--decomb \
--loose-anamorphic \
--modulus 2 \
--x264-preset medium \
--h264-profile high \
--h264-level 4.1
else
echo "'$1' has already been converted." >&2 && continue;
fi
else
echo "'$1' is not a full BD rip." >&2 && continue;
fi
}
if [ -z "$DIR" ];
then
DIR=*
for dir in $DIR;
do
convert "$dir";
done
else
convert "$DIR"
fi
I would kill for an in depth guide for using makemkvcon. The incomplete documentation I've found is insufficient (all of it's not even in the same place!). I would also kill for an makemkv specific IRC channel. If it's somewhere, it isn't on Freenode.