Skip to content

Instantly share code, notes, and snippets.

@odan
Created February 14, 2024 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odan/5c1a478396e02626ec1895ca5c0427b0 to your computer and use it in GitHub Desktop.
Save odan/5c1a478396e02626ec1895ca5c0427b0 to your computer and use it in GitHub Desktop.

Convert video to a Twitter-friendly format

Simple, but with minimum modification:

ffmpeg -i "input.mp4" -pix_fmt yuv420p -vcodec libx264 "output.mp4"

Resizes the video and may better support encodings:

ffmpeg -i input.mp4 -pix_fmt yuv420p -vcodec libx264 -vf scale=640:-1 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -ac 2 -strict experimental -r 30 "output.mp4" -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment