How can I specify correct codec for Pantech Element?

2 min read Original article ↗

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: enter image description here

And here's the ADB log when the stock Camcorder app on the Element records video: enter image description here

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!