diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/decode+edit+encode | 13 | ||||
-rwxr-xr-x | bin/decode+edit+loop+encode+stream | 13 | ||||
-rwxr-xr-x | bin/encodevideo+loop+stream | 13 | ||||
-rwxr-xr-x | bin/loop+encode+stream | 13 | ||||
-rwxr-xr-x | bin/stream | 48 |
5 files changed, 57 insertions, 43 deletions
diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index 3735b2f..582b429 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -8,6 +8,14 @@ INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png OUTPUT=../tmp/omni/show0/earth.webm +## +## generic functions +## +# shellcheck disable=SC2048,SC2059 +echo_n() { + printf -- "$*" +} + HEIGHT=360 SPEED_VP8=4 @@ -29,11 +37,6 @@ elif [ $HEIGHT -le 720 ]; then # 720p → 921600 VBITRATE=3000000 fi -# shellcheck disable=SC2048,SC2059 -echo_n() { - printf -- "$*" -} - encode_vp8() { bitrate=$1; speed=$2; echo_n "-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used $speed \ -b:v $bitrate -minrate $bitrate -maxrate $bitrate \ diff --git a/bin/decode+edit+loop+encode+stream b/bin/decode+edit+loop+encode+stream index f35f593..6fe79ea 100755 --- a/bin/decode+edit+loop+encode+stream +++ b/bin/decode+edit+loop+encode+stream @@ -8,6 +8,14 @@ set -e INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png +## +## generic functions +## +# shellcheck disable=SC2048,SC2059 +echo_n() { + printf -- "$*" +} + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -54,11 +62,6 @@ elif [ $BITS -le 921600 ]; then # 720p → 921600 SPEED_VP8=15 fi -# shellcheck disable=SC2048,SC2059 -echo_n() { - printf -- "$*" -} - encode_vp8() { bitrate=$1; speed=$2; echo_n "-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used $speed \ -b:v $bitrate -minrate $bitrate -maxrate $bitrate \ diff --git a/bin/encodevideo+loop+stream b/bin/encodevideo+loop+stream index 64a53cd..a5027e2 100755 --- a/bin/encodevideo+loop+stream +++ b/bin/encodevideo+loop+stream @@ -4,6 +4,14 @@ set -e INPUT=../tmp/omni/show0/earth.yuv +## +## generic functions +## +# shellcheck disable=SC2048,SC2059 +echo_n() { + printf -- "$*" +} + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -49,11 +57,6 @@ elif [ $BITS -le 921600 ]; then # 720p → 921600 SPEED_VP8=15 fi -# shellcheck disable=SC2048,SC2059 -echo_n() { - printf -- "$*" -} - encode_vp8() { bitrate=$1; speed=$2; echo_n "-codec:v vp8 -quality realtime -deadline 1000000 -cpu-used $speed \ -b:v $bitrate -minrate $bitrate -maxrate $bitrate \ diff --git a/bin/loop+encode+stream b/bin/loop+encode+stream index ca0b6b9..6e6abb3 100755 --- a/bin/loop+encode+stream +++ b/bin/loop+encode+stream @@ -6,6 +6,14 @@ set -e INPUT=../tmp/omni/show0/earth.yuv +## +## generic functions +## +# shellcheck disable=SC2048,SC2059 +echo_n() { + printf -- "$*" +} + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -55,11 +63,6 @@ elif [ $BITS -le 921600 ]; then # 720p → 921600 SPEED_VP8=15 fi -# shellcheck disable=SC2048,SC2059 -echo_n() { - printf -- "$*" -} - encode_opus() { echo_n "-codec:a libopus -ac $ACHANNELS -ar $AFRAMERATE_OPUS -b:a $ABITRATE_OPUS" } @@ -7,10 +7,35 @@ set -eu # TODO: Externalize to site-specific configfile [ $# -gt 0 ] || set -- morla 5002 -- dvcam ../../content/icon_small.png +## +## generic functions +## exit1() { echo >&2 "ERROR: $1" exit 1 } +# shellcheck disable=SC2048,SC2059 +echo_n() { + printf -- "$*" +} +# shellcheck disable=SC2048,SC2059 +printf_each() { + skel=$1; shift + for string in $*; do + printf -- "$skel" "$string" + done +} +uniqwords() { + echo_n "$@" | tr ' ' '\012' | sort -u +} +valuedargcount() { + nonempty= + while [ $# -gt 0 ]; do + [ -z "$1" ] || nonempty=$((nonempty+1)) + shift + done + echo_n "$nonempty" +} while [ $# -gt 0 ]; do case $1 in @@ -130,29 +155,6 @@ fi [ -n "$HEIGHTS_MPEG" ] || SPEED_VP8="$SPEED_VP8_ALONE" [ -n "$HEIGHTS_WEBM" ] || SPEED_X264="$SPEED_X264_ALONE" -# shellcheck disable=SC2048,SC2059 -echo_n() { - printf -- "$*" -} -# shellcheck disable=SC2048,SC2059 -printf_each() { - skel=$1; shift - for string in $*; do - printf -- "$skel" "$string" - done -} -uniqwords() { - echo_n "$@" | tr ' ' '\012' | sort -u -} -valuedargcount() { - nonempty= - while [ $# -gt 0 ]; do - [ -z "$1" ] || nonempty=$((nonempty+1)) - shift - done - echo_n "$nonempty" -} - HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG") [ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)" |