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: [email protected] (Jim Bankoski) 13 14if [[ $# -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 19fi 20 21f=$1 # file is first parameter 22b=$2 # bitrate is second parameter 23 24if [[ -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 --good \ 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 52else 53 # No first-pass file found, do 2-pass encode 54 aomenc \ 55 $f \ 56 -o $f-$b.av1.webm \ 57 -p 2 \ 58 --pass=1 \ 59 --fpf=$f.fpf \ 60 --good \ 61 --cpu-used=0 \ 62 --target-bitrate=$b \ 63 --auto-alt-ref=1 \ 64 -v \ 65 --minsection-pct=0 \ 66 --maxsection-pct=800 \ 67 --lag-in-frames=25 \ 68 --kf-min-dist=0 \ 69 --kf-max-dist=99999 \ 70 --static-thresh=0 \ 71 --min-q=0 \ 72 --max-q=63 \ 73 --drop-frame=0 74 75 aomenc \ 76 $f \ 77 -o $f-$b.av1.webm \ 78 -p 2 \ 79 --pass=2 \ 80 --fpf=$f.fpf \ 81 --good \ 82 --cpu-used=0 \ 83 --target-bitrate=$b \ 84 --auto-alt-ref=1 \ 85 -v \ 86 --minsection-pct=0 \ 87 --maxsection-pct=800 \ 88 --lag-in-frames=25 \ 89 --kf-min-dist=0 \ 90 --kf-max-dist=99999 \ 91 --static-thresh=0 \ 92 --min-q=0 \ 93 --max-q=63 \ 94 --drop-frame=0 \ 95 --bias-pct=50 \ 96 --minsection-pct=0 \ 97 --maxsection-pct=800 \ 98 --psnr \ 99 --arnr-maxframes=7 \ 100 --arnr-strength=3 101fi 102