scripts/webmenc
2020-06-14 21:48:19 -04:00

21 lines
704 B
Bash
Executable File

#!/usr/bin/env bash
source $(dirname $0)/lib/argparse || exit 1
argparse "$@" <<EOF || exit 1
parser.add_argument('infile')
parser.add_argument('-v', '--video-bitrate', type=int,
help='Video bitrate in kbps')
parser.add_argument('-a', '--audio-bitrate', default=32, type=int,
help='Audio bitrate in kbps')
EOF
CRF=30
ffmpeg -i "${INFILE}" -y -b:v "${VIDEO_BITRATE}k" \
-quality good -crf $CRF -c:v libvpx-vp9 -an \
-pass 1 -speed 4 -f webm /dev/null &&\
ffmpeg -i "${INFILE}" -y -b:v "${VIDEO_BITRATE}k" -auto-alt-ref 1 -lag-in-frames 25 \
-quality good -crf $CRF -c:v libvpx-vp9 -c:a libopus -b:a ${AUDIO_BITRATE}k \
-pass 2 -speed 1 "${INFILE}.webm"