5,598,171 Members 43,915 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Can't Record Hi Def Video on the Galaxy Sii

Tip us?
 
Alex.V.T
Old
(Last edited by Alex.V.T; 21st November 2011 at 09:20 AM.)
#71  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Nov 2011
Quote:
Originally Posted by Alex.V.T View Post
Mine is 2.3.3, I9100XXKE7, GINGERBEARD.XWKF3
Just got my phone updated to 2.3.5 I9100XXKI4 GINGERBEARD.XWKI8. The problem is still there. I've been trying using both Camera+MediaRecorder and SecCamera+SecMediaRecorder with no difference. It seems that system apps only can record HD video on my phone...
 
PtSy
Old
#72  
Junior Member
Thanks Meter 3
Posts: 25
Join Date: Sep 2010
Quote:
Originally Posted by RubberBigPepper View Post
You are going around the point...
Try this code:
Camera.Parameters cParams=m_cCamera.getParameters(); //or use SecCamera-
cParams.set("cam_mode",1);//abracadabra!
m_cCamera.setParameters(cParams);
m_cCamera.setPreviewSize(1920,1080);
First, thanks for the "cam_mode" hint. It works fine with two problems:
1) There is a false-color part in the live-preview viewfinder on the bottom.
2) The video is automatically recorded with (max?) zoom.

Anyone experiencing the same?
 
vladimir.shakula
Old
(Last edited by vladimir.shakula; 3rd January 2012 at 01:24 PM.)
#73  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Jan 2012
please, everyone, plese give some source how write hd video?
any source or sample when is recording hd video on SII! Please...
 
Alex.V.T
Old
#74  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Nov 2011
Quote:
Originally Posted by vladimir.shakula View Post
please, everyone, plese give some source how write hd video?
Yeah, you're right The standard workflow (http ://developer.android.com/guide/topics/media/camera.html#capture-video) works pretty well. The trick is in the camera initialization. After instantiating your Camera object, do the following:
Code:
mParameters = mCamera.getParameters();
if ( mParameters == null ) {
	Log.e(TAG, "Error reading camera parameters");
	return;
}
		
// green mess in video file without this
mParameters.set( "cam_mode", 1 );
		
// must be set to the VIDEO size, not the preview size,
// or the video won't be recorded. 
mParameters.setPreviewSize(mProfile.videoFrameWidth, mProfile.videoFrameHeight);
		
// Without this, MediaRecorder.start() sleeps for approx 8.5 sec on my SGS2 before
// start recording; some other SGS2 may not be affected
mParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);	// works  
//mParameters.setFocusMode(Parameters.FOCUS_MODE_INFINITY); 	// works as well
		
mCamera.setParameters(mParameters);		// catch RuntimeException

// Use it AFTER setParameters();
// Angles:
// 		 0 for landscape, the home button on the right
//		90 for normal portrait
//	   180 weird results, not tested well
//	   270 weird results, not tested well
mCamera.setDisplayOrientation(0);
I've attached the quick and dirty but working sample code.

Hope this helps.

P.S. Many thanks to RubberBigPepper and UKLooney for the clues!
Attached Files
File Type: zip VideoCapture.zip - [Click for QR Code] (76.7 KB, 256 views)
 
PtSy
Old
#75  
Junior Member
Thanks Meter 3
Posts: 25
Join Date: Sep 2010
And it's important to set the viewfinder size to the video dimension size (e.g. 1920x1080). Else you will get a distorted video (green and red-ish blocks).
 
UKLooney
Old
(Last edited by UKLooney; 6th January 2012 at 07:00 PM.) Reason: my poor english
#76  
UKLooney's Avatar
Senior Member - OP
Thanks Meter 4
Posts: 111
Join Date: Aug 2009
Quote:
Originally Posted by PtSy View Post
And it's important to set the viewfinder size to the video dimension size (e.g. 1920x1080). Else you will get a distorted video (green and red-ish blocks).
setting dimension to 1920x1080 allows the camera to allocate a properly size memory space for the camera data to be buffered into. When the incorrect buffer is later read and compressed, most of it has been lost.

Quote:
Originally Posted by Alex.V.T
// Use it AFTER setParameters();
// Angles:
// 0 for landscape, the home button on the right
// 90 for normal portrait
// 180 weird results, not tested well
// 270 weird results, not tested well
mCamera.setDisplayOrientation(0);
I've found that setting the angle to 180, sets a parameter in the video file header to indicate to the playback software that the video should be inverted when played back. This is because the video is still encoded upside down. Sadly, some older players/encoders do not interpret this flag and the video plays the wrong way up.

The example code looks good to me
 
sgs2camera
Old
#77  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Mar 2012
Thumbs up startup delay

Thanks for this thread! The cam_mode fix worked for me, which is great! It's really annoying that Samsung implemented this in such an obscure way!

I've posted this answer across to stackoverflow, google camcorderprofile-quality-high-resolution-produces-green-flickering-video (sorry, can't post url!)

Are there any further thoughts on the issue of the startup delay?

Quote:
Originally Posted by UKLooney View Post
I do not see this problem on my device

2.3.3, XWKE2
I also get this on 2.3.4, so perhaps it's not OS dependent, but a hardware issue in some way (only affecting certain devices)?
 
Alex.V.T
Old
#78  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Nov 2011
Quote:
Originally Posted by sgs2camera View Post
Are there any further thoughts on the issue of the startup delay?
Have you tried using setFocusMode() with FOCUS_MODE_CONTINUOUS_VIDEO or FOCUS_MODE_INFINITY explicitly (as in the code snippet in post #74)?

In my case, lack of the setting caused that weird delay.
 
sgs2camera
Old
#79  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Mar 2012
Quote:
Originally Posted by Alex.V.T View Post
Have you tried using setFocusMode() with FOCUS_MODE_CONTINUOUS_VIDEO or FOCUS_MODE_INFINITY explicitly (as in the code snippet in post #74)?
Great - that solves it!
 
acapola
Old
#80  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Jun 2012
Default Same trick for other devices ?

Thanks for those useful tips. Now I get the same kind of issue with a Galaxy Tab :-S
My current work around is to switch to low quality:
if(Build.MODEL.equalsIgnoreCase("SHW-M180S"))
mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW) ;
else
mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH );

Any better idea ? Any magic parameter ?

Where do you find such tricks ?? If it involves reading samsung's messed up source code, no problem, but where to find it ??

it happens on a tab with following software:
Build.DISPLAY; GINGERBREAD.TJ24
Build.TYPE; user
Build.VERSION.CODENAME; REL
Build.VERSION.INCREMENTAL;TJ24
Build.VERSION.RELEASE; 2.3.6
Build.VERSION.SDK; 10
Build.VERSION.SDK_INT; 10

Tags
record hd video recording
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes