Corrupted preview frame in 720p on Google Glass - android

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.

Related

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

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

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.

Samsung Galaxy S4 front camera glitch when CameraProfile changed

I have an issue with video recording on S4.
What I need is front facing recording with good quality/size ratio. What I do is set CameraProfile to QUALITY_480P and that is basically all (video size is about 3MB). Everything is working except on S4 which works only on QUALITY_HIGH (not even on QUALITY_LOW). What more same video length has over 50MB on high.
Preview on S4 is OK, but recorded video looks like the image below. All I do is basically this (I use cwac, but this is my debug code):
CamcorderProfile profile = CamcorderProfile.get(cameraId,
CamcorderProfile.QUALITY_HIGH);
recorder.setProfile(profile);
Any way to fix this please?
OK so I found that this happens when you try to record with front facing camera in portrait mode. What really messes up encoded video is recorder.setOrientationHint(). This line is kind of needed, without it the recorded video is 90 degrees rotated.
That means one issue is fixed. Now I need to how to rotate recoded video.

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 video frame processing

I am working on application that does some real time image processing on camera frames. For that, I use preview callback's method onPreviewFrame. This works fine for cameras that support preview frames that have resolution at least 640x480 or larger. But when camera does not support such large camera preview resolution, application is programmed to refuse processing such frames. Now, the problem I have is with phones like Sony Xperia Go. It is a very nice device that can record video up to resolution 1280x720, but unfortunately maximum camera preview size is 480x320, which is too small for my needs.
What I would like to know is how to obtain these larger camera frames (up to 1280x720 or more)? Obviously it has to be possible because camera application has the ability to record videos in that resolution - therefore this application somehow must be able to access those larger frames. How to do the same from my application?
Application has to support Android 2.1 and later, but I would be very happy even if I find the solution for my problem only for Android 4.0 or newer.
This question is similar to http://stackoverflow.com/questions/8839109/processing-android-video-frame-by-frame-while-recording, but I don't need to save the video - I only need those high resolution video frames...
It seems the only thing you can do is decoding frames from MediaRecoder data.
You may use ffmpeg to decode recoreder data from LocalSocket.
Hope the following open source projects may help:
ipcamera-for-android: https://code.google.com/p/ipcamera-for-android/
spydroid-ipcamera: https://code.google.com/p/spydroid-ipcamera/
You should probably take a look at the OpenCV library.
It has methods that allow you to receive full frames.
I have an impression: video preview size is small, and is slow, slower than the set video recording frame rate.
I was once trying to look for solutions on this. It seems a better way is to get the video stream from the video recorder, then directly process the data from the video stream.
You could find some examples on Android ip-camera.
You can use this library:
https://github.com/natario1/CameraView
This library has addFrameProcessor listener that in process function has Frame parameter.
If you need to record video while frame processing, you need to use from takeVideoSnapshot function of CameraView. takeVideo stop frame processing until complete video recording in latest version I tested 2.6.4.

Categories

Resources