[rtmpdump] Parsing an RTMPE URL

Anony Mous anonymous247 at gmail.com
Sun Apr 11 04:57:30 CEST 2010


Hey Howard,

Thanks for the info.  I tried your suggestion (with & without the 'mp4:' prefix), but neither seemed 
to work.  The first one looked like this:

rtmpe://cp45924.edgefcs.net/ondemand
?fcs_vhost=cp45924.edgefcs.net
&auth=dbEbUdPcIdjcZd9bTdycGafdObBaqb6bRdV-blWtBI-eS-iYG-uxF3roMCo
&aifp=v001
&slist=s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
  swfUrl=http://watch.ctv.ca/Flash/player.swf
  swfVfy=1
  playpath=s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4

with this as the sent data during the connect:

DEBUG2: RTMP_SendPacket: fd=21112, size=557
   0000:  03 00 00 00 00 02 2d 14  00 00 00 00               ......-.....
   0000:  02 00 07 63 6f 6e 6e 65  63 74 00 3f f0 00 00 00   ...connect.?....
   0010:  00 00 00 03 00 03 61 70  70 02 00 ab 6f 6e 64 65   ......app...onde
   0020:  6d 61 6e 64 3f 66 63 73  5f 76 68 6f 73 74 3d 63   mand?fcs_vhost=c
   0030:  70 34 35 39 32 34 2e 65  64 67 65 66 63 73 2e 6e   p45924.edgefcs.n
   0040:  65 74 26 61 75 74 68 3d  64 62 45 62 55 64 50 63   et&auth=dbEbUdPc
   0050:  49 64 6a 63 5a 64 39 62  54 64 79 63 47 61 66 64   IdjcZd9bTdycGafd
   0060:  4f 62 42 61 71 62 36 62  52 64 56 2d 62 6c 57 74   ObBaqb6bRdV-blWt
   0070:  42 49 2d 65 53 2d 69 59  47 2d 75 78 46 33 72 6f   BI-eS-iYG-uxF3ro
   0000:  c3                                                 .
   0000:  4d 43 6f 26 61 69 66 70  3d 76 30 30 31 26 73 6c   MCo&aifp=v001&sl
   0010:  69 73 74 3d 73 5f 21 63  74 76 2f 73 68 6f 77 73   ist=s_!ctv/shows
   0020:  2f 32 30 31 30 2f 30 33  2f 33 31 2f 41 4c 4c 4d   /2010/03/31/ALLM
   0030:  59 43 48 2d 31 30 33 34  34 2d 45 50 2e 43 4c 49   YCH-10344-EP.CLI
   0040:  50 30 31 2e 6d 70 34 00  06 73 77 66 55 72 6c 02   P01.mp4..swfUrl.
   0050:  00 24 68 74 74 70 3a 2f  2f 77 61 74 63 68 2e 63   .$http://watch.c
   0060:  74 76 2e 63 61 2f 46 6c  61 73 68 2f 70 6c 61 79   tv.ca/Flash/play
   0070:  65 72 2e 73 77 66 00 05  74 63 55 72 6c 02 00 c7   er.swf..tcUrl...
   0000:  c3                                                 .
   0000:  72 74 6d 70 65 3a 2f 2f  63 70 34 35 39 32 34 2e   rtmpe://cp45924.
   0010:  65 64 67 65 66 63 73 2e  6e 65 74 2f 6f 6e 64 65   edgefcs.net/onde
   0020:  6d 61 6e 64 3f 66 63 73  5f 76 68 6f 73 74 3d 63   mand?fcs_vhost=c
   0030:  70 34 35 39 32 34 2e 65  64 67 65 66 63 73 2e 6e   p45924.edgefcs.n
   0040:  65 74 26 61 75 74 68 3d  64 62 45 62 55 64 50 63   et&auth=dbEbUdPc
   0050:  49 64 6a 63 5a 64 39 62  54 64 79 63 47 61 66 64   IdjcZd9bTdycGafd
   0060:  4f 62 42 61 71 62 36 62  52 64 56 2d 62 6c 57 74   ObBaqb6bRdV-blWt
   0070:  42 49 2d 65 53 2d 69 59  47 2d 75 78 46 33 72 6f   BI-eS-iYG-uxF3ro
   0000:  c3                                                 .
   0000:  4d 43 6f 26 61 69 66 70  3d 76 30 30 31 26 73 6c   MCo&aifp=v001&sl
   0010:  69 73 74 3d 73 5f 21 63  74 76 2f 73 68 6f 77 73   ist=s_!ctv/shows
   0020:  2f 32 30 31 30 2f 30 33  2f 33 31 2f 41 4c 4c 4d   /2010/03/31/ALLM
   0030:  59 43 48 2d 31 30 33 34  34 2d 45 50 2e 43 4c 49   YCH-10344-EP.CLI
   0040:  50 30 31 2e 6d 70 34 00  04 66 70 61 64 01 00 00   P01.mp4..fpad...
   0050:  0c 63 61 70 61 62 69 6c  69 74 69 65 73 00 40 2e   .capabilities. at .
   0060:  00 00 00 00 00 00 00 0b  61 75 64 69 6f 43 6f 64   ........audioCod
   0070:  65 63 73 00 40 a8 ee 00  00 00 00 00 00 0b 76 69   ecs. at .........vi
   0000:  c3                                                 .
   0000:  64 65 6f 43 6f 64 65 63  73 00 40 6f 80 00 00 00   deoCodecs. at o....
   0010:  00 00 00 0d 76 69 64 65  6f 46 75 6e 63 74 69 6f   ....videoFunctio
   0020:  6e 00 3f f0 00 00 00 00  00 00 00 00 09            n.?..........
DEBUG: Invoking connect


If I use the 'mp4:' prefix, things look like this:

rtmpe://cp45924.edgefcs.net/ondemand?fcs_vhost=cp45924.edgefcs.net
&auth=dbEcBdbbJdic7c3cXdPdhbTcocSafdaa3ax-blWtHY-eS-iYG-vxF2soLCw
&aifp=v001
&slist=mp4:s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
  swfUrl=http://watch.ctv.ca/Flash/player.swf
  swfVfy=1
  playpath=mp4:s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4


DEBUG2: RTMP_SendPacket: fd=21212, size=565
   0000:  03 00 00 00 00 02 35 14  00 00 00 00               ......5.....
   0000:  02 00 07 63 6f 6e 6e 65  63 74 00 3f f0 00 00 00   ...connect.?....
   0010:  00 00 00 03 00 03 61 70  70 02 00 af 6f 6e 64 65   ......app...onde
   0020:  6d 61 6e 64 3f 66 63 73  5f 76 68 6f 73 74 3d 63   mand?fcs_vhost=c
   0030:  70 34 35 39 32 34 2e 65  64 67 65 66 63 73 2e 6e   p45924.edgefcs.n
   0040:  65 74 26 61 75 74 68 3d  64 62 45 63 42 64 62 62   et&auth=dbEcBdbb
   0050:  4a 64 69 63 37 63 33 63  58 64 50 64 68 62 54 63   Jdic7c3cXdPdhbTc
   0060:  6f 63 53 61 66 64 61 61  33 61 78 2d 62 6c 57 74   ocSafdaa3ax-blWt
   0070:  48 59 2d 65 53 2d 69 59  47 2d 76 78 46 32 73 6f   HY-eS-iYG-vxF2so
   0000:  c3                                                 .
   0000:  4c 43 77 26 61 69 66 70  3d 76 30 30 31 26 73 6c   LCw&aifp=v001&sl
   0010:  69 73 74 3d 6d 70 34 3a  73 5f 21 63 74 76 2f 73   ist=mp4:s_!ctv/s
   0020:  68 6f 77 73 2f 32 30 31  30 2f 30 33 2f 33 31 2f   hows/2010/03/31/
   0030:  41 4c 4c 4d 59 43 48 2d  31 30 33 34 34 2d 45 50   ALLMYCH-10344-EP
   0040:  2e 43 4c 49 50 30 31 2e  6d 70 34 00 06 73 77 66   .CLIP01.mp4..swf
   0050:  55 72 6c 02 00 24 68 74  74 70 3a 2f 2f 77 61 74   Url..$http://wat
   0060:  63 68 2e 63 74 76 2e 63  61 2f 46 6c 61 73 68 2f   ch.ctv.ca/Flash/
   0070:  70 6c 61 79 65 72 2e 73  77 66 00 05 74 63 55 72   player.swf..tcUr
   0000:  c3                                                 .
   0000:  6c 02 00 cb 72 74 6d 70  65 3a 2f 2f 63 70 34 35   l...rtmpe://cp45
   0010:  39 32 34 2e 65 64 67 65  66 63 73 2e 6e 65 74 2f   924.edgefcs.net/
   0020:  6f 6e 64 65 6d 61 6e 64  3f 66 63 73 5f 76 68 6f   ondemand?fcs_vho
   0030:  73 74 3d 63 70 34 35 39  32 34 2e 65 64 67 65 66   st=cp45924.edgef
   0040:  63 73 2e 6e 65 74 26 61  75 74 68 3d 64 62 45 63   cs.net&auth=dbEc
   0050:  42 64 62 62 4a 64 69 63  37 63 33 63 58 64 50 64   BdbbJdic7c3cXdPd
   0060:  68 62 54 63 6f 63 53 61  66 64 61 61 33 61 78 2d   hbTcocSafdaa3ax-
   0070:  62 6c 57 74 48 59 2d 65  53 2d 69 59 47 2d 76 78   blWtHY-eS-iYG-vx
   0000:  c3                                                 .
   0000:  46 32 73 6f 4c 43 77 26  61 69 66 70 3d 76 30 30   F2soLCw&aifp=v00
   0010:  31 26 73 6c 69 73 74 3d  6d 70 34 3a 73 5f 21 63   1&slist=mp4:s_!c
   0020:  74 76 2f 73 68 6f 77 73  2f 32 30 31 30 2f 30 33   tv/shows/2010/03
   0030:  2f 33 31 2f 41 4c 4c 4d  59 43 48 2d 31 30 33 34   /31/ALLMYCH-1034
   0040:  34 2d 45 50 2e 43 4c 49  50 30 31 2e 6d 70 34 00   4-EP.CLIP01.mp4.
   0050:  04 66 70 61 64 01 00 00  0c 63 61 70 61 62 69 6c   .fpad....capabil
   0060:  69 74 69 65 73 00 40 2e  00 00 00 00 00 00 00 0b   ities. at .........
   0070:  61 75 64 69 6f 43 6f 64  65 63 73 00 40 a8 ee 00   audioCodecs. at ...
   0000:  c3                                                 .
   0000:  00 00 00 00 00 0b 76 69  64 65 6f 43 6f 64 65 63   ......videoCodec
   0010:  73 00 40 6f 80 00 00 00  00 00 00 0d 76 69 64 65   s. at o........vide
   0020:  6f 46 75 6e 63 74 69 6f  6e 00 3f f0 00 00 00 00   oFunction.?.....
   0030:  00 00 00 00 09                                     .....
DEBUG: Invoking connect


I have to guess that the problem is with the app or tcUrl parameters in the connect packet.  Because 
the failure happens as part of the connect, it hasn't even gotten far enough to to send the 
playpath.  The app and tcUrl are the only important things I'm aware of in the connect packet.  I 
know capabilities, audiocodecs, videocodecs and videofunction are in there, but they're pretty hard 
coded.  There's also pageUrl, and I guess its possible I need to include that... but seems doubtful 
to me.

Any other suggestions?  Did I make a mistake somewhere along the way?

BTW: I've gotten librtmp compiling under win32/VisualStudio2008.  There were a bunch of edits made 
to allow things to compile under visual studio (it didn't like the implicit casts from void * that 
were done in librtmp).  Would anyone be interested in taking these changes into svn?



On 4/9/2010 11:40 PM, Howard Chu wrote:
> Anony Mous wrote:
>> Hello,
>>
>> So I've been experimenting with using librtmp (the latest version from
>> svn) integrated into XBMC.
>> For the most part things work well, but I've been having a problem
>> trying to connect to a video URL
>> from a flash based TV website in Canada named CTV (only accessible
>> from Canada I believe). I should
>> point out that I'm only having these problems because of the different
>> URL format of the RTMPE
>> streams. RTMP streams work fine, it is only the encrypted streams that
>> fail, and as I said, I think
>> it is because of the URL format, not an encryption issue. The complete
>> URL looks like this (notice,
>> I'm breaking it up across multiple lines to avoid 80 char line limits):
>>
>> rtmpe://cp45924.edgefcs.net/ondemand/s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
>>
>> ?auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt
>> &aifp=v001
>> &slist=/s_!ctv/shows/2010/03/31/
>
> Looks like your slist= part of the URL is truncated here.
>
>> So I take this URL and programatically change it to this before it is
>> passed to librtmp:
>>
>> rtmpe://cp45924.edgefcs.net/ondemand/s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
>>
>> swfUrl=http://watch.ctv.ca/Flash/player.swf
>> swfVfy=true
>> auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt
>> authflag=true
>> app=ondemand
>> tcUrl=/s_!ctv/shows/2010/03/31/
>>
>> So this results in a connect packet like this being sent out:
>
>> Now, I don't think the way this video service is unique in the way it
>> uses auth, aifp, and slist
>> params, I'm just hoping someone knows how to transform this URL format
>> into a connect packet that
>> will succeed. Any advice?
>
> That looks like a typical Akamai CDN URL. The librtmp auth= parameter is
> not what you think it is. I have no idea which CDN uses it, but Akamai
> definitely does not. For the most part, you should never use the auth=
> parameter.
>
> The correct URL for Akamai looks something like this:
>
> rtmpe://cp45924.edgefcs.net/ondemand?fcs_vhost=cp45924.edgefcs.net&auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt&aifp=v001&slist=s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
>
>
> Though I believe you also need to fix the filename and extension in this
> case:
>
> rtmpe://cp45924.edgefcs.net/ondemand?fcs_vhost=cp45924.edgefcs.net&auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt&aifp=v001&slist=mp4:s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
>
>
> (Not sure though. Try it both ways.)
>
> So the entire string to pass to librtmp should include
>
> rtmpe://cp45924.edgefcs.net/ondemand?fcs_vhost=cp45924.edgefcs.net&auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt&aifp=v001&slist=s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
> swfurl=whatever swfvfy=1
> playpath=s_!ctv/shows/2010/03/31/ALLMYCH-10344-EP.CLIP01.mp4
>
> I don't think it should need anything else.
>


More information about the rtmpdump mailing list