Skip to content

Instantly share code, notes, and snippets.

@jfsanchez91
Created August 6, 2021 10:39
Show Gist options
  • Save jfsanchez91/7325308c94e80d6164da203102471b27 to your computer and use it in GitHub Desktop.
Save jfsanchez91/7325308c94e80d6164da203102471b27 to your computer and use it in GitHub Desktop.
Bash function to convert videos to be accepted by Twitter format requirements.
#convert videos to be accepted by Twitter
function to_twitter() {
filename=$(basename -- "$1")
ext="${filename##*.}"
filename="${filename%.*}"
echo "Converting $1 to be compatible with the Twitter format."
ffmpeg -i $1 -vcodec libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p -strict experimental -r 30 -t 2:20 -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -ac 2 $filename.twitter.mp4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment