Hi,
I’m working on a project to split streaming in a Go server utilizing splitmuxsink. Due to the go-gst version issue, the current pipeline can only work in async-finalize mode. It works well with MP4 and WebM streaming.
Now the requirement is to support splitting raw audio into WAV files. And I found it’s not as easy as setting muxer-factory with wavenc.
Some situation:
- The CLI, “gst-launch-1.0 osxaudiosrc! splitmuxsink location=out_%d.wav muxer=wavenc max-size-time=10000000000”, works well. But by checking GST logs, I suppose it works in sync mode, e.g. async-finalize = FALSE. Is that true?
- In async-finalize mode, the first fragment can be generated normally, but it seems GST fails to create new muxer/sink for the following fragments. Can’t understand why…
Some key code snippets from a standalone test on Mac (same operations without error handling):
gst.Init(nil)
pipeline, _ := gst.NewPipeline("pipeline")
src, _ := gst.NewElement("osxaudiosrc")
sink, _ := gst.NewElement("splitmuxsink")
sink.SetProperty("max-size-time", uint64(2000000000))
sink.SetProperty("async-finalize", true)
sink.SetProperty("muxer-factory", "wavenc")
sink.SetProperty("sink-factory", "appsink")
sink.Connect("sink-added", func(self *gst.Element, sink *gst.Element) {
appSink := app.SinkFromElement(sink)
appSink.SetCallbacks(&appSinkCallbacks)
})
pipeline.AddMany(src, sink)
src.GetStaticPad("src").Link((sink.GetRequestPad("audio_%u")))
pipeline.Start()
Above codes can generate the first wav file. When the second fragment is created, got below error from GST:
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.464: gst_element_request_pad: assertion 'templ->presence == GST_PAD_REQUEST' failed
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.467: gst_pad_link_full: assertion 'GST_IS_PAD (sinkpad)' failed
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.467: gst_element_release_request_pad: assertion 'GST_IS_PAD (pad)' failed
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.467: gst_object_unref: assertion 'object != NULL' failed
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.467: gst_pad_send_event: assertion 'GST_IS_PAD (pad)' failed
(<unknown>:78065): GStreamer-CRITICAL **: 15:51:07.467: gst_object_unref: assertion 'object != NULL' failed
I noticed that the difference between mp4mux/webmmux and wavenc is mp4mux/webmmux has the pad templates " audio_%u" and wavenc has sink
instead. Does this matter?
So my questions are:
- Is it possible that splitmuxsink works with wavenc in async mode?
- if it’s possible, then what’s missing/wrong in my practice?
Tested with GST 1.22.5 and 1.24.2.
Thanks in advance! And let me know if any other info is needed.