Skip to content

Instantly share code, notes, and snippets.

@lisamelton
Created February 2, 2019 02:33
Show Gist options
  • Save lisamelton/faf0fc60932fdcce8338bad7e909788f to your computer and use it in GitHub Desktop.
Save lisamelton/faf0fc60932fdcce8338bad7e909788f to your computer and use it in GitHub Desktop.
A wrapper script for `transcode-video` with an experimental average variable bitrate (AVBR) ratecontrol system for the x264 encoder.
#!/bin/bash
#
# experimental-x264-avbr-transcode-video.sh
#
# Copyright (c) 2013-2019 Don Melton
#
die() {
echo "$(basename "$0"): $1" >&2
exit ${2:-1}
}
args=()
while [ "$1" ]; do
case $1 in
--encoder|--abr|--simple)
die "unsupported argument: $1"
;;
*)
args=("${args[@]}" "$1")
;;
esac
shift
done
transcode-video \
--abr \
--encoder-option '_vbv-maxrate' \
--encoder-option '_vbv-bufsize' \
--encoder-option '_nal-hrd' \
--encoder-option 'ratetol=inf' \
--encoder-option 'mbtree=0' \
"${args[@]}"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment