Play hi-res (2048x1536) video on the new iPad retina

I am wondering if there is a way to play resolutoion retina video (2048x1536) for iPad. I am developing an application that can play full-screen video using MPMoviePlayerController but cannot play videos with iPad retina resolution. From the documentation:

Supported formats This class supports any movie or audio file in iOS. This includes both streaming content and fixed-length files. For movie files, this usually means files with the extensions .mov, .mp4, .mpv and .3gp and using one of the following standard compression:

H.264 Initial 3.0 video level profile, up to 640 x 480 at 30 frames per second. (The basic 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 the QuickTime logo during audio playback. For audio files, this class supports AAC-LC audio at frequencies up to 48 kHz and MP3 (MPEG-1 Audio Layer 3) up to 48 kHz, stereo audio.

This is not true!!! I can play H.264 video (960x640) on iPhone and 1024x768 video on ipad ...

So: How can I play retina resolution videos of the iPad? Is it possible? Are there other ways to play videos in iOS apps without MPMoviePlayerController?

+6
source share
2 answers

According to my tests, you can play files at 2048x1536 on the iPads retina using H264 encoding. The trick is Handbrake (or FFMPEG) to generate a file with these settings . On this page you will find some 1536p video files that you can use to test playback with this resolution.

By the way, the good thing that I propose when processing local videos is to embed only video with a resolution of "semi-retina". By the semi-grid, I mean 1536x1152 . This gives a little more information than resolution without a retina, so video is a little better on mesh iPads. And it's good and small enough to play on any iOS device older than the iPhone 3GS. Therefore, you only need to enable one video for all devices .

+2
source

The iPhone Retina is capable of displaying 1080p video content. This format is compatible with various resolutions, but most often it is defined as 1920 x 1080. This is also the size of a video with a built-in camera, so it can be played back even more than indicated in the documentation. allowable size.

I was able to verify this with the following code. Create a basic project with one view and add the video file to the group of supporting files.

ViewController.h

#import <UIKit/UIKit.h> #import <MediaPlayer/MediaPlayer.h> @interface CDTViewController : UIViewController{ MPMoviePlayerController *moviePlayer; } -(IBAction) playMovie; @end 

ViewController.m

 @implementation CDTViewController - (void)viewDidLoad { [super viewDidLoad]; } -(void)playMovie { NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"IMG_3803" ofType:@"MOV"]]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; if ([moviePlayer respondsToSelector:@selector(loadState)]) { [moviePlayer setControlStyle:MPMovieControlStyleEmbedded]; [moviePlayer setFullscreen:NO]; [moviePlayer prepareToPlay]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerLoadStateDidChange:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil]; } } - (void)moviePlayerLoadStateDidChange:(NSNotification *)notification { if ([moviePlayer loadState] == MPMovieLoadStateStalled) { //handle stall } else if([moviePlayer loadState] != MPMovieLoadStateUnknown) { [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerLoadStateDidChangeNotification object:nil]; [[moviePlayer view] setFrame:self.view.bounds]; [[self view] addSubview:[moviePlayer view]]; [moviePlayer play]; } } @end 

Do not forget to add the MediaPlayer.framework project to the project. This example assumes a play button in an xib file that has this: s touchUpInside event attached to playMovie IBAction.

+1
source

Source: https://habr.com/ru/post/924791/


All Articles