What are the the video file formats supported by the iPhone OS?
Thanks
Quoting the iPhone OS Technology Overview:
iPhone OS provides support for full-screen video playback through the Media Player framework (MediaPlayer.framework). This framework supports the playback of movie files with the .mov, .mp4, .m4v, and .3gp filename extensions and using the following compression standards:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
Numerous audio formats, including the ones listed in “Audio Technologies”
For information about the classes of the Media Player framework, see Media Player Framework Reference.
The short answer is the iPhone supports H.264 video, High profile and AAC audio, in container formats .mov, .mp4, or MPEG Segment .ts. MPEG Segment files are used for HTTP Live Streaming.
For maximum compatibility with Android and desktop browsers, use H.264 + AAC in an .mp4 container.
For extended length videos longer than 10 minutes you must use HTTP Live Streaming, which is H.264 + AAC in a series of small .ts container files (see App Store Review Guidelines rule 2.5.7).
Video
On the iPhone, H.264 is the only game in town. [1]
There are several different feature tiers or "profiles" available in H.264. All modern iPhones (3GS and above) support the High profile. These profiles are basically three different levels of algorithm "tricks" used to compress the video. More tricks give better compression, but require more CPU or dedicated hardware to decode. This is a table that lists the differences between the different profiles.
[1] Interestingly, Apple's own Facetime uses the newer H.265 (HEVC) video codec. However right now (August 2017) there is no Apple-provided library that gives access to a HEVC codec to developers. This is expected to change at some point.
In talking about what video format the iPhone supports, a distinction should be made between what the hardware can support, and what the (much lower) limits are for playback when streaming over a network.
The only data given about hardware video support by Apple about the current generation of iPhones (SE, 6S, 6S Plus, 7, 7 Plus) is that they support
4K [3840x2160] video recording at 30 fps
1080p [1920x1080] HD video recording at 30 fps or 60 fps.
Obviously the phone can play back what it can record, so we can guess that 3840x2160 at 30 fps and 1920x1080 at 60 fps represent design limits of the phone. In addition, the screen size on the 6S Plus and 7 Plus is 1920x1080. So if you're interested in playback on the phone, it doesn't make sense to send over more pixels then the screen can draw.
However, streaming video is a different matter. Since networks are slow and video is huge, it's typical to use lower resolutions, bitrates, and frame rates than the device's theoretical maximum.
The most detailed document giving recommendations for streaming is TN2224 Best Practices for Creating and Deploying HTTP Live Streaming Media for Apple Devices. Figure 3 in that document gives a table of recommended streaming parameters:
This table is from May 2016.
As you can see, Apple recommends the relatively low resolution of 768x432 as the highest recommended resolution for streaming over a cellular network. Of course this is just a recommendation and YMMV.
Audio
The question is about video, but that video generally has one or more audio tracks with it. The iPhone supports a few audio formats, but the most modern and by far most widely used is AAC. The iPhone 7 / 7 Plus, 6S Plus / 6S, SE all support AAC bitrates of 8 to 320 Kbps.
Container
The audio and video tracks go inside a container. The purpose of the container is to combine (interleave) the different tracks together, to store metadata, and to support seeking. The iPhone supports
QuickTime .mov,
MP4, and
MPEG-TS.
The .mov and .mp4 file formats are closely related (.mp4 is in fact based on .mov), however .mp4 is an ISO standard that has much wider support.
As noted above, you have to use MPEG-TS for videos longer than 10 minutes.
Short answer: H.264 MPEG (MP4)
Long answer from Apple.com:
Video formats supported: H.264 video,
up to 1.5 Mbps, 640 by 480 pixels, 30
frames per second,
Low-Complexity
version of the H.264 Baseline Profile
with AAC-LC audio up to 160 Kbps,
48kHz, stereo audio in .m4v, .mp4, and
.mov file formats; H.264 video, up to
2.5 Mbps, 640 by 480 pixels, 30 frames per second,
Baseline Profile up to
Level 3.0 with AAC-LC audio up to 160
Kbps, 48kHz, stereo audio in .m4v,
.mp4, and .mov file formats; MPEG-4
video, up to 2.5 Mbps, 640 by 480
pixels, 30 frames per second,
Simple
Profile with AAC-LC audio up to 160
Kbps, 48kHz, stereo audio in .m4v,
.mp4, and .mov file formats
http://www.apple.com/iphone/specs.html
Related
When uploading an app preview to the app store submit process, I receive an unknown error MOV_RESAVE_CORRUPTED which is not documented anywhere in their uploading process.
I have captured the preview using QuickTime and had to reformat it using ffmpeg to a 30 FPS video, using this command
ffmpeg -r 30 -i preview1.mov -acodec copy -crf 12 -vf scale=886:1920,setsar=1:1 preview1-edit.mp4
The video is working fine on my local machine but upload won't work.
Frankly, the whole process is very annoying and super stressful. Hopefully I can help anyone else having this problem with this thread.
Thank you.
SOLUTION: In my case the issue was the audio encoding, used Handbrake free video tool and ensured the video specs were set to:
Video Codec (FPS) to : H.264(x264) Video Framerate (FPS) to : 30 Audio Codec to : AAC (Core Audio) Audio Mixdown to : Stereo Audio Sample rate to : 44.1 Audio Bitrate to : 256
The app preview videos are working fine now!
Create a new Preset. Set name iPhone 6.5 App Preview to recognize easily.
Select Audio Behavior. Set samplerate to 44.1, bitrate to 256. Then save it
Go to Audio tab. Then select Presets from right up corner.
Check audio samplerate and bitrate then click Start. Then upload it.
App Store Connect is very tough about video formats, only accepts H264 + AAC in mp4 or mov container, otherwise it just says (after 10 minutes): MOV_RESAVE_CORRUPTED. See details: https://help.apple.com/app-store-connect/#/dev4e413fcb8
i am new in cocos2d and facing hard time to find the best file format which is supported in cocos2d ?
and can i use ogg file format if Yes then please any link how to use it is cocos2d
No ogg on iOS. Here's the AVAudioPlayer supported audio formats list.
You also have to differentiate between background audio (streaming audio) and audio effects. For the former you should use mp3 and play only one mp3 at a time because the iOS devices can only decode one mp3 at a time using hardware. Additional mp3 are decoded with the CPU.
For audio effects uncompressed .caf and .wav files are standard. You want them to be 16-bit, mono and using a sample rate of 11, 22 or 44 kHz depending on the quality you need. Personally I would default to 22 kHz.
Here is the way to convert audio to best iOS formate: Click HERE
Open terminal and run this command:
afconvert -f caff -d LEI16 sound.wav
Any file that are supported in iPhone but for me .wav files are better.
i make iPhone web which need to play video.i use video tag for video play but that's not work in iPhone
It might be in the wrong format - this article is a very comprehensive overview of html5 video: http://camendesign.com/code/video_for_everybody
Apple say:
"The following compression standards are supported:
H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps.
Note that B frames are not supported in the Baseline profile. MPEG-4
Part 2 video (Simple Profile) AAC-LC audio, up to 48 kHz Movie files
with the extensions .mov, .mp4, .m4v, and .3gp are supported."
https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html
Right now my choice is quicktime .mov with H.264 at 30% quality.
I have a small demo video which I want to include, and file-size has the highest priority. I know H.264 is the best choice because it is hardware accelerated. But maybe there is a video format which gives about the same quality with smaller file size?
H.264 will be your format of choice. To save further bits you can use a better encoder, as QuickTime is quite inefficient. The most efficient H.264 encoders are all based on x264.
A nice x264 based open-source option with a GUI and device presets is HandBrake.
a standard mp4 is probably the most compact video out there
Just wondering what format is accepted as "the best" to have your video content on. We currently have our videos in FLV format being played by a JW Player. Are FLV's iPhone compatible or should we be encoding in another format? Thanks!
FLV video is not supported on the iPhone. H.264 should be you choice if you plan on targeting the iPhone.
If you're looking into streaming the video have a look at Apple HTTP streaming which is supported by the iPhone.
HTTP Streaming Architecture - Might need Apple ID to view it.
According to the iPhone SDK, You can use -
Media Player framework to display
full-screen video from files in either
H.264 (Baseline Profile Level 3.0)
format or MPEG-4 Part 2 video (Simple
Profile) format.
So I gather that the FLV video is not supported on the iPhone and you should encode the videos in one of these two formats. Also note that only full-screen video playback is supported on the device, with a fade-in transition to the player when video is started.