1. home
  2. tutorials
  3. making-a-looping-hero-video-for-your-homepage-with-ffmpeg

Making a looping hero video for your homepage with ffmpeg

Priya Raman Tutorials 1 min read 0 comments 209 views

Background videos only work if they are tiny and loop without a jump. Both are one ffmpeg command away.

The recipe

Trim to a whole number of seconds, strip audio with -an, scale to 1280 wide, and encode with a high CRF. Then crossfade the last half second into the first for a seamless loop.

  • Always strip audio with -an.
  • Use -movflags +faststart so it plays before it finishes downloading.
  • Add muted and playsinline for autoplay on phones.

$ echo "leave a comment"