diff options
-rwxr-xr-x | bin/decode+edit+encode | 4 | ||||
-rwxr-xr-x | bin/decode+edit+encodeDV | 19 | ||||
-rwxr-xr-x | bin/decode+edit+loop+encode+stream | 19 | ||||
-rwxr-xr-x | bin/encodevideo+loop+stream | 19 | ||||
-rwxr-xr-x | bin/loop+encode+stream | 20 | ||||
-rwxr-xr-x | bin/stream | 20 |
6 files changed, 71 insertions, 30 deletions
diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index 582b429..2df0a78 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -4,9 +4,13 @@ set -e +## +## defaults +## INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png OUTPUT=../tmp/omni/show0/earth.webm +RATIO=4:3 ## ## generic functions diff --git a/bin/decode+edit+encodeDV b/bin/decode+edit+encodeDV index ac64d2c..1a8bb45 100755 --- a/bin/decode+edit+encodeDV +++ b/bin/decode+edit+encodeDV @@ -4,23 +4,30 @@ set -e +## +## defaults +## INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png OUTPUT=../tmp/omni/show0/earth.dv +RATIO=4:3 HEIGHT=360 -RATIO_NUM=4 -RATIO_DEN=3 +videosize() { height=$1; width_or_ratio=$2; + case $width_or_ratio in + *:*) num=${width_or_ratio%:*}; den=${width_or_ratio#*:}; width=$((height*num/den));; + *) width=$width_or_ratio;; + esac + echo_n $((height*width)) +} + +BITS=$(videosize "$HEIGHT" "$RATIO") # * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html # + bits rounded up to include nearby modulo 16 formats # + best (i.e. high-modulo) 16:9 heights: 216 288 360 432 576 720 # + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816 -RATIO_NUM=${RATION_NUM:-16} -RATIO_DEN=${RATION_DEN:-9} -WIDTH=${WIDTH:-$((HEIGHT*RATIO_NUM/RATIO_DEN))} -BITS=$((WIDTH*HEIGHT)) if [ $BITS -le 110592 ]; then # 234p → 97344 VBITRATE=145000 elif [ $BITS -le 150528 ]; then # 270p → 129600 diff --git a/bin/decode+edit+loop+encode+stream b/bin/decode+edit+loop+encode+stream index 6fe79ea..3ebb7a1 100755 --- a/bin/decode+edit+loop+encode+stream +++ b/bin/decode+edit+loop+encode+stream @@ -5,8 +5,12 @@ set -e +## +## defaults +## INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png +RATIO=4:3 ## ## generic functions @@ -29,8 +33,15 @@ ITERATIONS=${3-0} # endless by default HEIGHT=384 -RATIO_NUM=4 -RATIO_DEN=3 +videosize() { height=$1; width_or_ratio=$2; + case $width_or_ratio in + *:*) num=${width_or_ratio%:*}; den=${width_or_ratio#*:}; width=$((height*num/den));; + *) width=$width_or_ratio;; + esac + echo_n $((height*width)) +} + +BITS=$(videosize "$HEIGHT" "$RATIO") # * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html # + bits rounded up to include nearby modulo 16 formats @@ -38,10 +49,6 @@ RATIO_DEN=3 # + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816 # * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer # TODO: Externalize speeds to site-specific configfile -RATIO_NUM=${RATION_NUM:-16} -RATIO_DEN=${RATION_DEN:-9} -WIDTH=${WIDTH:-$((HEIGHT*RATIO_NUM/RATIO_DEN))} -BITS=$((WIDTH*HEIGHT)) if [ $BITS -le 110592 ]; then # 234p → 97344 VBITRATE=145000 SPEED_VP8=2 diff --git a/bin/encodevideo+loop+stream b/bin/encodevideo+loop+stream index a5027e2..a3e3b8b 100755 --- a/bin/encodevideo+loop+stream +++ b/bin/encodevideo+loop+stream @@ -2,7 +2,11 @@ set -e +## +## defaults +## INPUT=../tmp/omni/show0/earth.yuv +RATIO=4:3 ## ## generic functions @@ -24,8 +28,15 @@ FIRSTPORT=${2:-5002} # even number - next 3 ports used too # TODO: resolve this or resize based on it HEIGHT=384 -RATIO_NUM=4 -RATIO_DEN=3 +videosize() { height=$1; width_or_ratio=$2; + case $width_or_ratio in + *:*) num=${width_or_ratio%:*}; den=${width_or_ratio#*:}; width=$((height*num/den));; + *) width=$width_or_ratio;; + esac + echo_n $((height*width)) +} + +BITS=$(videosize "$HEIGHT" "$RATIO") # * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html # + bits rounded up to include nearby modulo 16 formats @@ -33,10 +44,6 @@ RATIO_DEN=3 # + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816 # * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer # TODO: Externalize speeds to site-specific configfile -RATIO_NUM=${RATION_NUM:-16} -RATIO_DEN=${RATION_DEN:-9} -WIDTH=${WIDTH:-$((HEIGHT*RATIO_NUM/RATIO_DEN))} -BITS=$((WIDTH*HEIGHT)) if [ $BITS -le 110592 ]; then # 234p → 97344 VBITRATE=145000 SPEED_VP8=2 diff --git a/bin/loop+encode+stream b/bin/loop+encode+stream index 6e6abb3..eaf8897 100755 --- a/bin/loop+encode+stream +++ b/bin/loop+encode+stream @@ -7,6 +7,11 @@ set -e INPUT=../tmp/omni/show0/earth.yuv ## +## defaults +## +RATIO=4:3 + +## ## generic functions ## # shellcheck disable=SC2048,SC2059 @@ -30,8 +35,15 @@ ABITRATE_OPUS=48000 # TODO HEIGHT=384 -RATIO_NUM=4 -RATIO_DEN=3 +videosize() { height=$1; width_or_ratio=$2; + case $width_or_ratio in + *:*) num=${width_or_ratio%:*}; den=${width_or_ratio#*:}; width=$((height*num/den));; + *) width=$width_or_ratio;; + esac + echo_n $((height*width)) +} + +BITS=$(videosize "$HEIGHT" "$RATIO") # * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html # + bits rounded up to include nearby modulo 16 formats @@ -39,10 +51,6 @@ RATIO_DEN=3 # + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816 # * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer # TODO: Externalize speeds to site-specific configfile -RATIO_NUM=${RATION_NUM:-16} -RATIO_DEN=${RATION_DEN:-9} -WIDTH=${WIDTH:-$((HEIGHT*RATIO_NUM/RATIO_DEN))} -BITS=$((WIDTH*HEIGHT)) if [ $BITS -le 110592 ]; then # 234p → 97344 VBITRATE=145000 SPEED_VP8=2 @@ -8,6 +8,11 @@ set -eu [ $# -gt 0 ] || set -- morla 5002 -- dvcam ../../content/icon_small.png ## +## defaults +## +RATIO=4:3 + +## ## generic functions ## exit1() { @@ -113,8 +118,15 @@ HEIGHT=288 HEIGHTS_WEBM="$HEIGHT" HEIGHTS_MPEG="$HEIGHT" -RATIO_NUM=4 -RATIO_DEN=3 +videosize() { height=$1; width_or_ratio=$2; + case $width_or_ratio in + *:*) num=${width_or_ratio%:*}; den=${width_or_ratio#*:}; width=$((height*num/den));; + *) width=$width_or_ratio;; + esac + echo_n $((height*width)) +} + +BITS=$(videosize "$HEIGHT" "$RATIO") # * bitrates and bits in parens based on https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html # + bits rounded up to include nearby modulo 16 formats @@ -122,10 +134,6 @@ RATIO_DEN=3 # + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816 # * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer # TODO: Externalize speeds to site-specific configfile -RATIO_NUM=${RATION_NUM:-16} -RATIO_DEN=${RATION_DEN:-9} -WIDTH=${WIDTH:-$((HEIGHT*RATIO_NUM/RATIO_DEN))} -BITS=$((WIDTH*HEIGHT)) if [ $BITS -le 110592 ]; then # 234p → 97344 VBITRATE=145000 SPEED_X264=fast; SPEED_X264_ALONE=fast |