After a few experiments, I’ve found that it’s necessary to be specific about which profile you’re using when encoding 4K video for delivery over the web. It specifically requires High Profile, Level 4.2. Any lower than that and 4K video won’t play in Safari. It might play if stored on the device, but other apps like iMovie and Photos seem to baulk at it too.
Doing this is fairly simple. As an extremely simplistic example:
ffmpeg -i inputfile.mp4 -c:v libx264 output.mp4
ffmpeg -i inputfile.mp4 -c:v libx264 -profile high -level 4.2 output.mp4
Output from the first command doesn’t play, output from the second command does.