Video encoded using camera2 is upside down on nexus (5x, 6p) devices - android

We are using camera2 API to get preview and encode video simultaneously, using mediacodec.
We know when we should rotate the camera by querying 'CameraCharacteristics.SENSOR_ORIENTATION' but there is only preview rotation option.
What we need is to rotate the surface which goes to the encoder so we will not get video upside down. (Or rotate the camera itself like the old camera API.)
Thanks

Related

Android: how to rotate or change orientation of a video recorded using a library?

I am using this https://github.com/natario1/CameraView library for entertaining my camera view requirements like capturing photos, videos using both front and rear camera.
When I try to capture video using front camera it records up side down.. with rotation value to 270 degrees. I am not using MediaRecorder android API to record videos, or else I could do something like this:
Camera.setDisplayOrientation(90);
mRecorder.setOrientationHint(90);
But I have no access to the library code that itself uses MediaRecorder internally. Now I wonder what can be done to record the video using front camera with correct orientation.
Any help or resources will be admired.
Many thanks in advance!
Issues resolved after I update the library module.

how do I capture a video square like instagram and vine using Mediarecorder

I have tried by setting the videosize(width,height) for mediarecorder, but this has device compatibility issue, on few devices its crashing at mediarecorder.start();
If the device happens to support a square video size, you are welcome to use it. Most will not.
Vine, based on the last reports that I heard, does not use MediaRecorder. Instead, they use preview frames from the camera, which they crop to be square and assemble into a video. I do not know what Instagram does.
You are also welcome to record a non-square video, then post-process the video yourself to crop it to be square.

Corrupted preview frame in 720p on Google Glass

I'm using Google Glass to stream video, and need to grab the camera frames. I'm using the OnPreviewFrame() callback to get it, and everything is fine with resolution up to 800x480. When trying to do the same with 720p resolution I get a corrupted frame. If I save the data to file and try to show it as 720p NV21 frame, it is completely corrupted. I played around a bit, and discovered that if I show it with 1288 width, I can recognize what of the image, but it still has some issues with it. I'm using SurfaceTexture for the preview.
The same code works fine on Nexus7.
So it turns out Glass has an issue with 720p60 preview. When I changed the frame rate to 30fps, I got perfect 720p frames
In your init preview method, did you set parameters like this?
parameters.setPreviewFpsRange(30000, 30000);
parameters.setPreviewSize(640, 360);
mCamera.setParameters(parameters);
I found with these settings, my Glass preview would look distorted.

Can we have 720p 60fps video input using android textureView?

I am using textureView for getting the video input from android camera. The problem is that if I give a 720p 60fps input, there is very significant frame drop in the output shown by camera preview. I tried both surfaceView and GLSurfaceView, they also show similar behavior. Is there any better way to acheive 60fps using camera preview or rather can we achieve 60fps using android camera?

Android Camera: rotating output videos

I have a problem with output video for MediaRecorder - it rotates videos at 180 degrees after front face camera recording, but playback rotation during recording is normal. You see, native camcorder for my device (Samsung Vibrant) has the same result for front face camera. My app supports Froyo (2.2) and higher, thats why I can't try setOrientationHint() to rotate output. Any solutions?
Thanks!

Categories

Resources