"decodebin ! encodebin" gives only video
Harry
mckameh at wanadoo.fr
Tue Apr 28 10:53:51 PDT 2015
Testing the trivial :
gst_parse_launch ("filesrc name=src ! decodebin name=dec ! encodebin name=enc ! filesink name=sink", &error);
I set the "location" property files for src & sink and I set "profile" for encodebin.
The profile has valid video & audio caps for encoding.
Result: The pipeline plays thru correctly, but the resulting file has only video, no audio.
Thinking that the problem was unconnected pads, I added a "pad-added" signal-handler to decodebin like this:
static void
decodebin_pad_cb (GstElement * decodebin, GstPad * pad, GstElement * encodebin)
{
GstPad *sinkpad;
GstCaps *caps;
sinkpad = gst_element_get_compatible_pad (encodebin, pad, NULL);
if (sinkpad == NULL) { /* ask encodebin for a compatible pad */
caps = gst_pad_get_current_caps (pad);
if (caps) {
g_signal_emit_by_name (encodebin, "request-pad", caps, &sinkpad);
gst_caps_unref (caps);
}
}
if (sinkpad != NULL) {
if (!GST_PAD_IS_LINKED (sinkpad)) /* only link once */
gst_pad_link (pad, sinkpad);
gst_object_unref (sinkpad);
}
}
Result: The encoding process now continues for as long as I have patience to wait, never finishing.
A hint for one of the problems might be that decodebin_pad_cb() is called 2 times and gst_pad_link() fails with error codes GST_PAD_LINK_WAS_LINKED and GST_PAD_LINK_NOFORMAT, probably first for video and then for audio (although the first error should really have been impossible with the GST_PAD_IS_LINKED() test).
Can someone explain the problem(s) ?
More information about the gstreamer-devel
mailing list