<div dir="ltr"><div><div><div><div><div><div><div><div>Hi again,<br><br></div>For my C application, which records multiple camera streams to file (and kind of records subtitles), I've had plenty of issues with my MKV files being played in unexpected ways by VLC. But if my pipeline only ever records one stream to the MKV file, it seems to be perfect every time. If there is more than one stream going into the matroskamux (irrespective of it being a video or subtitle stream) this is when I start getting problems with VLC; such as the progress through the video not being correctly displayed.<br>
</div><br> I've now realised that I never made sure I was terminating the recording properly. I don't think this is the one single cause of all my application's problems, but I do remember that a guaranteed way to get a broken MKV file is to not end the stream correctly.<br>
<br></div>Currently my application terminates upon user request. This is done through standard input. When the command is entered by the user, my IO callback recognises it and generates an EOS event as follows:<br><br>gst_element_send_event(pipeline, gst_event_new_eos());<br>
<br></div>Then, as per most of the examples in the manual, I watch the GStreamer bus for a message of type GST_MESSAGE_EOS. When this message is seen, I immediately call g_main_loop_quit(loop) and the pipeline is set to GST_STATE_NULL before being deleted.<br>
<br></div>I don't know how exactly the sending of the EOS event works, but I understand that the EOS *message* doesn't appear until all sinks in the pipeline have received and handled the EOS event.<br><br></div></div>
</div><div>Out of curiosity I have tried sending an EOS event to every source element, instead of just sending one to the pipeline as a whole, but this has made no difference. I have verified though that if I miss a source element out, then the EOS bus message doesn't arrive and the application doesn't shut down.<br>
<br>So from this I am led to believe that the matroskamux doesn't emit the EOS event from its source pad unless it has received one from all of its sink pads. This would indicate to me that I am doing things correctly, and that the MKV file should be getting terminated correctly by the muxer, but it certainly doesn't work out that way.<br>
<br></div><div>Long story short, is my current approach correct? And if not, what is the correct way to shut down my pipeline? (Thanks for reading all of this!)<br></div></div>