diff options
author | Jonas Smedegaard <dr@jones.dk> | 2017-05-18 09:39:53 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2017-05-18 09:39:53 +0200 |
commit | cdbf4dee39cdd3dc083299d88d619effc1e72e14 (patch) | |
tree | 9b075856b46cdb4a764791c3d9e2afaa0fdc704b /bin/decode+edit+encode | |
parent | 39bc48eb0e8b9a2b8d43d6f1a612c12d0c70ae23 (diff) |
Generalize encodings as functions.
Diffstat (limited to 'bin/decode+edit+encode')
-rwxr-xr-x | bin/decode+edit+encode | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/decode+edit+encode b/bin/decode+edit+encode index deb732a..0b11a7e 100755 --- a/bin/decode+edit+encode +++ b/bin/decode+edit+encode @@ -29,6 +29,14 @@ elif [ $HEIGHT -le 720 ]; then # 720p → 921600 VBITRATE=3000000 fi +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 \ + -undershoot-pct 95 -bufsize $((6000*bitrate/1000)) -rc_init_occupancy $((4000*bitrate/1000)) \ + -max-intra-rate 0 \ + -qmin 4 -qmax 56" +} + mkdir -p $(dirname "$OUTPUT") # based on http://www.webmproject.org/docs/encoder-parameters/#real-time-cbr-encoding-and-streaming @@ -42,9 +50,5 @@ ffmpeg -hide_banner -threads auto -y -re \ "[0:v]format=pix_fmts=yuv420p,scale=iw*sar*$HEIGHT/ih:$HEIGHT,setsar=1[bg]; [bg][1:v]overlay=main_w-overlay_w-20:main_h-overlay_h-20[v]" \ -map '[v]' \ - -codec:v vp8 -quality realtime -deadline 1000000 -cpu-used "$SPEED_VP8" \ - -b:v "$VBITRATE" -minrate "$VBITRATE" -maxrate "$VBITRATE" \ - -undershoot-pct 95 -bufsize $((6000*VBITRATE/1000)) -rc_init_occupancy $((4000*VBITRATE/1000)) \ - -max-intra-rate 0 \ - -qmin 4 -qmax 56 \ + $(encode_vp8 "$VBITRATE" "$SPEED_VP8") \ -f webm "$OUTPUT" |