Skip to content

Instantly share code, notes, and snippets.

@pnettto
Created December 13, 2025 23:09
Show Gist options
  • Select an option

  • Save pnettto/7af9f449c7cfa1f4ff2a8ccebf727289 to your computer and use it in GitHub Desktop.

Select an option

Save pnettto/7af9f449c7cfa1f4ff2a8ccebf727289 to your computer and use it in GitHub Desktop.
MOV to MP4 for the web
ffmpeg -i input.mov \
-vf "scale=1000:-2,fps=24" \ # Resize to 1000px wide (even height), reduce to 24fps
-c:v libx264 \ # Encode video using H.264 (best web compatibility)
-crf 26 \ # Quality setting (higher = smaller file, good for background videos)
-preset slow \ # Better compression efficiency (smaller size, slower encode)
-pix_fmt yuv420p \ # Use widely supported pixel format (Safari / mobile safe)
-movflags +faststart \ # Move MP4 metadata to front for instant streaming playbac
output.mp4
Optional
-an \ # Remove audio track (ideal for autoplay / muted loops)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment