I need a full screen portrait video like the following:
What should my export settings be in Adobe After Effects. I know that iPad supports h.264 and up to 640x480. But I need it to fill the 1024x768 in portrait mode. As long as I get the final video looking just as it does in the screenshot is all that matters (meaning no black bars on the sides or anything, just fullscreen video).
The iPad will happily play 720x1280 h.264 video.
So, in your situation, you should be able to render your video out at a width of 768 pixels, and with a corresponding vertical size that matches your video's aspect ratio correctly.
Related
I am using AVFoundation for my camera app. I am using live video frames to grab picture using AVCaptureVideoDataOutput.
Right now i do filter all supported formats for device and then pick highest supported resolution for format.
So for example i do get 4032*3024 resolution supported format on iPhone 8/7 which i am using as active format. i do filter from videoSupportedFramRateRanges.
I would like to know how i can render video with 4:3 resolution so i can see black bars on side of camera.
I did play with AVCaptureVideoPreviewlayer properties and found that if i use resizeAspectFill it shows camera full screen but if i just dont assign then it adds black bars on side. (I assume .resize is default property) but i am not sure whether this is right approach to show/hide black bars.
In my opinion this is working because currently i am picking highest supported resolution format which in this case is 4032*3024 due to which its working since its 4:3 aspect ratio.
Basically i want make sure i show video in 4:3 format size view in some scenario with black bars and in some scenario full screen which i am already doing.
Open questions
Is there any way i can make sure i can show always 4:3 aspect ratio video feed.
How i can show black bars with 4:3
also after showing black bar how I can get camera area without black bars?
Thanks!
Is it possible to capture video in landscape while the device is in portrait mode?
something like this:
actually what i need is to capture in portrait but with width > height, i dont want the user to rotate the device, but i do want to capture a wider picture like in landscape mode.
just changing the preview layer frame to be wide (width>height) wont be enough of course.
i tried changing the video orientation of the preview layer, but that will rotate the picture, and thats not what i want.
previewLayer.connection.videoOrientation = .landscapeRight
is that make any sense?
No its not possible as you would have to physically rotate the camera.
You can CROP the output video to whatever aspect ratio you desire.
This will however make your vertical resolution be at most what your horizontal resolution currently is.
As well as decreasing your field of view.
If you still wanna crop the video to simulate this "smaller landscape mode" in real time i suggest you use the "GPUImageCropFilter" from the library GPUImage
You can, you need to use AVAssetWriter and set the dimensions of the output video.
However, remember that you're going to be reducing quality. If the camera orientation is portrait, then what you're receiving is a video that is (for arguments sake) 720H x 360W.
So you want to make that landscape, if you preserve the aspect ratio, you're going to end up with a video (by cropping the input) that's 180H x 360W.
Remember, there is a difference between what the camera sees, what you send to the preview layer and what you record to a file - they can all be independent of each other (you spoke about changing the preview layer frame, remember that has nothing to do with the video you write out).
Have you tried with setting gravity & bounds of previewLayer?
var bounds:CGRect = self.view.layer.bounds
previewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill
previewLayer?.bounds = bounds
previewLayer?.position = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))
For instance assume you capture a video at 360x480 resolution using AVCaptureSessionPresetMedium and render it with AVPlayerLayer with videoGravity of AVLayerVideoGravityResizeAspectFill. The video renders full screen, without distortion, on 5S devices.
5S devices have a resolution of 320x568, so shouldn't a 360x480 video get stretched vertically or shrunk horizontally?
How does the scaling work so that the aspect size is preserved even though the aspect size of the video differs from the aspect size of the device?
New to AVFoundation and video, so help is much appreciated.
Set your videoGravity to AVLayerVideoGravityResizeAspect.It preserved the aspect size by stretched vertically or shrunk horizontally
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.
Im mirroring my app on a tv, using this post about video mirroring for iPad, in an iPad1
the problem is that the image is not full screen,
how can i make the image full screen?
thanks!
The image most likely isn't scaled correctly because your iPad's aspect ratio is 4:3 whereas your TV (if HD) is most likely 16:9.