<div dir="ltr"><div><div>Thanks for the info guys, in particular the mkvalidator tool.<br><br>Thiago, as to your first question, yes; when I play the files with my playback GStreamer application they perform much better. With my playback application the video streams might still skip around a bit, or one of them might get stuck on a frame, but they do always play through whereas with VLC they might not even play more than a frame.<br>
<br></div>I ran mkvalidator on a several of my output MKV files, and I only ever got these warnings/errors (with varying timestamps etc):<br><br>ERR200: Missing element 'Targets' in Tag at 47758217<br>WRN0C2: The timecode of the Cluster at 6177 is not incrementing (may be intentional)<br>
WRN311: The Cues entry for timecode 438 ms is listed after entry 559 ms<br>WRN0B8: Track #3 is defined but has no frame<br>ERR0B1: SimpleBlock at 2889352 track #2 is not a keyframe<br></div><div><br></div><div>Some more info:<br>
</div><div><br></div><div>ERR200 seems to occur once for every file.<br>WRN0C2 only shows up for a few files a couple of times.<br></div><div>WRN311 is the same as above, it shows up in some files a few times.<br></div><div>
WRN0B8 only happens if I don't add any subtitles to the subtitle track, so that's to be expected.<br>ERR0B1 seems to correlate most with how poorly my MKV file displays in VLC. For example, in a 17 second file (which VLC only manages the first second or so of) this error comes up 35 times. It definitely seems that this is the biggest issue. Files that play fairly well with VLC don't have many of these errors, but they still do have a few.<br>
<br></div><div>I'm not sure where to go from here, but at least now I know what the problems with the files are - so thanks a bunch for that. I'll have to try to figure out if it's something I'm doing which is causing these problems.<br>
<br>Thanks again<br></div><div><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 12, 2013 at 12:38 AM, Thiago Sousa Santos <span dir="ltr"><<a href="mailto:thiago.sousa.santos@collabora.com" target="_blank">thiago.sousa.santos@collabora.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Qua, 2013-09-11 at 18:55 +1200, Adam Goodwin wrote:<br>
> Hi again,<br>
><br>
><br>
> For my C application, which records multiple camera streams to file<br>
> (and kind of records subtitles), I've had plenty of issues with my MKV<br>
> files being played in unexpected ways by VLC. But if my pipeline only<br>
> ever records one stream to the MKV file, it seems to be perfect every<br>
> time. If there is more than one stream going into the matroskamux<br>
> (irrespective of it being a video or subtitle stream) this is when I<br>
> start getting problems with VLC; such as the progress through the<br>
> video not being correctly displayed.<br>
><br>
><br>
> I've now realised that I never made sure I was terminating the<br>
> recording properly. I don't think this is the one single cause of all<br>
> my application's problems, but I do remember that a guaranteed way to<br>
> get a broken MKV file is to not end the stream correctly.<br>
><br>
><br>
> Currently my application terminates upon user request. This is done<br>
> through standard input. When the command is entered by the user, my IO<br>
> callback recognises it and generates an EOS event as follows:<br>
><br>
> gst_element_send_event(pipeline, gst_event_new_eos());<br>
><br>
><br>
> Then, as per most of the examples in the manual, I watch the GStreamer<br>
> bus for a message of type GST_MESSAGE_EOS. When this message is seen,<br>
> I immediately call g_main_loop_quit(loop) and the pipeline is set to<br>
> GST_STATE_NULL before being deleted.<br>
><br>
><br>
> I don't know how exactly the sending of the EOS event works, but I<br>
> understand that the EOS *message* doesn't appear until all sinks in<br>
> the pipeline have received and handled the EOS event.<br>
><br>
><br>
> Out of curiosity I have tried sending an EOS event to every source<br>
> element, instead of just sending one to the pipeline as a whole, but<br>
> this has made no difference. I have verified though that if I miss a<br>
> source element out, then the EOS bus message doesn't arrive and the<br>
> application doesn't shut down.<br>
><br>
> So from this I am led to believe that the matroskamux doesn't emit the<br>
> EOS event from its source pad unless it has received one from all of<br>
> its sink pads. This would indicate to me that I am doing things<br>
> correctly, and that the MKV file should be getting terminated<br>
> correctly by the muxer, but it certainly doesn't work out that way.<br>
><br>
><br>
> Long story short, is my current approach correct? And if not, what is<br>
> the correct way to shut down my pipeline? (Thanks for reading all of<br>
> this!)<br>
<br>
</div></div>It should be the correct approach, yes. Have you checked if the<br>
resulting file could be played with gstreamer itself?<br>
<br>
gst-launch-1.0 playbin uri=file:///path/to/file<br>
<br>
Or maybe inspecting the file with some mkv parsing tool:<br>
<a href="http://www.matroska.org/downloads/mkvalidator.html" target="_blank">http://www.matroska.org/downloads/mkvalidator.html</a><br>
<a href="http://www.bunkus.org/videotools/mkvtoolnix/" target="_blank">http://www.bunkus.org/videotools/mkvtoolnix/</a><br>
<br>
It could also be a bug in VLC itself.<br>
<br>
--<br>
Thiago<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br></div>