The world needs more dog vlogs. Photo by @visuals on Unsplash

Reminder: iPhone wants H.264 encoded videos

14 October, 2021

I came over a bug where the video wouldn't play on iPhone, but worked on a Mac.

<video>
  <source
    src="flower.mp4"
    type="video/mp4"
  >
</video>

The HTML tag was valid, the video HTTP response wasn't an issue. Instead it was unsupported video encoding (which took me hours to figure out).

And here's how I made the video compatible with iPhones, using ffmpeg:

# Replace "input.mp4"
ffmpeg \
  -i input.mp4 \
  -vcodec libx264 \
  -acodec aac output.mp4

I also realized getting stuck on this problem 5 years ago 😩

Related