<div dir="ltr"><div dir="ltr"><div><br></div><div>Thanks a lot, that's good to know (it was not actually what I was asking, but will prove very useful).</div><div><br></div><div>I'm still getting started with GStreamer so I'm not very used to its syntax or workings. Namely, I do need to implement the pipeline in C (although I know there is a C function that can interpret a string description of a gst-launch pipeline, but I'd prefer to do everything in C).I am having trouble translating the last part to C:</div><div><br></div><div>mux.audio_%u splitmuxsink muxer-factory=oggmux name=mux max-size-time=10000000000 location=file-%02u.ogg</div><div><br></div><div>More specifically, the parts "mux.audio_%u" and "muxer-factory=oggmux name=mux", I can't understand what they mean (even after reading gst-launch docs, maybe I'm missing something, please bare with me). This is what I've come up with so far, but it is clearly not working:<br></div><div><br></div><div>===</div><div>[...]<br></div><div> GstElement *encoder = gst_element_factory_make("vorbisenc", "encoder");<br> GstElement *identity = gst_element_factory_make("identity", "identity");<br> GstElement *sink = gst_element_factory_make("splitmuxsink", "sink");</div><div><br> GstElement *pipeline = gst_pipeline_new("test-pipeline");<br><br> g_object_set(identity, "drop-buffer-flags", GST_BUFFER_FLAG_HEADER, NULL);<br> g_object_set(sink, "muxer-factory", "oggmux", NULL);<br> g_object_set(sink, "max-size-time", 10000000000 NULL);<br><br> gst_bin_add_many(GST_BIN(pipeline), source, parser, decoder, converter, encoder, sink, NULL);<br> if (gst_element_link_many(source, parser, decoder, converter, encoder, sink, NULL) != TRUE) {<br> gst_object_unref(pipeline);<br> return -1;<br> }</div><div>===</div></div><div dir="ltr"><br></div><div>The debug log shows the following:</div><div><br></div><div>0:00:00.023683677 97 0x5560d44bd2a0 INFO GST_PADS gstpad.c:2532:gst_pad_link_full: link between encoder:src and sink:video failed: no common format<br>0:00:00.023692657 97 0x5560d44bd2a0 INFO splitgenmuxsink gstsplitgenmuxsink.c:3292:gst_splitgenmux_sink_release_pad:<sink:video> releasing request pad<br>0:00:00.023701245 97 0x5560d44bd2a0 INFO GST_EVENT gstpad.c:5946:gst_pad_send_event_unchecked:<queue_video:sink> Received event on flushing pad. Discarding<br>0:00:00.023711442 97 0x5560d44bd2a0 INFO GST_STATES gstelement.c:2806:gst_element_continue_state:<queue_video> completed state change to NULL</div><div><br></div><div>I believe it has to do with the fact the sink (presumably splitmuxsink) is using a video pad template, and that's why you set name=mux (presumably to name splitmuxsink as "mux") and added mux.audio_%d, to hint splitmuxsink to instead use pad template audio_%d. Unfortunately I don't know nearly enough to understand what's actually going on, or how to actually implement it in C...</div><div><br></div><div>Any help would be appreciated!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 25 Mar 2022 at 12:38, Tim-Philipp Müller <<a href="mailto:t.i.m@zen.co.uk">t.i.m@zen.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 2022-03-25 at 10:01 +0000, Diogo Rodrigues via gstreamer-devel<br>
wrote:<br>
<br>
Hi,<br>
<br>
> I would like to create a pipeline that takes in a single mp3 audio<br>
> file and splits it into several 10-second vorbis/ogg files, but I'm<br>
> having issues linking the elements.<br>
> <br>
> I have already made a similar pipeline that takes a single mp3 audio<br>
> file and splits it into several 10-second mp3 files with Xing headers<br>
> by using lamemp3enc instead of vorbisenc, and xingmux instead of<br>
> oggmux. The mp3-to-mp3 pipeline works just fine, but the mp3-to-ogg<br>
> is not doing so well, because splitmuxsink is not being able to link<br>
> the muxer (vorbisenc) with the sink (oggmux+filesink).<br>
<br>
Theoretically splitmuxsink should be able to do just that.<br>
<br>
Unfortunately it looks like there's a bug in splitmuxsink that's<br>
specific to Vorbis/Ogg (vorbisenc will output a few header packets<br>
without a timestamp), so you get this:<br>
<br>
gst-launch-1.0 uridecodebin uri=file:///path/to/foo.mp3 ! audioconvert<br>
! vorbisenc ! mux.audio_%u splitmuxsink muxer-factory=oggmux name=mux<br>
<br>
ERROR: from element /GstPipeline:pipeline0/GstSplitMuxSink:mux:<br>
Timestamping error on input streams<br>
<br>
Additional debug info:<br>
../gst/multifile/gstsplitmuxsink.c(2594): handle_gathered_gop ():<br>
/GstPipeline:pipeline0/GstSplitMuxSink:mux:<br>
Queued GOP time is negative +99:99:99.999999999<br>
<br>
Needs fixing I'm afraid, but it looks like you can work around it with<br>
an identity element like this:<br>
<br>
gst-launch-1.0 uridecodebin uri=file:///path/to/foo.mp3 ! audioconvert<br>
! vorbisenc ! identity drop-buffer-flags=header ! mux.audio_%u<br>
splitmuxsink muxer-factory=oggmux name=mux max-size-time=10000000000<br>
location=file-%02u.ogg<br>
<br>
Cheers<br>
Tim<br>
<br>
</blockquote></div></div>