[FFmpeg-devel] webm streaming

jianwen chen jianwen.chen.video at gmail.com
Thu May 19 01:49:17 CEST 2011


On Sat, May 14, 2011 at 11:43 PM, jianwen chen <jianwen.chen.video at gmail.com
> wrote:

> On Fri, May 13, 2011 at 12:01 AM, Dirk Griffioen <dirk at code-shop.com>wrote:
>
>>
>> >
>> > Great, on the website, it mentions "A live Matroska stream is different
>> than
>> > a file, because it may have no known end (only when the client
>> disconnects).
>> > For that the Segment *must* use the "unknow" size (all 1s in the size).
>> The
>> > other option would be to concatenate Segments with known sizes one after
>> the
>> > other. This solution allows a change of codec/resolution between each
>> > segment which can be useful in some cases (switch between 4:3 and 16:9
>> in
>> > some TV programs for example).  "
>> >
>> > I have test concatenate segments with know size together, but it dose
>> not
>> > work. Maybe the approach I try to concatenate the segments is not
>> correct.
>> > Is there anybody can help?
>> >
>>
>> I dont have time at the moment, but I would suggest to look at the
>> gstreamer patch
>>
>> there is also: http://realmike.org/
>>
>> which describes how to do it with a little python help (see the
>> matroska_live_filter.py script), this also might give valueable clue
>>
>
>
>  Thanks, Dirk,  I will read it. I hope I could figure it out and then I can
> contribute to this requirement in FFmpge.
>

I have read the code and the webpages, according to the code and the
Matroska specification, we know a live stream is designated by setting the
“Segment” size to “unknown”.  I set the size to a very large value and
setting the duration of the video to 100 hours as the python script does.
And I also delete the “SeekHead” elements ) and “Cues” elements in 2 mkv
files.

cat  1split-004-largesize-
changeduration-removeseekhead-recues.webm
2split-001-large-chaduration-rmseek-rmcue.webm > aaa.webm

But the file aaa.webm can only be played for the 1st segment.

What I want to do is concatenate the 2 segments together as a file and the
file can be played one segment by one segment.
Is there anything wrong above result in this?

The detailed info is followed:
File1
# mkvinfo 1split-004-largesize-changeduration-removeseekhead-recues.webm
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ EBML maximum size length: 8
|+ Doc type: webm
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size unknown
|+ EbmlVoid (size: 4045)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.0.0 + libmatroska v1.0.0
| + Writing application: mkvmerge v4.0.0 ('The Stars were mine') built on
Jun 17 2010 18:47:20
| + Duration: 2766143.488s (768:22:23.488)
| + Date: Wed May 11 06:02:42 2011 UTC
| + Segment UID: 0xfb 0x46 0x6a 0x88 0x4f 0xab 0xd3 0x94 0xa1 0xfd 0xf6 0xa7
0xba 0x5d 0x60 0x35
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 1
|  + Track type: video
|  + Default flag: 0
|  + MinCache: 1
|  + Codec ID: V_VP8
|  + Default duration: 41.708ms (23.976 fps for a video track)
|  + Language: und
|  + Video track
|   + Pixel width: 640
|   + Pixel height: 360
|   + Display width: 640
|   + Display height: 360
| + A track
|  + Track number: 2
|  + Track UID: 2
|  + Track type: audio
|  + Default flag: 0
|  + Codec ID: A_VORBIS
|  + CodecPrivate, length 4189
|  + Language: und
|  + Audio track
|   + Sampling frequency: 44100
|   + Channels: 2
|+ EbmlVoid (size: 1081)
|+ Cluster

File2
$ mkvinfo 2split-001-large-chaduration-rmseek-rmcue.webm
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ EBML maximum size length: 8
|+ Doc type: webm
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size unknown
|+ EbmlVoid (size: 4045)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.0.0 + libmatroska v1.0.0
| + Writing application: mkvmerge v4.0.0 ('The Stars were mine') built on
Jun 17 2010 18:47:20
| + Duration: 8585740.288s (2384:55:40.288)
| + Date: Wed May 11 06:09:38 2011 UTC
| + Segment UID: 0x12 0xea 0xf1 0x7f 0xb0 0x17 0x15 0x97 0xfb 0x67 0xd7 0x7b
0x91 0x28 0x2d 0xa3
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 1
|  + Track type: video
|  + Default flag: 0
|  + MinCache: 1
|  + Codec ID: V_VP8
|  + Default duration: 41.708ms (23.976 fps for a video track)
|  + Language: und
|  + Video track
|   + Pixel width: 640
|   + Pixel height: 360
|   + Display width: 640
|   + Display height: 360
| + A track
|  + Track number: 2
|  + Track UID: 2
|  + Track type: audio
|  + Default flag: 0
|  + Codec ID: A_VORBIS
|  + CodecPrivate, length 4189
|  + Language: und
|  + Audio track
|   + Sampling frequency: 44100
|   + Channels: 2
|+ EbmlVoid (size: 1081)
|+ Cluster


By the way, I find, if I just
 cat 1file 2 file > test.webm
without any modification of the original mkv files, the test webm file can
be played well by vlc, but can not played correctly by Mplayer.


Thanks,
Jianwen


More information about the ffmpeg-devel mailing list