media-sucker/scripts/video.encode.sh

25 lines
435 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 \
2022-01-09 19:50:31 -07:00
--json \
2022-01-06 12:31:30 -07:00
-i DVD/VIDEO_TS \
--main-feature \
--native-language eng \
-Z "Chromecast 1080p30 Surround" \
2022-01-09 16:26:12 -07:00
-o "${title}.mkv" \
2022-01-09 19:50:31 -07:00
2>/dev/null \
| sed 's/^[A-Za-z]*: //' \
| sed '/^[A-Z]/ d' \
| jq --unbuffered '(.Working.Progress // 0) * 100' \
| while read pct; do
setenv complete "$pct"
2022-01-09 16:26:12 -07:00
done
2022-01-06 12:31:30 -07:00
mv "${title}.mkv" "$OUTDIR"
# vi: sw=2 ts=2 et ai