Skip to content

Instantly share code, notes, and snippets.

@maxwofford
Created May 29, 2020 03:25
Show Gist options
  • Save maxwofford/a763d4bf99623ddd721c1ecdc82c7ec4 to your computer and use it in GitHub Desktop.
Save maxwofford/a763d4bf99623ddd721c1ecdc82c7ec4 to your computer and use it in GitHub Desktop.

Ideal vp9 encoding:

ffmpeg -i <source> -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 1 -speed 4 \
  -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 \
  -g 9999 -aq-mode 0 -an -f webm /dev/null


ffmpeg -i <source> -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 1 -speed 0 \
  -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 \
  -g 9999 -aq-mode 0 -c:a libopus -b:a 64k -f webm out.webm

MP4 encoding:

ffmpeg -i <source> -c:v libx264 -an -preset veryslow -b:v 1000K -threads 3 -movflags +faststart mp4 out.mp4

Ideal 2pass mp4 encoding:

ffmpeg -y -i <source> -c:v libx264 -b:v 2600k -pass 1 -an -f mp4 -preset veryslow /dev/null && \
ffmpeg -i <source> -c:v libx264 -b:v 2600k -pass 2 -an -f mp4 -preset veryslow output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment