I have a video hosted online, and when I try to open it with Safari, it won't play (I got a crossed Play icon). When I put this video on the iCloud drive and open it with the Files app, it plays without an issue (on the same iPhone). In fact, it's a video recorded by that iPhone, exported from the Mac Photos app, and re-packaged from .mov to .mp4 so more devices should be able to play it. Is there some special format for the videos that mobile Safari can play?
-
Are you looking for an explanation of this behavior or for ways to watch these videos also in Safari?– nohillside ♦Commented Aug 30, 2020 at 7:17
-
1@nohillside I'm in control of the video, and I'd like to make it viewable in Safari. So if someone can explain to me this behavior, I should be able to find a suitable format to encode the video– UkoCommented Aug 31, 2020 at 14:26
-
I've had problems playing H.263 mp4 videos with a 10-bit color depth in Safari on macOS. Re-encoding in 8-bit color allowed the video to play.– Quinn ComendantCommented May 24, 2023 at 5:55
3 Answers
One thing to check is the location of the “moov” atom placement in the MP4 file. Since MP4 is just a wrapper, the data you show comes from the header, but all sorts of fragments of content can exist within an .mp4 file. Some software (many versions of OBS, for example) chooses to put the movie box metadata last.
Apple’s implementation of the player on iOS apparently requires the movie box metadata to be at the front of the file, after the header. This isn’t called out in the developer documentation in a place where I could find it.
moov - Movie Box: Contains other boxes with metadata for the file and media tracks
The Stack Overflow link above has a method to inspect and fix files with the moov atom at the end. There are detailed comments worthy of a fuller answer there and here.
Significant history and complexity is packed into the phrase “mp4 H.264 video” which looks like a complete match for Apple’s requirement for static video files, H.264-encoded MP4 files. Those comments and another question here surfaced the excellent blog post from OBS explaining why atom placement is relevant for correct playback on iOS and iPadOS.
MP4 is a container format, while H. 264 is a video compression codec. So to play H. 264 in Safari, you will need a video container like MP4 to host the encoded video.
Settings based on the MPEG-4 format offer a choice of two encoders: H.264 and HEVC (High-Efficiency Video Coding, also known as H.265). When you add an MPEG-4-based setting to a job, Compressor chooses the H.264 format as the default codec. You can change the codec to HEVC in the Video inspector if your computer is running macOS 10.13 or later. HEVC is a recently established compression standard that supports larger frame sizes (including 8K) and HDR10 metadata for high-dynamic-range video. HEVC playback requires a recent-generation Apple device running macOS 10.13 or later, iOS 11 or later, iPadOS 13 or later, or tvOS 11 or later.
-
1Hi Pavel, thank you for the answer. As you mentioned, H.265 requires recent devices, that's why I decided to go with H.264. And it plays on the iPhone in question when you open it from the "Files app" for example, but it won't play when opened in Safari. So it's not an issue with the possibilities of the device, but rather some limitation imposed by Safari. And I'd like to understand the limitation, so I can encode the video correctly– UkoCommented Aug 29, 2020 at 15:06
-
You’re right, limitations are not imposed by the device, Safari and Files might use different plugins. Also consider a possibility that your hosting server might be the issue, or the way you’re viewing it in Safari might be the issue (e.g. if it’s wrongly embedded, like some embedded YouTube videos don’t play on 3rd party websites).– PavelCommented Aug 29, 2020 at 15:25
-
Try viewing it in another browser and/or on another device (preferably a desktop computer) to pinpoint the issue.– PavelCommented Aug 29, 2020 at 15:26
-
We have a good answer possibly now, it’s a metadata atom that needs to be at the front of the file, instead of at the back. Even a proper encoding, proper wrapper, proper header file could lack that one detail and fail to play.– bmike ♦Commented Oct 24 at 9:52
The official Apple documentation for video content in Safari can be found in the below article https://developer.apple.com/documentation/webkit/safari_tools_and_features/delivering_video_content_for_safari
-
1How does this answer the question asked? If the information is somewhere on the linked page, please summarize it in your answer so it stands on its own and future readers don‘t need to search the answer themselves.– nohillside ♦Commented Aug 29, 2020 at 17:13
-
It relates very closely because that’s exactly what the author wants to know, as he indicted in his reply below. He wants to know the details of video encoding for playing it in Safari, and this link answers exactly this, so I posted it as a stand-alone comment for easy visual recognition, and there’s nothing to summarize because the question author wants exactly to read through the documention. Also you may consider reading the full discussion before making snap judgements.– PavelCommented Aug 29, 2020 at 19:09
-
1The objective is to get good and helpful answers to questions users have, answers which remain valid for future visitors as well. That‘s why answers should stand on their own and include the key elements of any linked page/discussion in comments.– nohillside ♦Commented Aug 30, 2020 at 7:16
-
1The article has plenty of information about the "UX" details, like autoplay, controls, low power mode. But regarding the format, it only mentions H.264 in mp4 container. This is what I have. Also, this works on a macOS Safari, but not on mobile. I have some videos, however, in a lower resolution that play on mobile Safari, but I still don't know if this is about resolution, or bitrate, or some codec details…– UkoCommented Aug 31, 2020 at 14:34