Tom Finegan | 9007d34 | 2017-12-14 07:47:13 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2016, Alliance for Open Media. All rights reserved |
| 4 | # |
| 5 | # This source code is subject to the terms of the BSD 2 Clause License and |
| 6 | # the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 7 | # was not distributed with this source code in the LICENSE file, you can |
| 8 | # obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 9 | # Media Patent License 1.0 was not distributed with this source code in the |
| 10 | # PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
| 11 | # |
| 12 | # Author: jimbankoski@google.com (Jim Bankoski) |
| 13 | |
| 14 | if [[ $# -ne 2 ]]; then |
| 15 | echo "Encodes a file using best known settings (slow!)" |
| 16 | echo " Usage: be [FILE] [BITRATE]" |
| 17 | echo " Example: be akiyo_cif.y4m 200" |
| 18 | exit |
| 19 | fi |
| 20 | |
| 21 | f=$1 # file is first parameter |
| 22 | b=$2 # bitrate is second parameter |
| 23 | |
| 24 | if [[ -e $f.fpf ]]; then |
| 25 | # First-pass file found, do second pass only |
| 26 | aomenc \ |
| 27 | $f \ |
| 28 | -o $f-$b.av1.webm \ |
| 29 | -p 2 \ |
| 30 | --pass=2 \ |
| 31 | --fpf=$f.fpf \ |
| 32 | --best \ |
| 33 | --cpu-used=0 \ |
| 34 | --target-bitrate=$b \ |
| 35 | --auto-alt-ref=1 \ |
| 36 | -v \ |
| 37 | --minsection-pct=0 \ |
| 38 | --maxsection-pct=800 \ |
| 39 | --lag-in-frames=25 \ |
| 40 | --kf-min-dist=0 \ |
| 41 | --kf-max-dist=99999 \ |
| 42 | --static-thresh=0 \ |
| 43 | --min-q=0 \ |
| 44 | --max-q=63 \ |
| 45 | --drop-frame=0 \ |
| 46 | --bias-pct=50 \ |
| 47 | --minsection-pct=0 \ |
| 48 | --maxsection-pct=800 \ |
| 49 | --psnr \ |
| 50 | --arnr-maxframes=7 \ |
| 51 | --arnr-strength=3 \ |
| 52 | --arnr-type=3 |
| 53 | else |
| 54 | # No first-pass file found, do 2-pass encode |
| 55 | aomenc \ |
| 56 | $f \ |
| 57 | -o $f-$b.av1.webm \ |
| 58 | -p 2 \ |
| 59 | --pass=1 \ |
| 60 | --fpf=$f.fpf \ |
| 61 | --best \ |
| 62 | --cpu-used=0 \ |
| 63 | --target-bitrate=$b \ |
| 64 | --auto-alt-ref=1 \ |
| 65 | -v \ |
| 66 | --minsection-pct=0 \ |
| 67 | --maxsection-pct=800 \ |
| 68 | --lag-in-frames=25 \ |
| 69 | --kf-min-dist=0 \ |
| 70 | --kf-max-dist=99999 \ |
| 71 | --static-thresh=0 \ |
| 72 | --min-q=0 \ |
| 73 | --max-q=63 \ |
| 74 | --drop-frame=0 |
| 75 | |
| 76 | aomenc \ |
| 77 | $f \ |
| 78 | -o $f-$b.av1.webm \ |
| 79 | -p 2 \ |
| 80 | --pass=2 \ |
| 81 | --fpf=$f.fpf \ |
| 82 | --best \ |
| 83 | --cpu-used=0 \ |
| 84 | --target-bitrate=$b \ |
| 85 | --auto-alt-ref=1 \ |
| 86 | -v \ |
| 87 | --minsection-pct=0 \ |
| 88 | --maxsection-pct=800 \ |
| 89 | --lag-in-frames=25 \ |
| 90 | --kf-min-dist=0 \ |
| 91 | --kf-max-dist=99999 \ |
| 92 | --static-thresh=0 \ |
| 93 | --min-q=0 \ |
| 94 | --max-q=63 \ |
| 95 | --drop-frame=0 \ |
| 96 | --bias-pct=50 \ |
| 97 | --minsection-pct=0 \ |
| 98 | --maxsection-pct=800 \ |
| 99 | --psnr \ |
| 100 | --arnr-maxframes=7 \ |
| 101 | --arnr-strength=3 \ |
| 102 | --arnr-type=3 |
| 103 | fi |