Gstreamer pipeline multiple sink to one src

Looking for explanation how to using named elements in respect with muxing two inputs in one module. For instance muxing audio and video in one mpegtsmux modle

gst-launch filesrc location=surround.mp4 ! decodebin name=dmux ! queue ! audioconvert ! lamemp3enc dmux. ! queue ! x264enc ! mpegtsmux name=mux ! queue ! filesink location=out.ts

Above pipeline gives plugins interconnection like below

在这里输入图像描述

So it shows audio doesn't connect to mpegtsmus.

How to modify command line to have audio and video muxedup in mpegtsmux ?

Thanks!


It is not linked because your launch line doesn't do it. Notice how the lamemp3enc element is not linked downstream.

Update your launch line to:

gst-launch filesrc location=surround.mp4 ! decodebin name=dmux ! queue ! audioconvert ! lamemp3enc ! mux. dmux. ! queue ! x264enc ! mpegtsmux name=mux ! queue ! filesink location=out.ts

The only change is " ! mux." after the lamemp3enc to tell it to link to the mpegtsmux.

While you are updating things, please notice that you are using gstreamer 0.10 that is years obsolete and unmantained, please upgrade to the 1.x series to get latest improvements and bugfixes.


I'll try to give the basic idea though I'm not that proficient and could be plain wrong.

  • A pipeline can consist of several sub-pipelines. If some element (bin) ends not with a pipe ( ! ) but with a start of another element, then it's a new sub-pipeline: filesrc location=a.mp4 ! qtdemux name=demp4 filesrc location=a.mp4 ! qtdemux name=demp4 demp4. ! something demp4. ! something
  • A named bin (usually a muxer), or its pads like somedemux.audio_00 can be a source and/or a sink in other sub-pipelines: demp4. ! queue ! decodebin ! x264enc ! mux. demp4. ! queue ! decodebin ! x264enc ! mux.
  • Usually a sub-pipeline ends with a named bin/muxer, either declared: mpegtsmux name=mux or referenced by name: mux. The dot at the end is a syntax of a reference.
  • Then the named muxer can be piped to a sink in a yet another sub-pipeline: mux. ! filesink location=out.ts mux. ! filesink location=out.ts
  • If you're only using the only audio or video stream from a source, you don't have to specify a pad like muxname.audio_00 . muxname. is a shortcut to "suitable audio/video pad from muxname ".
  • The example

    That said, I assume that your mp4 file has both audio and video. In this case, you need to demux it into 2 streams first, decode, re-encode and then mux them back.

    Indeed, your audio is not connected to mpegtsmux .

    If you really need to decode the streams, that's what I would do. This didn't work for me, though:

    gst-launch-1.0 filesrc location=surround.mp4 ! 
      qtdemux name=demp4 
      demp4. ! queue ! decodebin ! audioconvert ! lamemp3enc ! mpegtsmux name=mux 
      demp4. ! queue ! decodebin ! x264enc ! mux. 
      mux. ! filesink location=out.ts
    

    or let's use decodebin to magically decode both streams:

    gst-launch-1.0 filesrc location=surround.mp4 ! 
      decodebin name=demp4 
      demp4. ! queue ! audioconvert ! lamemp3enc ! mpegtsmux name=mux 
      demp4. ! queue ! x264enc ! mux. 
      mux. ! filesink location=out.ts
    
    链接地址: http://www.djcxy.com/p/7640.html

    上一篇: 使用GStreamer将mp4视频转换为avi视频

    下一篇: Gstreamer管道多个接收器到一个src