In mpeg-4 part 10, is the video resolution stored in a header in the video codecs or within each frame? - vlc

In mpeg-4 part 10 (AVC), is the video resolution stored in a header in the video codecs or within each frame, so that each frame can have its own resolution?
If both, which of either does main stream video players as VLC take in account when playbacking?

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

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.

View uploaded video in iOS app

I have a bunch of videos uploaded to google drive. They are in mpeg4 (avi) format I believe. I have tried everything I can think to view the video in a MPMoviePlayerViewController. In the simulator the video player launches and looks like it playing, but I don't see any video. When I run it on my device the player won't launch. I have tried to use the downloadUrl, alternateLink, embedLink and webContentLink with no success.
Is it possible to stream video from Google Drive to iOS?
The simulator isn't a full blown emulator, but just a simulator. It uses similar frameworks from Mac OS, which may have different functionality than on iOS. In other words, the simulator may have more capabilities than an actual device.
The MPMoviePlayerController class on iOS supports only a few containers and codecs, and does not support AVI.
Supported Formats
This class plays any movie or audio file supported in iOS. This
includes both streamed content and fixed-length files. For movie
files, this typically means files with the extensions .mov, .mp4,
.mpv, and .3gp and using one of the following compression standards:
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)
If you use this class to play audio files, it displays a white screen
with a QuickTime logo while the audio plays. For audio files, this
class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio
Layer 3) up to 48 kHz, stereo audio.

What is the maximum video/movie resolution for iPad 3 (retina)?

For some reason, when I try to play a video that is 1536x2048 on the ipad 3, it doesn't play the video, it just skips it. I've checked that the URL for the video is correct. I'm using MPMoviePlayerController. I tried playing the same video on an ipad also and it does the same thing. It just acts like it ignored the "play" line of code.
Is there a maximum supported video resolution then?
According to MPMoviePlayerController reference I'd say that this can answer you:
Supported Formats
This class plays any movie or audio file supported in iOS. This includes both streamed content and fixed-length files. For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:
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)
If you use this class to play audio files, it displays a white screen with a QuickTime logo while the audio plays. For audio files, this class supports AAC-LC audio at up to 48 kHz, and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

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