media-sucker/scripts/video.encode.sh

26 lines
471 B
Bash
Executable File

#! /bin/sh -e
. $(dirname $0)/common.sh
title=$(getenv title)
HandBrakeCLI \
-i DVD/VIDEO_TS \
--main-feature \
--native-language eng \
-Z "Chromecast 1080p30 Surround" \
-o "${title}.mkv" \
| while read line; do
pct=$(awk '
/^Encoding/ {
match($0, /([0-9]+) of ([0-9]+), ([0-9.]+)%/, a);
print((100 * a[1] - 100 + a[3]) / a[2]);
}
')
[ -n "$pct" ] && setenv complete "$pct"
done
mv "${title}.mkv" "$OUTDIR"
# vi: sw=2 ts=2 et ai