I'm trying to create a very simple test to see how effective the new 
MediaCodec class might be.  What I've found is that I can't even get past 
the simple stage of configuring the most basic video encoder.

MediaCodec mCodec = MediaCodec.createEncoderByType("video/avc");

MediaFormat myFormat = MediaFormat.createVideoFormat("video/avc", 
VIDEO_WIDTH, VIDEO_HEIGHT);

mCodec.configure(myFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);   
  


This throws an IllegalStateException:

10-16 10:25:30.995: I/OMXClient(17664): Using client-side OMX mux.
10-16 10:25:30.995: D/NvOsDebugPrintf(126): NvxLiteH264DecoderInit : 
Opening TVMR H264 block 
10-16 10:25:30.995: E/MediaCodec(17664): native_window_api_connect returned 
an error: Invalid argument (-22)
10-16 10:25:30.995: W/dalvikvm(17664): threadid=12: thread exiting with 
uncaught exception (group=0x40dbb300)
10-16 10:25:30.995: E/AndroidRuntime(17664): FATAL EXCEPTION: Thread-2554
10-16 10:25:30.995: E/AndroidRuntime(17664): java.lang.IllegalStateException
10-16 10:25:30.995: E/AndroidRuntime(17664): at 
android.media.MediaCodec.native_configure(Native Method)
10-16 10:25:30.995: E/AndroidRuntime(17664): at 
android.media.MediaCodec.configure(MediaCodec.java:257)
10-16 10:25:30.995: E/AndroidRuntime(17664): at 
com.foo.RecordingThread.run(RecordingThread.java:58)

It doesn't get any more basic than what I'm doing here.  That video/avc 
codec is definitely supported by my nexus 7 by the way.

I'm beginning to suspect that the reason there are no samples or tutorials 
using MediaCodec beyond a powerpoint presentation from the I/O conference 
is because it's not really ready for use.

I sure would love to hear if someone has some code that actually can encode 
video using MediaCodec.


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to