[Live-devel] Live streaming MKV video

mehdi semsarzadeh msemsarz at uottawa.ca
Wed Jan 25 12:11:03 PST 2017


Thanks for replying Ross,
I understand that MKV is a container and not used for streaming, but the
reason that I am using MKV is its ability to carry custom data within its
container (which is injected in gstreamer as buffer's timestamp).
I could manage to stream live MKV video using Live555 in certain conditions
and by doing some modifications. Here is more detailed explanation for
anyone who may be interested.

In order to stream pipe's containing live MKV info we should make sure that
Live555 is not seeking pipe at all. The are two possible cases where
Live555 seeks inside the stream:
1 - If the MKV stream has seek related content (like cue)

2 - MKV parser in Live555 parses portion of the file during creating an
instance of MatroskaFile (called in testMKVStreamer) and reads from start
of file again when startPlaying method (trackState[i].sink->startPlaying)
is called.

to solve the 1st seek issue we should give Live555 an stream which does not
need to perform any seek during streaming (in gstreamer you can disable
seeking by setting streamable=true for matroskamux element).

to solve the 2nd seeking issue we should modify doReadFromFile method in
ByteStreamFileSource class, to avoid reading any memory area more than
once.  To do so, we can save the first read from pipe in a buffer and avoid
reading the pipe for 2nd time and using the saved data in buffer, instead.
And after that continue normal read from pipe.
yours,
Mehdi


On Wed, Jan 18, 2017 at 4:19 PM, Ross Finlayson <finlayson at live555.com>
wrote:

> > I am trying to make a live555 rtsp server which streams live MKV video.
>
> The phrase “streams live MKV video” doesn’t really make much sense,
> because ‘MKV’ is a filename suffix that’s used for Matroska-format files.
>
> From reading the rest of your email, I gather that you’re trying to pipe a
> Matroska-format file - as it’s being created - to our
> “testOnDemandRTSPServer” demo application, which can stream from from a
> Matroska-format file.  That won’t work, because when a server is streaming
> from a Matroska-format file, it has to demultiplex the video (and audio, if
> present) from it, and this demultiplexing involves seeking within the file,
> rather than just reading through the file sequentially.  But you can’t
> ‘seek’ within a pipe; that’s probably why you’re getting a crash.
>
> As you discovered, you *can* pipe a media file to our server, but that
> will work only if the media file format is one (like “.h264”) that is read
> sequentially.
>
> It doesn’t really make much sense to try to stream a Matroska-format file
> as it’s being created.  Instead, just create a raw video stream, and stream
> that.  (Or else have our server read and stream the discrete media frames,
> as described in our FAQ.)
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20170125/347cff4c/attachment.html>


More information about the live-devel mailing list