====== RTMP OS ====== Check [[documentation:rtmp]] for more info. {{tag>rtmp}} ===== Server Testing ===== * SVN - [[http://svn1.cvsdude.com/osflash/red5]] ===== Research ===== ==== The AMF Packet explaind (Mick Merres) ==== [[http://www.osflash.org/fetch.php?cache=cache&media=rtmp_spec.jpg|{{rtmp_spec.jpg?60}}]] [[http://www.osflash.org/fetch.php?cache=cache&media=rtmp_spec.jpg|(click to view full size image)]] * [[http://www.acmewebworks.com/Downloads/openCS/TheAMF.pdf|TheAMF.pdf file]] ==== MSN Discussion ==== * [[http://www.acmewebworks.com/Downloads/openCS/091305-initialMeeting.txt|MSN Chat where Mick starts to explain RTMP protocol]] * [[http://www.acmewebworks.com/Downloads/openCS/BitDump.ethr|Full capture of RTMP with Ethereal (for Mick's discussion)]] * [[http://www.acmewebworks.com/Downloads/openCS/BitText.zip|Text version of dump]] ==== Header Breakdown ==== The header comes in 4 sizes: * 12 bytes * 8 bytes * 4 bytes * 1 byte The 2 most significant bits (of this first byte) determine the header size * 03 <- initial AMF id byte * 00 00 01 <- unknown bytes. don't seem to be important * 00 01 05 <- body size (24 bit) * 14 <- AMF function call (sort of an AMF type... video == 09, audio == 08, sharedObject == 13) * 00 00 00 00 <- AMF Caller Source (00 00 00 00 is the flash player itself. each NetStream object will have its own value here) ==== FCS Files/code ==== * main.asc (clean) load( "components.asc" ); application.onConnectAccept = function( client) { trace( application.name + ":onConnectAccept "); } application.onConnect = function( newClient) { trace( application.name + ":onConnect " + newClient); application.acceptConnection(newClient); } ==== SharedObjects ==== The following informations have been found out by looking at the traffic that is sent between the flash client and the FCS in the "sample_noteroom" application. To request or update a SO, the client sends the following RTMP request: * [RTMP Header] * [SO Name (2+n bytes)] * [SO Version to operate on (4 bytes)] * [SO Encoding (4 bytes, usually "2")] * [unknown (4 bytes)] * [SO Request Type (1 byte)] * [SO Request Size (4 bytes)] * [SO Request Body (n bytes)] To get an initial SO, the version and the request size are set to "0". Therefore the request body is absent. To update a SO, the version is set to the version of the local SO, the request type is "3" and the body contains key / AMF object pairs. Be aware that you may not change the attributes of your local SO yourself as the FCS will generate messages for each of your changes. Depending on the requests the FCS receives from the different clients, it sends update events to all the clients that requested a SO. The format is described below. === Format of a SO as received by the FCS === * [RTMP Header] * [SO Header] * [SO Body Header] * [SO Body n] * [SO Body Header] * [SO Body m] * [...] == SO Header == * 2+n bytes: name of the SO * 4 bytes: version of the SO * 4 bytes: encoding of the SO (seems to be "2" always) * 4 bytes: unknown == SO Body Header (might be present multiple times) == * 1 byte: type of body part * 4: update data * 5: update attribute * 7: status (usually returned with error messages) * 9: delete data * 11: initial data * 4 bytes: size of body part == SO Body 4 - update data == (the following entries may appear multiple times; check using size of body part) * 2+n bytes: name of attribute * read amf object as value of attribute == SO Body 5 - update attribute == * 2+n bytes: name of attribute to update This is sent by the FCS after you sent a request to update your local copy of the SO to make your changes effective. == SO Body 7 - status == * 2+n bytes: status message * 2+n bytes: status type (sometimes "error") == SO Body 9 - delete data == * 2+n bytes: name of attribute to delete == SO Body 11 - initial data == (the following entries may appear multiple times; check using size of body part) * 1 byte: subtype * 4 bytes: subsize (if 0, the following fields don't exist) if subtype != 9 (delete data): read amf object as value of attribute else: delete attribute === MediaStreaming === ==== Tracing / Sniffing ==== * [[http://www.xk72.com/charles/|Charles]] * [[http://www.ethereal.com/download.html|Ethereal is for any OS]] - with [[http://www.winpcap.org/default.htm|WinPcap]] for Win included in current release * [[http://www.winpcap.org/misc/links.htm#tools|Lot of tools for windows]] ===== Links/Blogs ===== * [[http://osflash.org/doku.php?id=project:rtmp|Charle's start on RTMP]] ===== Yannick's Ruby Build ===== * [[http://www.acmewebworks.com/Downloads/openCS/rtmp_implementation_ruby.zip|Ruby RTMP test - Thanks Yannick Connan!]] - [[http://www.acmewebworks.com/Downloads/openCS/RTMP_Ruby_readme.txt|Yannicks Readme]] * [[http://www.acmewebworks.com/Downloads/openCS/rtmp_test.fla|John's Flash8 RTMP test file for use with Yannick's RTMP server sample]] === Get Ruby === * [[http://rubyinstaller.rubyforge.org/wiki/wiki.pl|Windows Install]]