I am trying to dynamically add another uridecodebin
to compositor/audiomixer
this is my "starting" pipeline, it works:
compositor name=videomix ! tee name=vo
audiomixer name=audiomix async=true ! tee name=au
hlssink2 async-handling=true name=output location=out/hlssink.%05d.ts playlist-location=out/out.m3u8 sync=true target-duration=10 playlist-length=5 max-files=5 name=hls
vo.
! queue ! videoconvert ! videoscale ! videorate
! x264enc cabac=false key-int-max=50 quantizer=0 pass=0 speed-preset=ultrafast tune=zerolatency bitrate=8000 byte-stream=true ! video/x-h264,width=1920,height=1080,pixel-aspect-ratio=1/1,framerate=25/1,format=RGBA,profile=constrained-baseline ! hls.video
au.
! audioconvert
! audiorate
! audioresample
! audio/x-raw, rate=44100, layout=interleaved, format=F32LE, channels=2 ! avenc_aac bitrate=128000 ac=2
! audio/mpeg
! hls.audio
uridecodebin connection-speed=50000000 uri=https://HLS1 sync=false async=true name=d1
d1. ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! videomix.
d1. ! audioconvert
! audiorate
! audioresample
! volume volume=1.0
! audiomix.
uridecodebin connection-speed=50000000 uri="https://HLS2" sync=false async=true name=d2
d2. ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! videomix.
d2. ! audioconvert
! audiorate
! audioresample
! volume volume=1.0
! audiomix.
I need the tee - because in final production I want to produce a hls output and another one.
I try to add another set of uridecodebin
to the running pipeline - using go-gst (but I think my problem is a basic understanding, so any solution in any language would be fine - porting should not be the problem)
bin := gst.NewBin("dyn1")
// uridecodebin connection-speed=50000000 uri="https://HLS3" sync=false async=true name=d2
// d2. ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! videomix.
// d2. ! audioconvert
// ! audiorate
// ! audioresample
// ! volume volume=1.0
// ! audiomix.
els, _ := gst.NewElementMany("uridecodebin", "videoconvert", "videoscale", "audioconvert", "audiorate", "audioresample", "volume")
uridecodebin := els[0]
uridecodebin.Set("name", "dynamic1")
uridecodebin.Set("uri", "https://HLSDYNAMICADDED")
uridecodebin.Set("sync", false)
uridecodebin.Set("async", true)
videoconvert := els[1]
videoscale := els[2]
audioconvert := els[3]
audiorate := els[4]
audioresample := els[5]
volume := els[6]
gst.ElementLinkMany(uridecodebin, videoconvert, videoscale)
gst.ElementLinkMany(uridecodebin, audioconvert, audiorate, audioresample, volume)
bin.AddMany(uridecodebin, videoconvert, videoscale, audioconvert, audiorate, audioresample, volume)
videomixer, _ := pipeline.GetElementByName("videomix")
audiomixer, _ := pipeline.GetElementByName("audiomix")
pipeline.Add(bin.Element)
volume.Link(audiomixer)
videoscale.LinkFiltered(videomixer, gst.NewCapsFromString("video/x-raw,width=1920,height=1080"))
bin.SetState(gst.StatePaused)
when I run the pipeline it works, and with a couple of seconds delay, the "ADDING" happens, and the pipeline crashes with:
ERROR: Internal data stream error.
DEBUG: ../gst-libs/gst/adaptivedemux/gstadaptivedemux.c(3891):
gst_adaptive_demux_stream_download_loop ():
/GstPipeline:pipeline0/GstBin:dyn1/GstURIDecodeBin:dynamic1/GstDecodeBin:decodebin3/GstHLSDemux:hlsdemux3:
streaming stopped, reason not-linked (-1)