android h264 hardware encoding
cee1
fykcee1 at gmail.com
Sun Oct 20 04:12:11 CEST 2013
2013/10/19 Sebastian Dröge <slomo at coaxion.net>:
> On Fr, 2013-10-18 at 05:55 -0700, yoyosuper8 wrote:
>> Ok, so I downloaded the mcplayer example and changed the pipeline to use the
>> hw encoder on the samsung galaxy s2 phone and I get the following error:
>>
>> ACodec [OMX.TI.DUCATI1.VIDEO.H264E] does not support color format 21
>> ACoder [OMX.TI.DUCATI1.VIDEO.H264E] configureCodec returning error
>> -2147483648
>> MediaCodec Codec reported an error. (omx error 0x80001001, internalError
>> -2147483648
>>
>> The same error showed up on my application when I changed the pipeline to
>> the following (which is the same as the pipeline in mcplayer, but with my
>> own hw encoder):
>>
>> gst_rtsp_media_factory_set_launch (factory,
>> "( videotestsrc is-live=true do-timestamp=true ! capsfilter
>> caps=\"video/x-raw,
>> width=640,height=480,framerate=8/1\" ! amcvidenc-omxtiducati1videoh264e
>> bitrate=1024
>> i-frame-interval=8 ! queue ! capssetter
>> caps=\"video/x-h264,profile=baseline\" ! h264parse !
>> rtph264pay name=pay0 pt=96 )");
>>
>> Could it be a problem in the androidmedic code?
>
> It is, yes. It tries to configure color format 21, but that is not
> supported by the hardware. Instead it would need to query the support
> color formats and properly negotiate them with the upstream elements
> (i.e. cause videoconvert to convert to something supported in the worst
> case).
I think the current code has already handle this:
"""
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
if (!allowed_caps) {
GST_DEBUG_OBJECT (self, "... but no peer, using template caps");
/* we need to copy because get_allowed_caps returns a ref, and
* get_pad_template_caps doesn't */
allowed_caps =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_ENCODER_SRC_PAD
(encoder)));
}
GST_DEBUG_OBJECT (self, "chose caps %" GST_PTR_FORMAT, allowed_caps);
allowed_caps = gst_caps_truncate (allowed_caps);
"""
The supported features are represented by src pad's caps of the
encoder, gst_pad_get_allowed_caps should tell the negotiated caps.
yoyosuper8, could you try the following:
1. wget http://dev.lemote.com/files/upload/software/rtsp-demo/libgstbufferinspect.a
2. cp libgstbufferinspect.a /path/to/gstreamer/lib/gstreamer-1.0/static
3. modify jni/Android.mk, append bufferinspect to "GSTREAMER_PLUGINS"
4. modify the pipeline, insert a bufferinspect element before and
after the encoder, e.g.
... bufferinspect ! amcvidenc-omxk3videoencoderavc bitrate=1024
i-frame-interval=8 ! bufferinspect
5. ndk-build && ant debug && adb logcat -c
6. adb logcat &> encoder.log and start up the app
Then send me the log.
--
Regards,
- cee1
More information about the gstreamer-devel
mailing list