media-sucker/scripts/video.encode.sh

26 lines
471 B
Bash
Raw Normal View History

2022-01-06 12:31:30 -07:00
#! /bin/sh -e
2022-01-09 16:26:12 -07:00
. $(dirname $0)/common.sh
2022-01-06 12:31:30 -07:00
2022-01-09 16:26:12 -07:00
title=$(getenv title)
2022-01-06 12:31:30 -07:00
HandBrakeCLI \
-i DVD/VIDEO_TS \
--main-feature \
--native-language eng \
-Z "Chromecast 1080p30 Surround" \
2022-01-09 16:26:12 -07:00
-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
2022-01-06 12:31:30 -07:00
mv "${title}.mkv" "$OUTDIR"
# vi: sw=2 ts=2 et ai