[Friday 06 August 2010] [13:04:41] q. im trying to make an http server able to serve mkv live stream, i would like to avoid parsing the whole mkv if possible. basically i need to get the headers and to locate the keyframe. is there a code i would look at ? what would be your suggestion to do this ?
[Friday 06 August 2010] [13:18:04] live as is continous ? or from a file source ?
[Friday 06 August 2010] [13:18:51] robUUUU: as in continuous
[Friday 06 August 2010] [13:19:00] i read the webcam and stream the result
[Friday 06 August 2010] [13:19:17] Whois robUUUU is ~robUx4@AToulouse-553-1-181-199.w90-55.abo.wanadoo.fr (Steve Lhomme)
[Friday 06 August 2010] [13:19:17] Whois robUUUU is a user on channels: #matroska #videolan
[Friday 06 August 2010] [13:19:17] Whois robUUUU is online via holmes.freenode.net (London, UK).
[Friday 06 August 2010] [13:19:17] Whois robUUUU has been idle for 1 minute and 13 seconds.
[Friday 06 August 2010] [13:19:17] Whois robUUUU has been online since 2010-08-06 09:27:05.
[Friday 06 August 2010] [13:19:17] Whois End of WHOIS list.
[Friday 06 August 2010] [13:19:19] so where would you get "headers" from ?
[Friday 06 August 2010] [13:19:53] I assume your webcam is not streaming in mkv already
[Friday 06 August 2010] [13:19:53] robUUUU: from the original stream. my stuff is only a http server which echo the "stream producer"
[Friday 06 August 2010] [13:20:11] so at least you need to pack the audio and video frames in Matroska blocks and clusters
[Friday 06 August 2010] [13:20:55] and for each connection you send a Matroska header and then your continuous flow of "muxed" data
[Friday 06 August 2010] [13:21:00] robUUUU: so i get vlc/ffmpeg/etc... to read webcam and output mkv, and only then my code checksin to read the stream from vlc/ffmpeg/etc and echo it
[Friday 06 August 2010] [13:21:01] gstreamer can already do that
[Friday 06 August 2010] [13:21:25] gstreamer (fluendo/flumotion) can already stream live matroska
[Friday 06 August 2010] [13:21:30] robUUUU: i understand. but i need it in my code
[Friday 06 August 2010] [13:21:50] so what is your source ?
[Friday 06 August 2010] [13:22:23] robUUUU: it may be gstreamer, or vlc or ffmpeg, not that relevant it itself from my code pov
[Friday 06 August 2010] [13:22:25] your source is a matroska continuous stream ?
[Friday 06 August 2010] [13:22:32] yes it's relevant
[Friday 06 August 2010] [13:22:44] some of them provided a stream you don't even need to modify
[Friday 06 August 2010] [13:23:00] robUUUU: ok say i got a gstreamer server providing the mkv live stream
[Friday 06 August 2010] [13:23:26] really ? i would love that. which ones may work without modification
[Friday 06 August 2010] [13:23:45] so for each new connection you send a Matroska header (segment info, track info) and then you just dump the clusters from your source to your client
[Friday 06 August 2010] [13:23:57] like I said, gstreamer can do that
[Friday 06 August 2010] [13:24:16] robUUUU: do you know the part of gstreamer doing that ?
[Friday 06 August 2010] [13:24:48] for streamers that are not "live aware" you may need to alter the cluster timecode, as the original may have a bogus reference, but otherwise you could just dump the packets too
[Friday 06 August 2010] [13:25:28] in any case you need to send the Matroska header and detect a cluster start in your source stream, from that point just dumping the source data to the output may work
[Friday 06 August 2010] [13:25:41] robUUUU: for somebopdy experienced in general, but without prior knowledge of mkv, how hard it is to code this ? rought estimation is ok
[Friday 06 August 2010] [13:25:45] this is just to have an idea
[Friday 06 August 2010] [13:25:48] no I don't know how gtsreamer does it, and it may be part of fluendo only
[Friday 06 August 2010] [13:26:21] the header could be hardcoded if your source is always the same
[Friday 06 August 2010] [13:27:00] robUUUU: ok i will look more
[Friday 06 August 2010] [13:27:02] then finding a cluster start is easy, just look for a specific 4 byte sequence, followed by something that looks like a valid size for a clustr
[Friday 06 August 2010] [13:27:23] mkclean --live can remux a matroska file to look like a live stream
[Friday 06 August 2010] [13:27:45] you could just dump the head of the file as your streaming source
[Friday 06 August 2010] [13:28:13] if you want a quick & dirty solution
[Friday 06 August 2010] [13:28:32] as i already did this for flv, i get i could do the same for mkv without much trouble
[Friday 06 August 2010] [13:28:45] robUUUU: thanks a lot for your answers
[Friday 06 August 2010] [13:29:26] you're welcome :)
chat i had on #matroska freenode
[Friday 06 August 2010] [13:04:41] q. im trying to make an http server able to serve mkv live stream, i would like to avoid parsing the whole mkv if possible. basically i need to get the headers and to locate the keyframe. is there a code i would look at ? what would be your suggestion to do this ?
[Friday 06 August 2010] [13:18:04] live as is continous ? or from a file source ?
[Friday 06 August 2010] [13:18:51] robUUUU: as in continuous
[Friday 06 August 2010] [13:19:00] i read the webcam and stream the result
[Friday 06 August 2010] [13:19:17] Whois robUUUU is ~robUx4@AToulouse-553-1-181-199.w90-55.abo.wanadoo.fr (Steve Lhomme)
[Friday 06 August 2010] [13:19:17] Whois robUUUU is a user on channels: #matroska #videolan
[Friday 06 August 2010] [13:19:17] Whois robUUUU is online via holmes.freenode.net (London, UK).
[Friday 06 August 2010] [13:19:17] Whois robUUUU has been idle for 1 minute and 13 seconds.
[Friday 06 August 2010] [13:19:17] Whois robUUUU has been online since 2010-08-06 09:27:05.
[Friday 06 August 2010] [13:19:17] Whois End of WHOIS list.
[Friday 06 August 2010] [13:19:19] so where would you get "headers" from ?
[Friday 06 August 2010] [13:19:53] I assume your webcam is not streaming in mkv already
[Friday 06 August 2010] [13:19:53] robUUUU: from the original stream. my stuff is only a http server which echo the "stream producer"
[Friday 06 August 2010] [13:20:11] so at least you need to pack the audio and video frames in Matroska blocks and clusters
[Friday 06 August 2010] [13:20:55] and for each connection you send a Matroska header and then your continuous flow of "muxed" data
[Friday 06 August 2010] [13:21:00] robUUUU: so i get vlc/ffmpeg/etc... to read webcam and output mkv, and only then my code checksin to read the stream from vlc/ffmpeg/etc and echo it
[Friday 06 August 2010] [13:21:01] gstreamer can already do that
[Friday 06 August 2010] [13:21:25] gstreamer (fluendo/flumotion) can already stream live matroska
[Friday 06 August 2010] [13:21:30] robUUUU: i understand. but i need it in my code
[Friday 06 August 2010] [13:21:50] so what is your source ?
[Friday 06 August 2010] [13:22:23] robUUUU: it may be gstreamer, or vlc or ffmpeg, not that relevant it itself from my code pov
[Friday 06 August 2010] [13:22:25] your source is a matroska continuous stream ?
[Friday 06 August 2010] [13:22:32] yes it's relevant
[Friday 06 August 2010] [13:22:44] some of them provided a stream you don't even need to modify
[Friday 06 August 2010] [13:23:00] robUUUU: ok say i got a gstreamer server providing the mkv live stream
[Friday 06 August 2010] [13:23:26] really ? i would love that. which ones may work without modification
[Friday 06 August 2010] [13:23:45] so for each new connection you send a Matroska header (segment info, track info) and then you just dump the clusters from your source to your client
[Friday 06 August 2010] [13:23:57] like I said, gstreamer can do that
[Friday 06 August 2010] [13:24:16] robUUUU: do you know the part of gstreamer doing that ?
[Friday 06 August 2010] [13:24:48] for streamers that are not "live aware" you may need to alter the cluster timecode, as the original may have a bogus reference, but otherwise you could just dump the packets too
[Friday 06 August 2010] [13:25:28] in any case you need to send the Matroska header and detect a cluster start in your source stream, from that point just dumping the source data to the output may work
[Friday 06 August 2010] [13:25:41] robUUUU: for somebopdy experienced in general, but without prior knowledge of mkv, how hard it is to code this ? rought estimation is ok
[Friday 06 August 2010] [13:25:45] this is just to have an idea
[Friday 06 August 2010] [13:25:48] no I don't know how gtsreamer does it, and it may be part of fluendo only
[Friday 06 August 2010] [13:26:21] the header could be hardcoded if your source is always the same
[Friday 06 August 2010] [13:27:00] robUUUU: ok i will look more
[Friday 06 August 2010] [13:27:02] then finding a cluster start is easy, just look for a specific 4 byte sequence, followed by something that looks like a valid size for a clustr
[Friday 06 August 2010] [13:27:23] mkclean --live can remux a matroska file to look like a live stream
[Friday 06 August 2010] [13:27:45] you could just dump the head of the file as your streaming source
[Friday 06 August 2010] [13:28:13] if you want a quick & dirty solution
[Friday 06 August 2010] [13:28:32] as i already did this for flv, i get i could do the same for mkv without much trouble
[Friday 06 August 2010] [13:28:45] robUUUU: thanks a lot for your answers
[Friday 06 August 2010] [13:29:26] you're welcome :)