Last active
April 27, 2021 16:55
-
-
Save kravemir/12ef1644c2e71feb2a91ad15fcb029b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [ "$#" -ne 1 ] | |
then | |
echo "Usage: convert-video.sh input-video" | |
exit 1 | |
fi | |
INPUT_FILE="$1" | |
OUTPUT_FILE="${INPUT_FILE%.*}.WEBM" | |
LOG_FILE="${INPUT_FILE%.*}.WEBM.LOG" | |
CRF=1 | |
BITRATE=9200k | |
MINRATE=4800k | |
MAXRATE=14000k | |
( | |
echo "INPUT_FILE: ${INPUT_FILE}" | |
echo "OUTPUT_FILE: ${OUTPUT_FILE}" | |
echo "LOG_FILE: ${LOG_FILE}" | |
echo | |
echo "CRF: ${CRF}" | |
echo | |
echo "BITRATE: ${BITRATE}" | |
echo "MINRATE: ${MINRATE}" | |
echo "MAXRATE: ${MAXRATE}" | |
echo | |
) | tee "${LOG_FILE}" | |
ffmpeg -n -i "${INPUT_FILE}" \ | |
-c:v libvpx-vp9 -b:v "${BITRATE}" -minrate "${MINRATE}" -maxrate "${MAXRATE}" -crf "${CRF}" -g 240 -pass 1\ | |
-auto-alt-ref 1 -lag-in-frames 25\ | |
-row-mt 1 -threads 8 \ | |
-speed 4\ | |
-an -f null /dev/null \ | |
2> >(tee -a "${LOG_FILE}") | |
ffmpeg -n -i "${INPUT_FILE}" \ | |
-c:v libvpx-vp9 -b:v "${BITRATE}" -minrate "${MINRATE}" -maxrate "${MAXRATE}" -crf "${CRF}" -g 240 -pass 2 \ | |
-auto-alt-ref 1 -lag-in-frames 25\ | |
-row-mt 1 -threads 8\ | |
-speed 2\ | |
-c:a libopus \ | |
-map_metadata 0 \ | |
"${OUTPUT_FILE}" \ | |
2> >(tee -a "${LOG_FILE}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [ "$#" -ne 1 ] | |
then | |
echo "Usage: convert-video.sh input-video" | |
exit 1 | |
fi | |
INPUT_FILE="$1" | |
OUTPUT_FILE="${INPUT_FILE%.*}.WEBM" | |
LOG_FILE="${INPUT_FILE%.*}.WEBM.LOG" | |
CRF=10 | |
BITRATE=5200k | |
MINRATE=2000k | |
MAXRATE=8400k | |
( | |
echo "INPUT_FILE: ${INPUT_FILE}" | |
echo "OUTPUT_FILE: ${OUTPUT_FILE}" | |
echo "LOG_FILE: ${LOG_FILE}" | |
echo | |
echo "CRF: ${CRF}" | |
echo | |
echo "BITRATE: ${BITRATE}" | |
echo "MINRATE: ${MINRATE}" | |
echo "MAXRATE: ${MAXRATE}" | |
echo | |
) | tee "${LOG_FILE}" | |
ffmpeg -n -i "${INPUT_FILE}" \ | |
-c:v libvpx-vp9 -b:v "${BITRATE}" -minrate "${MINRATE}" -maxrate "${MAXRATE}" -crf "${CRF}" -g 240 -pass 1\ | |
-auto-alt-ref 1 -lag-in-frames 25\ | |
-row-mt 1 -threads 8 \ | |
-speed 4\ | |
-an -f null /dev/null \ | |
2> >(tee -a "${LOG_FILE}") | |
ffmpeg -n -i "${INPUT_FILE}" \ | |
-c:v libvpx-vp9 -b:v "${BITRATE}" -minrate "${MINRATE}" -maxrate "${MAXRATE}" -crf "${CRF}" -g 240 -pass 2 \ | |
-auto-alt-ref 1 -lag-in-frames 25\ | |
-row-mt 1 -threads 8\ | |
-speed 2\ | |
-c:a libopus \ | |
-map_metadata 0 \ | |
"${OUTPUT_FILE}" \ | |
2> >(tee -a "${LOG_FILE}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment