Samsung Galaxy S4 front camera glitch when CameraProfile changed - android

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.

Related

how to prevent video playing in landscape mode in android device?

I am working as a android developer and while testing my app in Samsung I found something.
When I am capturing any video in my Samsung device with portrait mode, and then playing it in a video view, it will display with the wrong orientation. Portrait video will play with landscape orientation. I think it is rotating the video 90 degree left. Please guide us to solve this problem.
Video is played in the correct orientation in devices from other manufactures like Google Nexus or Micromax. It is played in the correct orientation but in Samsung the portrait video orientation is not proper.

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.

Samsung Galaxy S4 Streaming Video Playback Orientation Issue

When playing back videos on the Samsung Galaxy S4 the video does not recognize the orientation metadata. It always plays on landscape.
The app also records the video and plays correctly on all other devices while streaming. The S4 plays it fine only if the video is stored in the device but it won't work for streaming.
Using MediaPlayer and SurfaceView on a Fragment, not a VideoView.
Have tried to disable Air View, Air Gesture, Smart Stay, Smart Scroll and Auto Rotate without luck.
Also even stored the orientation hint along with the video to rotate manually the element in the layout, but the SurfaceView when rotated using lockCanvas doesn't work and when rotating its parent element goes black and only plays the audio.
Any suggestions I can try to get this bug fixed? Have you experiencing the same when using the S4? Any help on this will be greatly appreciated. Thanks!
I asked this question a few months back and haven't heard anything. I would love to know as well.
https://stackoverflow.com/questions/17950072/galaxy-s4-media-player-ignores-rotation-metadata
Edit: This also occurs on the Galaxy Note 3.
Found a workaround for this issue. Try using a TextureView instead a SurfaceView, before playing the video, get the rotation info with MetadataRetriever and adjust the TextureView as needed. It worked on this side.
See the details here:
Streaming Video Playback Orientation Issue # Samsung Developers Forum

Android recording video using Camcorder on HTC one X

I implemented a video recorder in my code and it runs perfectly on almost all the devices
except to HTC One X. There the video record getting stuck(the first image doesn't change) and when I'm trying to open the file I'm receiving a pop-up "Cannot play video, sorry this video cannot be played"
Here are my settings
mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
// Use the same frame rate for both, since internally
// if the frame rate is too large, it can cause camera to become
// unstable. We need to fix the MediaRecorder to disable the support
// of setting frame rate for now.
mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate);
//mMediaRecorder.setVideoSize(mVideoWidth, mVideoHeight);
mMediaRecorder.setVideoSize(640,480); // Works On Note(not on HTC One X)
mMediaRecorder.setVideoEncodingBitRate(MAXIMAL_PERMITTED_VIDEO_ENCODING_BITRATE);
// mMediaRecorder.setVideoEncoder(mProfile.videoCodec);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
// mMediaRecorder.setAudioEncoder(mProfile.audioCodec);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
Thanks
I adapted some code from this question How can I capture a video recording on Android? for recording video, set it to 640x480, and it ran fine on my AT&T One X:
https://raw.github.com/lnanek/Misc/master/HtcOneXVideoRecord/src/com/htc/sample/videorecord/RecordVideo.java
So it isn't the 640x480 that isn't working in and of itself. What's the value for the bitrate you are setting? Have you considered using profiles instead, which are build in supported combinations? For example, you would set:
mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)
And that would set the resolution, bit rate, etc. to values that work. There are various constants for high quality recording, low, etc..

Android Capture Screenshot during video play

I Don't know here is the right place but How can I capture screen while playing video in an android device especially android 2.3.1.
When I Capture screen, just see play pause buttons and a black screen instead of video content.
Thanx
It can be achieved if you play your video on surface texture. To play video on that surface texture would be needing bitmap(which will run in thread). you can then capture the bitmap on touch event for surface texture and convert it to jpeg in your desired folder.
According to this thread, it doesn't seems to be possible (I had the same problem).
The only solution I found was to play the video on a Galaxy tab 10.1 and to use the screenshot function of the tablet, but it require to have a Galaxy tab 10.1 :/
Jokahero

Categories

Resources