Created
July 12, 2019 22:29
-
-
Save HeyBanditoz/f69fea493572ed31b815bf6bed091171 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
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied" | |
exit 1 | |
fi | |
FPS=$2 | |
if [ -z "$2" ] | |
then | |
echo "FPS not specified! Defaulting to 30!" | |
FPS=30 | |
fi | |
MB=$3 | |
if [ -z "$3" ] | |
then | |
echo "Filesize not specified! Defaulting to 7.5!" | |
MB=7.5 | |
fi | |
echo $1 | |
LOGLEVEL=info | |
SIZE=$MB*8000 | |
DURATION=$(ffprobe -i $1 -show_entries format=duration -v quiet -of csv="p=0") | |
BITRATE=$(echo ${SIZE} / ${DURATION} | bc) | |
echo "Bitrate:" $BITRATE | |
echo "Duration": $DURATION | |
ffmpeg -hide_banner -loglevel $LOGLEVEL -y -i $1 -c:v libvpx-vp9 -row-mt 1 -b:v ${BITRATE}k -deadline good -frame-parallel 1 -vf scale=1920:1080 -tile-columns 6 -threads 15 -pass 1 -r $FPS -f webm /dev/null && \ | |
ffmpeg -hide_banner -loglevel $LOGLEVEL -i $1 -c:v libvpx-vp9 -row-mt 1 -b:v ${BITRATE}k -deadline good -frame-parallel 1 -vf scale=1920:1080 -tile-columns 6 -speed 1 -threads 15 -pass 2 -r $FPS ${1%.*}.webm | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment