7 # Recommended min quality for 1080p HD = 22
8 # Quality 17 ~ 30% of the original size
9 # Quality 18 ~ 25% of the original size
10 # Quality 20 ~ 15% of the original size
11 # Quality 25 ~ 75% of the original size (for 1080p/60fps content)
12 # Quality 26 ~ 60% of the original size (for 1080p/60fps content)
13 # Quality 27 ~ 50% of the original size (for 1080p/60fps content)
16 if [ -z "$INPUT" ]; then
17 echo "Usage: $0 input outputdir"
21 if [ -z "$OUTPUT_DIR" ]; then
25 FILENAME=`basename "${INPUT%.*}"`
26 OUTPUT="$OUTPUT_DIR/$FILENAME.mkv"
28 # We want our audio to be pass-through, so detect what the audio of the input is encoded with, and tell handbrake to make the output match
29 AUDIO_CODEC=`avconv -i "$INPUT" 2>&1 | grep "Audio" | sed -r -e 's/.*?Audio: (\S+),.*?/\1/'`
30 if [ -z "$AUDIO_CODEC" ]; then
31 echo "-E- Unable to determine audio codec to use for the input video: $INPUT"
34 AUDIO_ENC="copy:$AUDIO_CODEC"
36 echo "-> Converting \"$INPUT\" to 1080p compressed \"$OUTPUT\" file using audio codec $AUDIO_CODEC"
38 if [[ -e "$OUTPUT" ]]; then
39 echo "-E- Output file $OUTPUT already exists. Aborting..."
51 #HandBrakeCLI -i "$INPUT" -o "$OUTPUT" -f mkv --denoise="weak" -e x264 -q $QUALITY -x b-adapt=2:rc-lookahead=120 -v 2 -E $AUDIO_ENC -a 1 -6 dpl2 --strict-anamorphic --crop 0:0:0:0 --preset="High Profile" --decomb
55 HandBrakeCLI -i "$INPUT" -o "$OUTPUT" -f mkv --denoise="weak" --deblock -e x264 -q $QUALITY -x b-adapt=2:rc-lookahead=120:deblock=1,1:subme=10:trellis=2 -v 2 -E $AUDIO_ENC -a 1 -6 dpl2 --auto-anamorphic --crop 0:0:0:0 --preset="Very Fast 1080p30" --decomb