Android Galaxy S4 Preview with Pink and Green lines - android

all.
I am making a video recorder which works fine on other devices but Samsung GS4.
As you know, GS4 has full HD resolution which is 1920 * 1280.
When I take a video with back camera, I set recorder.setVideoSize(1920, 1280) and it records correctly.
However, if I take a video with front cam, it shows below view.
I mean, when I record it, I can see the recordign screen.
However, after recording is done and I play the video file, it is corrupted like this.
I think it has something to do with video the setVideoSize().
I tried every possible pair of with and height for resolution but to no avail.
GS4 spec says
Front camera 2 megapixels 1080p HD Video Recording # 30fps Back-illuminated sensor
but I don't know what video size I have to set it to.
Can anyone give me a clue?
Thanks in advance!

The front facing camera records at a default of 1920x1080 (1080p). Though because of the orientation, it may be 1080x1920.

Related

Camera2 video recording with custom resolutions?

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.
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.

Unable to get 4k video output on android + opencv

I'm trying to connect a 4k camera on a Android tv device.
My problem is that i can't seem to get 4k output from the camera onto my 4k tv screen. The highest video resolution that I am able to get is 1920x1080.
I'm using opencv for android and have tried to set the resolution in initializeCamera() inside the JavaCameraView class.
params.setPictureSize(highestSupportedSize.width, highestSupportedSize.height);
params.setPreviewSize(highestSupportedSize.width, highestSupportedSize.height);
I search for the highest common resolution between the pictureSizes and previewSizes. The problem lays in the fact that the highest preview size that I can get is 1920x1080. Which is very strange since both my screen and camera support 4k.
If I manually set the picture size to 3840x2160, I get a very large green area on the screen and the camera preview part stays 1920,1080.
If I try to manually set the preview size to 3840x2160, the app crashes.
Would really appreciate someone that knows how to get 4k video output on a JavaCameraView.
Edit: I now have the feeling that the issue is the Android tv I'm using (Nvidia shield tv). Which might not support 4k camera input. Still trying to fix this.
Edit2: For anyone facing the same issue: According to Logitech customer service, the Android tv boxes don't support anything higher than 720p at the moment. There are also no plans from logitech or nvidia to create support for this.
You chan check my question:
android tv box 4K activity
You can select 4k for your actviti, if available.
I think a lot of tv boxes GPU only supports 4k video, but fullHD openGL surface /activities.
Maybe JavaCameraView is video over opengl.
Can you get a real 4K resolution with others non video apps, like launcher?
I downloaded a lot of apps to display screen resolution, and I always get a
logical fullHD resolution with a 4K#60Hz display.

Use FFmpeg to rotate the video based on its <rotate> metadata? Why does Android put the wrong metadata?

I have a website where the user uploads a video.
For my website i have also an Android application.
The website creates a thumbnail of each uploaded video (from browser or Android).
The problem is that for normal videos it's all OK, but for android my videos are rotated by 90°.
I think that Android has a bug, because when I see with FFmpeg the video's metadata, for a normal recorded video I got a rotate=90 value, and for a 90° rotated video, I don't have anything in the metadata (and the thumbnail is correct).
Why?
This is an image of a normal recorded video (with the phone in portrait mode).
Anyway, I have the metadata in the video, can I create its thumbnail based on its metadata's rotate value without extracting the metadata and then use ffmpeg to rotate the video on this value?
Thank you in advance.
On android, holding your phone in portrait is considered to be 90 degrees. This the convention that android is using:
landscape: 0
portrait: 90
reverse landscape: 180
reverse portrait: 270
I know this doesn't make sense for phones but it does for tablets and there is realy no difference between tablets and phones on android.
So the metadata in the file are correct. The actual problem is that your browser ignores them. See me question here

Can I detect the orientation of an image without saving it to file?

I am trying to build a receipt scanning Android app and the way that I am handling really long receipts is to take multiple pictures and compile them into one long image. I tried doing image stitching with opencv but I ran into too many memory issues on older devices.
I am now running into the issue that with certain devices, specifically the Samsung Galaxy Player and Samsung Galaxy Tab 2, the preview and image capture orientation are not correct. The receipt needs to be scanned in portrait mode.
I have tried using this code to rotate the preview: http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation%28int%29
I added a line of code that rotates the camera by the same value that it rotates the preview.
On the Galaxy Player, this makes the preview display as still rotated but now flipped. The pictures that it returns are still rotated as if the camera was not rotated.
On the Galaxy Tab the preview displays correctly but the image that it creates is upside down.
Is there a way to detect the top and bottom of the image without saving it to file and getting the EXIF? Would that even make a difference on these devices or is there a deeper issue with those devices?
Thanks!

Capture screen shot on Android phone when playing video and camera preview

I have two HTC phones, one is HTC desire and another is HTC aria. I'm using ddms to capture the screenshot on HTC desire before, it works fine. However recently I buy one HTC aria, and I found when doing screenshot on camera preview and video playing (e.g. youtube clips), the result goes black.
I think that might be some overlay issue, but just can't figure out how do capture screenshots on camera preview.
Sorry, this is probably just not possible. Prior to Android 3.0, the DDMS screenshot facility was done by taking a copy of the framebuffer. For surfaces in an overlay (often the case with video playback), this doesn't exist in the framebuffer so can't be included in the screenshot.

Categories

Resources