[FFmpeg-devel] RTSP-MS support

Ronald S. Bultje rsbultje
Mon Nov 17 23:17:41 CET 2008


Hi,

no Michael you don't have to review this, this is just for those that
want to play around. I'll split it for proper inclusion.

Anyway, the attached patch adds some sort of rudimentary, crude
support for RTSP as server by MS servers. It's mostly
standard-compliant, and it's also nicely documented [1], so that helps
a lot. Inside is basically a set of RTSP streams, each with their own
m= line, and the server, by default, serves all of them, thus making
stream selection very easy if you ahve the bandwidth. I don't know how
to do stream selection server-side yet, but I'll surely find out.
Here's a complete SDP:

sdp: v='0'
sdp: o='- 200810280831200796 200810280831200796 IN IP4 127.0.0.1'
sdp: s='Absolute Radio - LIVE from London, UK'
sdp: c='IN IP4 0.0.0.0'
sdp: b='AS:286'
sdp: a='maxps:5976'
sdp: t='0 0'
sdp: a='control:rtsp://wm.as34763.net/vruk_vr_hi/'
sdp: a='etag:{4A45E73C-2D24-DB2F-DDA1-D8CAF856BFFA}'
sdp: a='range:npt=3.000-3.000'
sdp: a='type:broadcast'
sdp: a='recvonly'
sdp: a='pgmpu:data:application/x-wms-contentdesc,8,language,31,0,,44,WMS_CONTENT_DESCRIPTION_SERVER_BRANDING_INFO,31,12,WMServer/9.1,30,WMS_CONTENT_DESCRIPTION_RATING,31,1,U,35,WMS_CONTENT_DESCRIPTION_DESCRIPTION,31,37,Absolute%20Radio%20-%20LIVE%20from%20London,%20UK,9,copyright,31,14,TIML%20Radio%20Ltd,6,author,31,12,Virgin%20Radio,5,title,31,37,Absolute%20Radio%20-%20LIVE%20from%20London,%20UK,51,WMS_CONTENT_DESCRIPTION_PLAYLIST_ENTRY_START_OFFSET,3,4,3000,47,WMS_CONTENT_DESCRIPTION_PLAYLIST_ENTRY_DURATION,3,1,0,58,WMS_CONTENT_DESCRIPTION_COPIED_METADATA_FROM_PLAYLIST_FILE,3,1,1,42,WMS_CONTENT_DESCRIPTION_PLAYLIST_ENTRY_URL,31,1,/%0D%0A'
sdp: a='pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,<base64
data omitted, it's very long>'
sdp: m='audio 0 RTP/AVP 96'
sdp: b='AS:129'
sdp: b='X-AV:129'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-asf-pf/1000'
sdp: a='control:stream=1'
sdp: a='stream:1'
sdp: m='application 0 RTP/AVP 96'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-wms-rtx/1000'
sdp: a='control:rtx'
sdp: a='stream:65536'
sdp: m='audio 0 RTP/AVP 96'
sdp: b='AS:97'
sdp: b='X-AV:97'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-asf-pf/1000'
sdp: a='control:stream=2'
sdp: a='stream:2'
sdp: m='audio 0 RTP/AVP 96'
sdp: b='AS:33'
sdp: b='X-AV:32'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-asf-pf/1000'
sdp: a='control:stream=3'
sdp: a='stream:3'
sdp: m='audio 0 RTP/AVP 96'
sdp: b='AS:21'
sdp: b='X-AV:21'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-asf-pf/1000'
sdp: a='control:stream=4'
sdp: a='stream:4'
sdp: m='application 0 RTP/AVP 96'
sdp: b='AS:6'
sdp: b='X-AV:4'
sdp: b='RS:0'
sdp: b='RR:0'
sdp: a='rtpmap:96 x-asf-pf/1000'
sdp: a='control:stream=5'
sdp: a='stream:5'

The "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64" before the m=
lines contains a complete ASF header. You can cat the ASF headers
together with the data packets and you'll get a playable ASF file.
Therefore, playback is simple, just set up an ASF demuxer context,
send the ASF header and then the data in the RTP packets and it'll
work. The rest is just refactoring of the ASF demuxer to fit this data
pushing and some additions to the rtsp.c code to work properly with MS
servers, which isn't difficult.

The actual RTP packets are standard compliant. The data inside the RTP
is a small header, as in 2.2.1.3 of [1], it contains a
timestamp/duration (optionally) and a length field that can be used to
split ASF packets over multiple ASF packets. My test server just uses
1 ASF == 1 RTP packet, so that's all that my code supports right now.
After that comes a plain ASF packet, which can contain one or multiple
audio packets, similar to in ASF files.

Sound quality isn't great (there's some cracks and skips), but that
may be bandwidth-dependent or so, I didn't check very closely... I may
also screw up with data padding somewhere, again, don't flame me yet
for that, I'm happy enough to see it work at all. :-). I'll try to get
this in together with RDT/RTSP as we go...

Ronald

[1] http://msdn.microsoft.com/en-us/library/cc245238.aspx
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rtsp-ms.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081117/d62b4f87/attachment.txt>



More information about the ffmpeg-devel mailing list