diff options
-rwxr-xr-x | bin/decode+edit | 13 | ||||
-rwxr-xr-x | bin/decode+edit+encode | 15 | ||||
-rwxr-xr-x | bin/decode+edit+encode+stream | 8 | ||||
-rwxr-xr-x | bin/decode+edit+loop+encode+stream | 8 | ||||
-rwxr-xr-x | bin/encodevideo+loop+stream | 6 | ||||
-rwxr-xr-x | bin/loop+encode+stream | 6 |
6 files changed, 27 insertions, 29 deletions
diff --git a/bin/decode+edit b/bin/decode+edit index ed4ac8b..9a96210 100755 --- a/bin/decode+edit +++ b/bin/decode+edit @@ -4,18 +4,17 @@ set -e -HEIGHT=360 - -MOVIE=../src/omni/show0/earth.mp4 +INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png +OUTPUT=../tmp/omni/show0/earth.yuv -TMPMOVIE=../tmp/omni/show0/earth.yuv +HEIGHT=360 -mkdir -p $(dirname "$TMPMOVIE") +mkdir -p $(dirname "$OUTPUT") # + loop-in-filter trick based on http://video.stackexchange.com/a/16933 ffmpeg -threads auto -y \ - -i "$MOVIE" \ + -i "$INPUT" \ -i "$LOGO" -filter_complex 'overlay=main_w-overlay_w-20:main_h-overlay_h-20' \ -an \ - -f yuv4mpegpipe "$TMPMOVIE" + -f yuv4mpegpipe "$OUTPUT" diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index ac0ab7c..82bbc88 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -4,20 +4,19 @@ set -e -HEIGHT=360 -VBITRATE=500000 - -MOVIE=../src/omni/show0/earth.mp4 +INPUT=../src/omni/show0/earth.mp4 LOGO=../../content/icon_small.png +OUTPUT=../tmp/omni/show0/earth.webm -TMPMOVIE=../tmp/omni/show0/earth.webm +HEIGHT=360 +VBITRATE=500000 -mkdir -p $(dirname "$TMPMOVIE") +mkdir -p $(dirname "$OUTPUT") # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + scale+watermark trick based on http://stackoverflow.com/a/10937357 ffmpeg -threads auto -y -re \ - -i "$MOVIE" \ + -i "$INPUT" \ -i "$LOGO" \ -filter_complex \ "[0:v]scale=-1:$HEIGHT[bg]; @@ -29,4 +28,4 @@ ffmpeg -threads auto -y -re \ -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ -max-intra-rate 0 \ -qmin 4 -qmax 56 \ - -f webm "$TMPMOVIE" + -f webm "$OUTPUT" diff --git a/bin/decode+edit+encode+stream b/bin/decode+edit+encode+stream index 014a848..48137bf 100755 --- a/bin/decode+edit+encode+stream +++ b/bin/decode+edit+encode+stream @@ -2,6 +2,9 @@ set -e +INPUT=../src/omni/show0/earth.mp4 +LOGO=../../content/icon_small.png + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -16,14 +19,11 @@ ABITRATE=64000 HEIGHT=360 VBITRATE=500000 -MOVIE=../src/omni/show0/earth.mp4 -LOGO=../../content/icon_small.png - # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + scale+watermark trick based on http://stackoverflow.com/a/10937357 # + Drop frames, aggressively treat as static, and use fastest cpu ffmpeg -threads auto -re \ - -i "$MOVIE" \ + -i "$INPUT" \ -i "$LOGO" \ -vf \ "[0:v]scale=-1:$HEIGHT[bg]; diff --git a/bin/decode+edit+loop+encode+stream b/bin/decode+edit+loop+encode+stream index bf17f33..64495ed 100755 --- a/bin/decode+edit+loop+encode+stream +++ b/bin/decode+edit+loop+encode+stream @@ -5,6 +5,9 @@ set -e +INPUT=../src/omni/show0/earth.mp4 +LOGO=../../content/icon_small.png + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -19,15 +22,12 @@ ITERATIONS=${3-0} # endless by default HEIGHT=360 VBITRATE=500000 -MOVIE=../src/omni/show0/earth.mp4 -LOGO=../../content/icon_small.png - # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + loop-in-filter trick based on http://video.stackexchange.com/a/16933 # + scale+watermark trick based on http://stackoverflow.com/a/10937357 # + Drop frames, aggressively treat as static, and use fastest cpu ffmpeg -threads auto -re \ - -f lavfi -i "movie=filename=$MOVIE:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB)" \ + -f lavfi -i "movie=filename=$INPUT:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB)" \ -i "$LOGO" \ -filter_complex \ "[0:v]scale=-1:$HEIGHT[bg]; diff --git a/bin/encodevideo+loop+stream b/bin/encodevideo+loop+stream index 67e14d5..bb4f581 100755 --- a/bin/encodevideo+loop+stream +++ b/bin/encodevideo+loop+stream @@ -2,6 +2,8 @@ set -e +INPUT=../tmp/omni/show0/earth.yuv + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -13,12 +15,10 @@ FIRSTPORT=${2:-5002} # even number - next 3 ports used too VBITRATE=500000 -TMPMOVIE=../tmp/omni/show0/earth.yuv - # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + Drop frames, aggressively treat as static, and use fastest cpu ffmpeg -threads auto -re \ - -stream_loop -1 -i "$TMPMOVIE" \ + -stream_loop -1 -i "$INPUT" \ -an \ -pix_fmt yuv420p \ -codec:v vp8 -quality realtime -deadline realtime -cpu-used 15 \ diff --git a/bin/loop+encode+stream b/bin/loop+encode+stream index 0f29ed1..f8403dd 100755 --- a/bin/loop+encode+stream +++ b/bin/loop+encode+stream @@ -4,6 +4,8 @@ set -e +INPUT=../tmp/omni/show0/earth.yuv + HOST=${1:-morla} if [ "$HOST" = "$(hostname --short)" ]; then IP=127.0.0.1 @@ -17,12 +19,10 @@ ABITRATE=64000 VBITRATE=500000 -TMPMOVIE=../tmp/omni/show0/earth.yuv - # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming # + Drop frames, aggressively treat as static, and use fastest cpu ffmpeg -threads auto -re \ - -stream_loop -1 -i "$TMPMOVIE" \ + -stream_loop -1 -i "$INPUT" \ -codec:a libopus -ac 2 -b:a "$ABITRATE" -ar 48000 \ -vn \ -f rtp "rtp://$IP:$FIRSTPORT?pkt_size=1200" \ |