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