diff options
Diffstat (limited to 'bin/encodevideo+loop+stream')
-rwxr-xr-x | bin/encodevideo+loop+stream | 19 |
1 files changed, 13 insertions, 6 deletions
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 |