Skip to content

Instantly share code, notes, and snippets.

@nanmu42
Last active May 16, 2019 05:00
Show Gist options
  • Save nanmu42/a1e41028e876c4c911d0439cb0b07dfb to your computer and use it in GitHub Desktop.
Save nanmu42/a1e41028e876c4c911d0439cb0b07dfb to your computer and use it in GitHub Desktop.
ffmpeg compressing video for web browser
#!/usr/bin/env bash
# preset veryslow: more time for more compressing rate
# -movflags +faststart optimizes for web browser so video can be played sooner.
# crf: small = better quality + bigger size; sane option between 17–28
SRC="$1"
CRF="$2"
ffmpeg -i "$SRC" -vcodec libx264 -crf "$CRF" -movflags +faststart -preset veryslow -profile:v high -level 4.1 web_libx264_crf_${CRF}_faststart_veryslow.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment