Ticket #2002 (reopened defect)
mms streaming always requests all streams
| Reported by: | gjdfgh | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | mms |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
The mms protocol can support multiple video streams. Each of these streams shows the same video, but at a different quality. This is intended to save bandwidth.
Looking at libavformat/mmsh.c, it seems all streams are requested, so that all streams are demuxable. This is not very useful, and in particular inteferes with the idea of saving bandwidth by selecting a single stream.
It should be possible for applications to select specific streams only. (This would prevent the server from sending packets for streams that are not wanted.)
The corresponding mms header for this is "Pragma: stream-switch-entry". mmsh.c just adds every stream to this.
mplayer handles this correctly.
Example stream: mms://wm.microsoft.com/ms/evnet/Vista_Diagnostics_s_ch9.wmv
Change History
comment:2 Changed 4 months ago by cehoyos
- Status changed from new to closed
- Resolution set to needs_more_info
Please reopen if you can add the missing information.
comment:3 Changed 4 months ago by gjdfgh
$ ffmpeg -i mmsh://wm.microsoft.com/ms/evnet/Vista_Diagnostics_s_ch9.wmv out.mkv
ffmpeg version 1.0.3 Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 24 2013 14:52:18 with gcc 4.7 (Debian 4.7.2-5)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/i386-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libdc1394 --disable-altivec --disable-armv5te --disable libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[asf @ 0x8091a60] max_analyze_duration 5000000 reached at 5184000
Guessed Channel Layout for Input Stream #0.0 : stereo
Guessed Channel Layout for Input Stream #0.1 : stereo
Guessed Channel Layout for Input Stream #0.4 : stereo
Input #0, asf, from 'mmsh://wm.microsoft.com/ms/evnet/Vista_Diagnostics_s_ch9.wmv':
Metadata:
title : Title
artist : Author
comment : Description
WMFSDKVersion : 10.00.00.3708
WMFSDKNeeded : 0.0.0.0000
IsVBR : 0
Duration: 00:57:44.92, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, stereo, s16, 40 kb/s
Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 16000 Hz, stereo, s16, 16 kb/s
Stream #0:2(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 320x240, 291 kb/s, 30 tbr, 1k tbn, 1k tbc
Stream #0:3(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 240x180, 86 kb/s, 30 tbr, 1k tbn, 1k tbc
Stream #0:4(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 8000 Hz, stereo, s16, 12 kb/s
Stream #0:5(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 160x120, 40 kb/s, 30 tbr, 1k tbn, 1k tbc
[libx264 @ 0x8090300] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x8090300] profile High, level 1.3
[libx264 @ 0x8090300] 264 - core 129 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'out.mkv':
Metadata:
title : Title
artist : Author
comment : Description
WMFSDKVersion : 10.00.00.3708
WMFSDKNeeded : 0.0.0.0000
IsVBR : 0
encoder : Lavf54.29.104
Stream #0:0(eng): Video: h264, yuv420p, 320x240, q=-1--1, 1k tbn, 30 tbc
Stream #0:1(eng): Audio: vorbis, 32000 Hz, stereo, flt
Stream mapping:
Stream #0:2 -> #0:0 (wmv3 -> libx264)
Stream #0:0 -> #0:1 (wmav2 -> libvorbis)
Press [q] to stop, [?] for help
[libvorbis @ 0x8077be0] Que input is backward in time
[matroska @ 0x808fc40] st:0 PTS: 146 DTS: 146 < 178 invalid, clipping
[output stream 0:1 @ 0x80796a0] 100 buffers queued in output stream 0:1, something may be wrong.
[libvorbis @ 0x8077be0] Que input is backward in time
Last message repeated 7 times
Que input is backward in timeze= 43kB time=00:00:05.66 bitrate= 62.5kbits/s
[libvorbis @ 0x8077be0] Que input is backward in time
Last message repeated 1 times
Que input is backward in timeze= 107kB time=00:00:07.69 bitrate= 114.2kbits/s
Que input is backward in timeze= 139kB time=00:00:08.54 bitrate= 133.5kbits/s
[libvorbis @ 0x8077be0] Que input is backward in time
Que input is backward in timeze= 203kB time=00:00:10.16 bitrate= 163.7kbits/s
Que input is backward in timeze= 247kB time=00:00:10.59 bitrate= 191.0kbits/s
Que input is backward in timeze= 279kB time=00:00:11.43 bitrate= 199.8kbits/s
[matroska @ 0x808fc40] st:0 PTS: 11519 DTS: 11519 < 11543 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11537 DTS: 11537 < 11543 invalid, clipping
[libvorbis @ 0x8077be0] Que input is backward in time
[matroska @ 0x808fc40] st:0 PTS: 11903 DTS: 11903 < 11927 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11907 DTS: 11907 < 11927 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11911 DTS: 11911 < 11927 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11915 DTS: 11915 < 11927 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11919 DTS: 11919 < 11927 invalid, clipping
[matroska @ 0x808fc40] st:0 PTS: 11923 DTS: 11923 < 11927 invalid, clipping
Que input is backward in timeze= 279kB time=00:00:12.34 bitrate= 185.1kbits/s
Que input is backward in timeze= 279kB time=00:00:12.51 bitrate= 182.6kbits/s
Que input is backward in timeze= 311kB time=00:00:13.10 bitrate= 194.4kbits/s
[libvorbis @ 0x8077be0] Que input is backward in time
Que input is backward in timeze= 399kB time=00:00:14.00 bitrate= 233.4kbits/s
[libvorbis @ 0x8077be0] Que input is backward in time
Que input is backward in timeze= 431kB time=00:00:14.91 bitrate= 236.6kbits/s
frame= 359 fps= 34 q=18194992.0 Lsize= 510kB time=00:00:15.90 bitrate= 262.8kbits/s
video:345kB audio:154kB subtitle:0 global headers:4kB muxing overhead 1.551715%
[libx264 @ 0x8090300] frame I:2 Avg QP:21.32 size: 19023
[libx264 @ 0x8090300] frame P:174 Avg QP:24.51 size: 1680
[libx264 @ 0x8090300] frame B:183 Avg QP:31.61 size: 119
[libx264 @ 0x8090300] consecutive B-frames: 25.9% 9.5% 26.7% 37.9%
[libx264 @ 0x8090300] mb I I16..4: 1.7% 69.2% 29.2%
[libx264 @ 0x8090300] mb P I16..4: 0.4% 1.2% 0.1% P16..4: 44.3% 7.7% 6.3% 0.0% 0.0% skip:40.1%
[libx264 @ 0x8090300] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 27.1% 0.7% 0.2% direct: 0.2% skip:71.8% L0:36.9% L1:55.4% BI: 7.7%
[libx264 @ 0x8090300] 8x8 transform intra:71.4% inter:71.6%
[libx264 @ 0x8090300] coded y,uvDC,uvAC intra: 76.5% 84.6% 35.1% inter: 13.6% 8.0% 0.8%
[libx264 @ 0x8090300] i16 v,h,dc,p: 28% 24% 27% 21%
[libx264 @ 0x8090300] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 26% 29% 3% 2% 3% 3% 9% 5%
[libx264 @ 0x8090300] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 23% 11% 7% 6% 6% 7% 13% 8%
[libx264 @ 0x8090300] i8c dc,h,v,p: 53% 24% 17% 6%
[libx264 @ 0x8090300] Weighted P-Frames: Y:0.6% UV:0.0%
[libx264 @ 0x8090300] ref P L0: 73.8% 17.8% 6.9% 1.5% 0.0%
[libx264 @ 0x8090300] ref B L0: 92.5% 7.0% 0.5%
[libx264 @ 0x8090300] ref B L1: 93.5% 6.5%
[libx264 @ 0x8090300] kb/s:235.45
Received signal 2: terminating.
You can see there are 3 pairs of video and audio streams. They contain the same video/audio in different quality, and I suppose the reason for this is saving bandwidth and getting realtime playback depending on the user's connection. libavformat should disable the streams that are not selected by the application. At least I think it doesn't do that, judging from the code. Demonstrating how mplayer actually saves bandwidth by disabling the other streams is hard.
comment:4 Changed 4 months ago by cehoyos
- Status changed from closed to reopened
- Resolution needs_more_info deleted
comment:5 Changed 4 months ago by DJX
Yes, the reason this stream has multiple streams is because WMS allows multi-encoding for different bitrates depending on client connection speed. This is implemented correctly, on the client side, in WMP as you can see by playing a stream and then selecting View-->Statistics. This should probably be changed to a "wish" because proper implementation is most like difficult to obtain. For now, you will probably just have to manually select which stream you wish to play.



Please add the (ffmpeg) command line together with complete, uncut console output to make this a valid ticket.