Reputation: 5097
Currently, I am following google's sample code in Kotlin for Camera2 API. Everything seems working fine in terms of video recording. However, I do have different requirements for my project as listed below.
I need to record a video in three possible ways 640 x 640(square), Y x 640(portrait), or 640 x Y(landscape) in portrait screen where Y is a number less than 640.
640 x 640(square): I have Samsung S9+ which supports only one resolution with 1:1 aspect ration which is 384x384, but when I post on Instagram they create a video with 720 x 720 resolution with good quality. So the question is how Instagram is enlarging a low-resolution video without losing quality?
W? x 640(portrait): I need to find out an equal or high resolution with the closest matching aspect ratio and later on, I can run the FFmpeg command to match with the required size, right?
640 x H?(landscape): I can follow the same thing as in the portrait use case. However, the real question is how to record a video in the landscape if your screen is in Portrait orientation?
I have already researched a lot on each use case and now open for any possible solutions like FFMpeg, OpenGL, MediaMuxer, MediaCodec or anything else?
Any hint, links or suggestion would be highly appreciated. Thanks in advance.
Upvotes: 1
Views: 672
Reputation: 18097
640 x 640(square): Instagram is likely capturing video at 720p (1280x720) and then cropping to 720x720 in their own code.
Generally, camera has only a few resolutions available, and they all tend to be landscape. If you need portrait resolutions (or landscape resolutions in portrait orientation), you will probably need to do your own cropping.
Upvotes: 1