Skip to content

Instantly share code, notes, and snippets.

@geta6
Created December 19, 2012 06:30
Show Gist options
  • Save geta6/4334830 to your computer and use it in GitHub Desktop.
Save geta6/4334830 to your computer and use it in GitHub Desktop.
末尾がmp4でないファイルを探索、最新のものを一つ選択してエンコードします 既に動作中のエンコーダインスタンスがあれば無視します
#!/bin/zsh
if [ 0 = `ps ax | grep HandBrake | grep -v grep | wc -l` ]; then
TARGET=`find /media/var/Movies -type f | grep -vE '*.mp4$' | sort -n | head -n 1`
if [ ! -z $TARGET ]; then
DEST=`echo $TARGET | sed -e 's/\..*\?$/\.mp4/g'`
HandBrakeCLI -i "$TARGET" -o "$DEST" \
-e x264 -r 24 -X 1280 --denoise="weak" -5 -O -m -2 -T \
-E faac -B 128 -R Auto -6 dpl2 \
-x level=31:bframes=0:cabac=0:keyint=250:min-keyint=25:\
merange=24:subq=6:ref=8:mixed-refs=1:qcomp=0.6:vbv-maxrate=1500:vbv-bufsize=2000:\
analyse=all:threads=0:me=umh:no-fast-pskip=1:deblock=-2,-2:no-dct-decimate=1:\
non-deterministic=1:weightb=0:8x8dct=0:cqm=flat:aq-strength=0:psy-rd=0,0
rm "$TARGET"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment