GNOME Bugzilla – Bug 794593
[Android omxbrcmvideoh264hwencoder] AMC encodebin fails with "Internal data stream error."
Last modified: 2018-03-22 16:25:34 UTC
Created attachment 370001 [details] Startup code I want to use an Android's HW h264 encoder (instead of SW x264enc) to encode a video stream. In my code I use simple pipeline: [code] ... const QByteArray launch = "videotestsrc name=appsrc " "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc " "! rtph264pay name=pay " "! udpsink name=udpsink"; GError *error = nullptr; m_pipeline = ::gst_parse_launch(launch.constData(), &error); ... const auto status = ::gst_element_set_state(m_pipeline, GST_STATE_PLAYING); ... [/code] All functions returns successfully, but from the logs I see following errors: [quote] D/GStreamer+amcvideoenc(17480): 0:00:41.004486081 0x56d05890 gstamcvideoenc.c:856:gst_amc_video_enc_handle_output_frame:<videoenc> got codecconfig in byte-stream format D/GStreamer+amcvideoenc(17480): 0:00:41.007110593 0x56d05890 gstamcvideoenc.c:1070:gst_amc_video_enc_loop:<videoenc> Finished frame: not-negotiated W/GStreamer+amcvideoenc(17480): 0:00:41.008331296 0x56d05890 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error. W/GStreamer+amcvideoenc(17480): 0:00:41.009124753 0x56d05890 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-negotiated (-4) [/quote] I don't know what I han fix this. Please see attachments with my code and full log with ("amc*:6") debug level.
Created attachment 370002 [details] AMC encoder debugging log
UPD: I use Android 5.5.1 (Cyanogen-mod 12.1) on GT-S7270.
s/5.5.1/5.1.1
If I try to add to a pipeline a profile string: [code] ... const QByteArray launch = "videotestsrc name=appsrc " "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc " "! video/x-h264, profile=main " // << This string "! rtph264pay name=pay " "! udpsink name=udpsink"; ... [/code] then I got other errors (please, see brcm-encoder-with-profile.log)
Created attachment 370007 [details] BRCM encoder with main profile debug log
If I try to use the 'video/x-h264, profile=high', then I got same error: [quote] ... "Pipeline linking with recoverable error, domain: 1468 code: 3 : "could not link videoenc to pay, videoenc can't handle caps video/x-h264, profile=(string)high"" ... D/GStreamer+amcvideoenc(12027): 0:00:48.762756347 0x55f8e490 gstamcvideoenc.c:1070:gst_amc_video_enc_loop:<videoenc> Finished frame: not-linked W/GStreamer+amcvideoenc(12027): 0:00:48.763122558 0x55f8e490 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error. W/GStreamer+amcvideoenc(12027): 0:00:48.763183593 0x55f8e490 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-linked (-1) E/GStreamer+amcvideoenc(12027): 0:00:48.765808106 0x55f6bcf0 gstamcvideoenc.c:1542:gst_amc_video_enc_handle_frame:<videoenc> Downstream returned not-linked ... [/quote]
That just mean high is not supported, old phones don't support that. Can you test with baseline or constrained-baseline profile ?
With baseline profile: [code] ... const QByteArray launch = "videotestsrc name=appsrc " "! amcvidenc-omxbrcmvideoh264hwencoder name=videoenc " "! video/x-h264, profile=baseline " "! rtph264pay name=pay " "! udpsink name=udpsink"; ... [/code] I got: [quote] W/GStreamer+amcvideoenc(13112): 0:00:29.859680177 0x54ffd580 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: Internal data stream error. W/GStreamer+amcvideoenc(13112): 0:00:29.860076905 0x54ffd580 gstamcvideoenc.c:1143:gst_amc_video_enc_loop:<videoenc> error: streaming stopped, reason not-negotiated (-4) [/quote] please see 'brcm-encoder-with-baseline-profile.log'.
Created attachment 370012 [details] BRCM encoder with baseline profile debug log
With 'constrained-baseline' profile I got same error as with 'baseline' profile.
Can you add a parser between the encoder and rtph264pay (i.e. enc ! h264parse ! rtph264pay). Also, we'll need GST_DEBUG="*CAPS*:5" to debug this not negotiated issue if it still exist after adding the missing parser.
WOW, this worked with 'h264parse' !!! :) Many thanks.
We try hard to make the parser optional with H264 payloader, so I'd like if you could share the CAPS trace, so we can see which fields the encoder didn't set. Maybe we could do something about it.
I have added two log files: * caps-with-parse.log * caps-no-parse.log
Created attachment 370018 [details] CAPS without of x264parse element
Created attachment 370019 [details] CAPS with x264parse element
Comment on attachment 370018 [details] CAPS without of x264parse element Ok, the encoder does not set much information because Android does not provide much information. I'll try to remember, but a parser is needed with these encoders.