diff options
-rwxr-xr-x | bin/decode+edit | 3 | ||||
-rwxr-xr-x | bin/decode+edit+encode | 28 | ||||
-rwxr-xr-x | bin/decode+edit+encode+stream | 3 | ||||
-rwxr-xr-x | bin/encode+stream | 3 |
4 files changed, 34 insertions, 3 deletions
diff --git a/bin/decode+edit b/bin/decode+edit index 6061d6b..d0fa0b4 100755 --- a/bin/decode+edit +++ b/bin/decode+edit @@ -17,4 +17,5 @@ mkdir -p $(dirname "$TMPMOVIE") ffmpeg -threads auto -y \ -f lavfi -i "movie=filename=$MOVIE:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB), scale=-1:$HEIGHT" \ -i "$LOGO" -filter_complex 'overlay=main_w-overlay_w-20:main_h-overlay_h-20' \ - -an -f yuv4mpegpipe "$TMPMOVIE" + -an \ + -f yuv4mpegpipe "$TMPMOVIE" diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode new file mode 100755 index 0000000..25ea997 --- /dev/null +++ b/bin/decode+edit+encode @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +ITERATIONS=${1-1} # no looping by default + +HEIGHT=360 +BITRATE=500000 + +MOVIE=../src/omni/show0/earth.mp4 +LOGO=../../content/icon_small.png + +TMPMOVIE=../tmp/omni/show0/earth.webm + +mkdir -p $(dirname "$TMPMOVIE") + +# 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 +ffmpeg -threads auto -y -re \ + -f lavfi -i "movie=filename=$MOVIE:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB), scale=-1:$HEIGHT" \ + -i "$LOGO" -filter_complex 'overlay=main_w-overlay_w-20:main_h-overlay_h-20' \ + -an \ + -codec:v vp8 -quality realtime -deadline realtime -cpu-used 4 \ + -b:v "$BITRATE" -minrate "$BITRATE" -maxrate "$BITRATE" \ + -undershoot-pct 95 -bufsize $((6000*BITRATE/1000)) -rc_init_occupancy $((4000*BITRATE/1000)) \ + -max-intra-rate 0 \ + -qmin 4 -qmax 56 \ + -f webm "$TMPMOVIE" diff --git a/bin/decode+edit+encode+stream b/bin/decode+edit+encode+stream index b9c9d7e..f0efc74 100755 --- a/bin/decode+edit+encode+stream +++ b/bin/decode+edit+encode+stream @@ -26,10 +26,11 @@ LOGO=../../content/icon_small.png ffmpeg -threads auto -re \ -f lavfi -i "movie=filename=$MOVIE:loop=$ITERATIONS, setpts=N/(FRAME_RATE*TB), scale=-1:$HEIGHT" \ -i "$LOGO" -filter_complex 'overlay=main_w-overlay_w-20:main_h-overlay_h-20' \ + -an \ -codec:v vp8 -quality realtime -deadline realtime -cpu-used 15 \ -b:v "$BITRATE" -minrate "$BITRATE" -maxrate "$BITRATE" \ -undershoot-pct 95 -bufsize $((6000*BITRATE/1000)) -rc_init_occupancy $((4000*BITRATE/1000)) \ -max-intra-rate 0 \ -qmin 4 -qmax 56 \ -static-thresh 500 -skip_threshold 50 \ - -an -f rtp "rtp://$IP:$PORT?pkt_size=1200" + -f rtp "rtp://$IP:$PORT?pkt_size=1200" diff --git a/bin/encode+stream b/bin/encode+stream index e23b8a1..8750c90 100755 --- a/bin/encode+stream +++ b/bin/encode+stream @@ -20,10 +20,11 @@ TMPMOVIE=../tmp/omni/show0/earth.yuv # + Drop frames, aggressively treat as static, and use fastest cpu ffmpeg -threads auto -re \ -stream_loop -1 -i "$TMPMOVIE" \ + -an \ -codec:v vp8 -quality realtime -deadline realtime -cpu-used 15 \ -b:v "$BITRATE" -minrate "$BITRATE" -maxrate "$BITRATE" \ -undershoot-pct 95 -bufsize $((6000*BITRATE/1000)) -rc_init_occupancy $((4000*BITRATE/1000)) \ -max-intra-rate 0 \ -qmin 4 -qmax 56 \ -static-thresh 500 -skip_threshold 50 \ - -an -f rtp "rtp://$IP:$PORT?pkt_size=1200" + -f rtp "rtp://$IP:$PORT?pkt_size=1200" |