1

Naively, I am trying to link decodebin to encodebin:

$ gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! encodebin profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
failed delayed linking some pad of GstDecodeBin named decodebin0 to some pad of GstEncodeBin named encodebin0
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0: Internal data stream error.
Additional debug info:
gstwavparse.c(2293): gst_wavparse_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Surely, there is something missing. What is it?

Note, this works: gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! audioconvert ! vorbisenc ! oggmux ! filesink location="/tmp/sound.ogg"

1 Answer 1

4

gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! encodebin profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"

encodebin doesn't have templates in their pads so gst-launch doesn't know which pad to request (video or audio). You can explicitly ask for one of them using:

gst-launch-1.0 filesrc location="/tmp/sound.wav" ! decodebin ! enc.audio_%u encodebin name=enc profile="application/ogg:video/x-theora:audio/x-vorbis" ! filesink location="/tmp/sound.ogg"

Notice how we give encodebin a name "enc" and then we link decodebin to the audio pad as we know that this is an audio-only file.

If we had both video and audio you'd need to link explicitly the video pad from decodebin to the video pad of encodebin and so forth. You would give a name to decodebin as well and link them. Something like: decodebin name=dec dec.audio_%u ! queue ! enc.audio_%u dec.video_%u ! queue ! enc.video_%u

As a final suggestion, it is recommended to have a queue after every element that can branch of into multiple paths, like decodebin. It is mandatory when you have more than one output from it, but doesn't hurt to have it even if you only have one.

2
  • By copying & pasting your command I get: WARNING: erroneous pipeline: unexpected reference "enc" - ignoring. (Btw, thank you for your answer :) Commented Jan 21, 2019 at 13:58
  • There is/was a typo, it is missing a ! between decodebin and enc.audio_%u
    – thiagoss
    Commented Jan 21, 2019 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.