Problem Merge Audio To Video on iPhone 5s - ios

I Merge Audio File To Video, That's works well on Other devices but except iPhone 5s,5. The error is :
Error Domain=AVFoundationErrorDomain Code=-11822 "Cannot Open" UserInfo={NSLocalizedFailureReason=This media format is not supported., NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x600003c0a2e0 {Error Domain=NSOSStatusErrorDomain Code=-16976 "(null)"}}
video file is mp4 type and resolution is 1920*1080

Transferring and playing MP4 on iPhone 5S is usually smooth for many users. However, due to the codec, video size and resolution issue, you may have difficulty in playing MP4 on iPhone 5S or 5C. You may encounter the following symptoms when trying to play MP4 on iPhone 5S:
MP4 files cannot be added to iTunes thus cannot be transferred to iPhone 5S for play.
MP4 files can be added to iTunes but when syncing with your iPhone 5S, iTunes pops up a message: “movie was not copied to the iPhone 5S because it cannot be played on this iPhone 5S”.
iPhone 5S MP4 no audio: No audio or sound when you play MP4 on iPhone 5S
iPhone 5S MP4 no video: No video or image when you play MP4 on iPhone 5S
iPhone 5S cannot read and play some MP4 file
In order to successfully play MP4 files on iPhone 5S, MP4 files shall meet the following requirements:
H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio;
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.
Your iPhone 5S will not recognize the MP4 files if they don’t match the above requirements.

Related

How to pick proper video dimension based on device resolution

We've a demo video provided by design team with three different dimension (1024*768), (2048*1536) and (2732, 2048). I'm trying to pick proper video based on current device resolution (supported format).
For eg: If it its first generation iPad its resolution is (1024 * 768) it can play video format upto 720p more than that it will not play, likewise iPad3 (Retina) resolution is (2048 * 1536) but it can play video format upto 1080p. Similar iPad pro I guess it will play upto 4k videos.
I afraid system will not pick proper video on its own if we name it to 1x, 2x or 3x like in image.
If we are passing high dimension video to low resolution devices it is not playing. So what is the general approach in iOS to pick proper video based on its support format.
If you did have the option to stream from a server then HLS streaming and the media player would take care of selecting the best bit rate for the device and the current network conditions.
If not then, as far as I am aware, iOS does not support different video resolutions in the same way it does images as you note above.
You can still do this yourself by querying the device resolution and choosing the appropriate video at run time based on the result. To query the screen size:
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
See here for the source of the above and for handling split screen mode: https://stackoverflow.com/a/5678199/334402
You will have to include multiple versions of your videos which will increase you bundle size, but, again, if you could stream instead you would avoid this.
To find a particular devices capabilities takes a little effort.
Firstly, you will commonly see quoted the general iOS video support information that apple provides:
iOS supports many industry-standard video formats and compression standards, including the following:
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, 48 kHz, 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, 48 kHz, 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, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
Numerous audio formats, including the ones listed in Audio Technologies
As you point out, however, this is not the full story as different devices have different capabilities. To find the video supported for a particular devices you need to look at the info on the device tech specs page here: https://support.apple.com/specs/
For example for a first generation iPad it shows:
TV and video
Support for 1024 by 768 pixels with Dock Connector to VGA Adapter; 576p and 480p with Apple Component AV Cable; 576i and 480i with Apple Composite AV Cable
H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps per channel, 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; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format
And for iPad 5th generation it shows:
TV and Video
AirPlay Mirroring, photos, audio, and video out to Apple TV (2nd generation or later)
Video mirroring and video out support: Up to 1080p through Lightning Digital AV Adapter and Lightning to VGA Adapter (adapters sold separately)
Video formats supported: H.264 video up to 4K, 30 frames per second, High Profile level 4.2 with AAC‑LC audio up to 160 Kbps, 48kHz, stereo audio or Dolby Audio up to 1008 Kbps, 48kHz, stereo or multichannel 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 per channel, 48kHz, stereo audio or Dolby Audio up to 1008 Kbps, 48kHz, stereo or multichannel audio, in .m4v, .mp4, and .mov file formats; Motion JPEG (M‑JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format
To actually detect the device there seems to be some discussion around the best way, but it looks like someone is keeping this approach here more or less up to date: https://stackoverflow.com/a/10481095/334402 (it includes up to iPad 4 and iPhone 6 at the time of writing)
I created a working solution for this problem by embedded m4v video data inside a PNG and then decoding and resaving the .m4v file in the tmp dir on device. Have a peek at this SO answer for details: https://stackoverflow.com/a/56383999/763355

-11855 error code when using AVFoundation with high res video. What resolution should I use?

Using react-native-video to play a simple video it fails at resolutions greater than 1024x768 on older devices (ipad 2, ipad 3rd gen (A1416)) with the error below.
{
"target": 4,
"error": {
"code": -11855,
"domain": "AVFoundationErrorDomain"
}
}
I can't find this error in the list of AVFoundation error constants. It stops at -11852.
I have found through testing that the maximum resolution I can use on 2nd or 3rd gen ipads is 1024x768, but I can't find this documented anywhere. An ipad mini 2 can play video at 2048x2048 without trouble.
What resolution can I use that will work with all iPads?
Can I display different media like 1x and 2x images on iPads that have different capabilities?
iPad 2 has the following specifications:
Video formats supported:
H.264 video up to 1080p, 30 frames per second, High Profile level 4.1
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 per channel, 48kHz,
stereo audio in .m4v, .mp4, and .mov file formats;
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames
per second, audio in ulaw, PCM stereo audio in .avi file format
Source: https://support.apple.com/kb/sp622?locale=en_GB
iPad 3 has the following specifications:
Video formats supported:
H.264 video up to 1080p, 30 frames per second, High Profile level 4.1
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 per channel, 48kHz,
stereo audio in .m4v, .mp4, and .mov file formats;
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per
second, audio in ulaw, PCM stereo audio in .avi file format
Source: https://support.apple.com/kb/sp647?locale=en_GB
As you can see, it doesn't support resolution greater than 1080p i.e. 1920 by 1080 so 2048 by 2048 won't work.
-18555 error description is in file AVError.h (https://developer.apple.com/reference/avfoundation/averror/averrorundecodablemediadata)
AVErrorUndecodableMediaData NS_AVAILABLE(10_10, 8_0) = -11855,
Though there is not enough description given to give a concrete conclusion but from the name we can say that it means it cannot decode the video as it's beyond device capability.

Unable to play higher resolution video on some iPads

I'm trying to play a video using MPMoviePlayerController. On some iPads, the video plays, on other iPads it does not.
Here is the code:
NSURL *url = [NSURL fileURLWithPath:[self videoPath]];
self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:url];
self.moviePlayerController.view.frame = self.view.bounds;
self.moviePlayerController.repeatMode = MPMovieRepeatModeOne;
self.moviePlayerController.controlStyle = MPMovieControlStyleNone;
[self.moviePlayerController prepareToPlay];
... add to subview, play ...
MPMoviePlayerController lists the following compression restrictions:
H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps.
(The Baseline profile does not support B frames.)
MPEG-4 Part 2 video (Simple Profile)
Originally, we were using H.264 at a higher resolution and the video worked with some our testers. Unfortunately, I was unable to get the video to play on my iPad (4th Generation). We kept the existing resolution and tried MPEG-4 Part 2 video but again, the video did not work. The only way we could get the video to work reliably was drastically reducing the resolution down to 480 x 640. The result looks horrible.
I added the notifications to monitor the load state and for the videos that failed to work, the modes would go from MPMovieLoadStateUnknown to MPMovieLoadStatePlayable back to MPMovieLoadStateUnknown. The videos that worked fine would go from MPMovieLoadStateUnknown to MPMovieLoadStatePlayable to MPMovieLoadStatePlayable|MPMovieLoadStatePlaythroughOK.
I checked the errorLogs and accessLogs and they were both empty.
Any thoughts on what I might check next in order to get the higher resolution video to work on the iPads?
Okay, so Apple's MPMoviePlayerController documentation is a bit out of date. I referred to each iPad's technical specs and it revealed the source of the issue:
Video formats supported: H.264 video up to 1080p, 30 frames per
second, High Profile level 4.1 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 per channel, 48kHz, stereo
audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to
35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM
stereo audio in .avi file format
I was using videos at a higher resolution than 1080p using H.264 compression, and MPEG-4 higher than the supported resolution. Once we lowered the resolution everything worked perfectly.

MP4 playback issue on iPad

I played 320x180 resolution mp4 file (video encoded using h264 baseline profile) on iPad mini which has iOS 6.1.3 with default video player. I observed that green strip is coming at the bottom while playback (screen shot attached below).
Later I played same 320x180 mp4 file on iPad mini which has iOS 7.0.4. The video was playing fine. Same 320x180 mp4 file playing fine on MAC also.
Can I know why I am getting green strip at the bottom while playing mp4 file on iPad mini which is having iOS 6.1.3?

Can we play .flv files in html5 video tags in ipad?

We currently have a system working on chrome,ie7 and mozilla. We have jwplayer that plays .flv videos on these browsers. We have now to support the play of videos in ipad. Will it be possible if we upgrade the jwplayer to version 5 which supports html5 video tags. Will html5 video tags in ipad be able to support play of .flv files?
The jwplayer works fine on the iPad but you will need another video type for ipad support. The iPad will not play FLV file types, as shown on the iPad Video specs page:
Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 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 per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

Resources