iOS FullScreen AVCaptureSession - ios

I am developing a realtime video processing app for iOS 5. The video stream dimensions need to match the screen size of the device. I currently only have a iPhone 4 to develop against. For the iPhone 4 I set the AVCaptureSession preset to AVCaptureSessionPresetMedium:
AVCaptureSession *session = [AVCaptureSession new];
[session setSessionPreset:AVCaptureSessionPresetMedium];
The captured images (via CMSampleBufferRef) have the size of the screen.
My question: Is the assumption correct that the images captured with a session preset of AVCaptureSessionPresetMedium have the full screen device dimensions on iPhone 4s and iPad2 as well? I unfortunately cannot verify that myself.
I looked at the apple documentation:
http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVCaptureSession_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Video_Input_Presets
but I cannot find a ipad2 dimension preset of 1024/768 and would like to save me the performance penalty of resizing images in real time.
Whats the recommended path to go?

The resolution of the camera and the resolution of the screen aren't really related anymore. You say
The captured images (via CMSampleBufferRef) have the size of the
screen
but I don't think this is actually true (and it may vary by device). A medium capture on an iPad 2 and an iPhone 4s is 480x360. Note this isn't even the same aspect ratio as the screen on a phone or iPod: the camera is 4x3 but the screen is 3x2.

Related

Capture 60fps on iOS to reduce motion blur

I need to reduce motion blur in my video, so I tried every sessionPreset on AVCaptureSession to get 60fps video capture but none of them seem to work. I found a few old threads that mention the 1280 preset would work on iOS 5, but I had no success with any preset on iOS 10 (iPhone 6).
It just fails when I try to configure activeVideoMin/MaxFrameDuration to 60fps.
The queried format also says it only supports a range between 2 to 30fps.
Is there really no way to capture 60fps (or reduce video motion blur) on iOS 10?
Iphone 6 and 6 plus has tow device format. one for 1080p30 and another for 1080p60. When you set AVCaptureSessionPresetHigh it uses 1080p30.
To record vide with 60fps, iterate through AVCaptureDevice Formats, find the format you want and then set AVCaptureDevice **setActiveFormat** property instead of AVCaptureSession setSessionPreset.
https://developer.apple.com/library/content/technotes/tn2409/_index.html

CMSampleBufferRef have always same video resolution?

I' trying to capture video by AVAssetWriter and AVCaptureOutput
You can find sample project here.
The video should be in portrait mode with any resolution. The main problem that it should be in portrait mode.
I'm trying to set different setting, but in the end, video is rotated and scaled to size (1920x1080) on iPhone SE.
Is it possible to control this resolution? Or at least orientation?
Video resolution is determined by the AVCaptureSession sessionPreset. You're setting that to medium, so you're getting the resolution that comes with that. If you want a different resolution, pass a different session preset, or use AVCaptureDevice to set a specific capture format. (For a good overview of capture session presets vs device formats, go back to this WWDC13 video.)
Per this Apple Developer Q&A, you need to set an orientation on the capture connection after you start the capture session in order to get "physically" rotated frame buffers (at a capture performance cost), or set the transform property on your asset writer (so that buffers are recorded in the sensor's native orientation, but clients display it in your intended orientation).

What is the default video pixel resolution for the IPhone 5?

I am using UIImagePickerController to load the video camera but I would like the resolution to match the default camera app resolution on the IPhone.
I know the default for the 4S is
UIImagePickerControllerQualityTypeIFrame1280x720
Does anyone have the info for the other models?
Thanks

How to set up the video size so that it works on all ios devices without black bars

I'm just wondering what size the video should be so that there won't be black bars on iphone 4/5 or ipad? Any suggestion will be appreciated. Thanks!
Since the iPhone 4, iPhone 5, and iPad all have different screen aspect ratios it's impossible to have a single size of video which in full-screen mode won't have black bars on some devices.
Instead, you can use the scalingMode property of MPMoviePlayerController to keep your video zoomed in to fit the screen (assuming that's what you're using to play back your video - similar analogues exist in other video playback classes). You probably want to use the MPMovieScalingModeAspectFill scaling mode, which will fill the video to fit the screen without distorting it.

How to target both iPhone and iPad resolution on Flash CS6

I am building a small game for iOS on Flash CS6 and I want to target both iPad and iPhone resolutions, also supporting retina display if possible. I've played with the movie properties and the Air for iOS settings, but I am still in confusion about the screen resolutions. I want to make a HD (retina-enabled) game, and I want to target the non-retina models too. Which resolution should I use? (I'll be having only landscape) Should I go with 2048x1536 (iPad Retina), 1024x768 (iPad non-retina), 960x640 (iPhone/iPod touch retina), or 480x320 pixels (iPhone/iPod touch non-retina)? I've set the resolution to High in Air for iOS settings, left the default resolution (960x640) unchanged, but when I tested it on iPad 3, the resolution wasn't HD, even though my graphics were vector (made in Flash). There was also background color visible around the corners, compensating for the aspect ratio difference of iPhone and iPad. Why can be the App rendering in non-retina resolution even though I've checked it at the settings for iOS? And more importantly, what is the best approach for targeting both screen resolutions in a single app?
Thanks,
Can.
Despite iOS being a resolution dependent OS, stage resolution doesn't matter. It will look the same if the stage resolution was 240x160 or 1920x1280. The device will render the game to it's native resolution. This is why you need to set the resolution in the publish settings: so that flash knows to add support for those resolutions for iOS. Setting the stage to 960x640 should be fine for the iPhone. When it publishes for iPad on the other hand, it will be built to it's native screen resolution, but because the iPhone and iPad have different aspect ratios, the iPad will have more space on the side. Since the game will be in landscape mode, it should be ok to simply put to thick black rectangles on the top and bottom of the stage.
As for the new iPad resolution, Flash isn't powerful enough to support that resolution, it will export to the standard iPad resolution of 1024x768 even if the resolution is set to high in the publish settings.
So pick the stage resolution based off of what device you favor, if you want the app to look best on the iPad's format, go for 1024x768, but the iPhone will have extra space on the sides in landscape mode. The same goes for the iPhone resolution I explained earlier. Although, if you'd like to fully support both, you can try many methods used to position GUI elements on the vast sea of Android Screens based off the Capabilities.screenResolutionX and Capabilities.ScreenResolutionY methods in flash.

Resources