[Galaxy S II Q&A, Help & Troubleshooting] UKLooney:
Hi guys, hope yous can help, hope I'm posting in the right place...

My app records video using the MediaRecorder API, seems to work on all other phones I know of. I just bought a i9100 myself after a user reported this bug :rolleyes:, still can't resolve the issue though. :mad: Awesome hardware though :cool:

On the Galaxy S II, when attempting to record video using the 'HIGH_QUALITY' CamcorderProfile the resultant video is playable, but corrupt (flickering green squares with garbled video @ 1920x1080).

The 'LOW_QUALITY' setting records ok but in very poor quality, as to be expected.

I can get good 720x480 video footage if I manually set up the MediaRecorder object, but get the same problems when I up the resolution beyond 480p.

Here is a breakdown of my code using the Camcorder profile... DOES NOT WORK, gives corrupt footage @ 1920x1080.

mMediaRecorder = new MediaRecorder();
// reuse the camera
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
mMediaRecorder.setPreviewDisplay(mSurfaceView.getHolder().getSurface());
mMediaRecorder.setOutputFile(tempVideoFile.getAbsolutePath());
mMediaRecorder.prepare();
mMediaRecorder.start();

Here is example code only this time setting up the MediaRecorder object manually from the phone provided 'HIGH_QUALITY' CamcorderProfile values, WORKS OK when specifying a video size of 720x480.

mMediaRecorder = new MediaRecorder();
// reuse the camera
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).fileFormat);
mMediaRecorder.setVideoSize(720, 480);
mMediaRecorder.setVideoEncodingBitRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoBitRate);
mMediaRecorder.setVideoFrameRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoFrameRate);
mMediaRecorder.setVideoEncoder(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoCodec);
mMediaRecorder.setAudioEncodingBitRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioBitRate);
mMediaRecorder.setAudioSamplingRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioSampleRate);
mMediaRecorder.setAudioEncoder(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioCodec);
mMediaRecorder.setPreviewDisplay(mSurfaceView.getHolder().getSurface());
mMediaRecorder.setOutputFile(tempVideoFile.getAbsolutePath());
mMediaRecorder.prepare();
mMediaRecorder.start();

Here is example code only using MediaRecorder, DOES NOT WORK, gives corrupt footage @ 1080x720.

The only difference between this and the last, is the VideoSize.

mMediaRecorder = new MediaRecorder();
// reuse the camera
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).fileFormat);
mMediaRecorder.setVideoSize(1080, 720);
mMediaRecorder.setVideoEncodingBitRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoBitRate);
mMediaRecorder.setVideoFrameRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoFrameRate);
mMediaRecorder.setVideoEncoder(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).videoCodec);
mMediaRecorder.setAudioEncodingBitRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioBitRate);
mMediaRecorder.setAudioSamplingRate(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioSampleRate);
mMediaRecorder.setAudioEncoder(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH).audioCodec);
mMediaRecorder.setPreviewDisplay(mSurfaceView.getHolder().getSurface());
mMediaRecorder.setOutputFile(tempVideoFile.getAbsolutePath());
mMediaRecorder.prepare();
mMediaRecorder.start();

Here is the details i get from the HIGH_QUALITY CamcorderProfile from the Galaxy S II

CamcorderProfile.fileFormat=2

CamcorderProfile.videoFrameWidth=1920

CamcorderProfile.videoFrameHeight=1080

CamcorderProfile.videoBitRate=2000000

CamcorderProfile.videoFrameRate=30

CamcorderProfile.videoCodec=2

CamcorderProfile.audioBitRate=96000

CamcorderProfile.audioSampleRate=16000

CamcorderProfile.audioCodec=3

I've tried tweaking all these values but to no avail...

Can anyone tell me the what are the recommended MediaRecorder settings for recording 720p & 1080p video footage? Or if there is an odd way I need to set up the camera?

Thanks

Edit: Phone is O2 UK supplied, with 2.3.3, Baseband I9100XXKDJ, Build GINGERBREAD.XWKE2

Edit2: Here is the market app if anyone want to try

https://market.android.com/details?id=net.adyno.alaprecorderhd

View attachment 612626