Reputation: 1086
We're building an application which uses the MediaRecorder to record video on Android, and it works perfectly on most hardware platforms. However, Pantech's Element tablet has proved to be a bit of a challenge. When the tablet was on Android 2.3.1, the application was crashing on MediaRecorder.start(). So we upgraded the tablet to 4.0.4, and it stopped crashing.
HOWEVER, now it creates the file, but the file created cannot be opened by the tablet, or a PC. I'm pretty sure there's a codec issue, but I found specifying codecs on Android to be a maddening experience.
Here's our MediaRecorder code:
mRecorder = new MediaRecorder();
mCamera = Camera.open();
mCamera.unlock();
mRecorder.setCamera(mCamera); mRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIG H)); mRecorder.setOutputFile(fileToSave); mRecorder.setPreviewDisplay(mPreview.getHolder().getSurface()); mRecorder.prepare(); mRecorder.start(); //this calls just fine, but crashes a second later
Here's the ADB log when our application records video:
And here's the ADB log when the stock Camcorder app on the Element records video:
So all I can glean from this is that when we call .start(), we get an ERROR(0x80001009, 0) and OMX IL is in state 3.
I'm not sure what "level 17" vs "level 19" means, but that is another difference between the two logs.
Any help is much appreciated, thanks!
Upvotes: 2
Views: 178
Reputation: 20317
I think profile/level refers to H.264 profile and level (although not the way they are usually encoded: common H.264 levels are 3.2, 4.1 which usually are coded as 32, 41; then 17 is??). If true, then it would be affected by other settings you give to mediarecorder, particularly resolution, bitrate and fps.
mMediaRecorder.setVideoFrameRate(mFPS);
mMediaRecorder.setVideoEncodingBitRate(mBitrate);
mMediaRecorder.setVideoSize(mWidth, mHeight);
I also notice you never set the output format. Try this:
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
P.S. You could also try omitting the call to mRecorder.setProfile()
too and see if the profile in the logs changes, and if it works.
Upvotes: 1