Command(2 bytes) Length(2 bytes) Data (length bytes) ... ... ... Data
Seq(4) ID(1) Flag(1) Length(2) Asf Data(length – 8) 保存:把所有的Asf Data写入本地文件中,接收完后,最后回写ASF_File_Properties_Object 几个重要的字段(File Size/File Size/Creation Date/Data Packets Count/Play Duration/Send Duration/Preroll/Flags),即为.asf文件了 00000000 48 54 54 50 2f 31 2e 30 20 32 30 30 20 4f 4b 0d HTTP/1.0 200 OK. ... 000000E0 6b 61 62 6c 65 2c 73 74 72 69 64 61 62 6c 65 22 kable,st ridable" 000000F0 0d 0a 0d 0a 000000F4 24 48 44 0b 00 00 00 00 00 04 44 0b 30 26 b2 75 $H D..... ..D.0&.u 00000104 8e 66 cf 11 a6 d9 00 aa 00 62 ce 6c 8f 0d 00 00 .f...... .b.l.... 00000114 00 00 00 00 09 00 00 00 01 02 a1 dc ab 8c 47 a9 ........ ......G. 00000124 cf 11 8e e4 00 c0 0c 20 53 65 68 00 00 00 00 00 ....... Seh..... ... <Type Header Structure>: 24 48 44 0b Command: 24 48 2448 “$H” Header packet follows 2444 “$D” Data (media) packet follows A444 “?D” Data (sometimes used instead of $D) 2445 “$E” End of stream 2443 “$C” Changing media – reload new media, new ASF header follows 244D “$M” Meta data follows (used for custom scripts) 2450 “$P” Packet pair data follows Length: 44 0b = 0b44 , Next header addr = 000000F4 + 0B44 + 4 = 00000C3C <Type Object>: 00 00 00 00 00 04 44 0b Seq: 00 00 00 00 Id: 00 (00=live 01=pre-recorded) Flag: 04 (00 = middle of packet, 04 = first packet 08 = last packet 0C = only one packe) <ASF header>: 30 26 b2 .. Asf header size = 8f 0d 00 00 00 00 00 00 = 0d8f = 2271 ASF_File_Properties_Object = 8CABDCA1-A947-11CF-8EE4-00C00C205365 = a1 dc ab 8c 47 a9 cf 11 8e e4 00 c0 0c 20 53 65 <asf header ...> Next addr = 00000C3C + 028D + 4 = 00000ECD 00000C3C 24 48 8d 02 01 00 00 00 00 08 8d 02 00 69 00 61 $H...... .....i.a 00000C4C 00 20 00 56 00 69 00 64 00 65 00 6f 00 20 00 39 . .V.i.d .e.o. .9 ... 00000E8C 84 00 00 02 00 2d a2 00 00 03 00 2d 8a 03 00 36 .....-.. ...-...6 00000E9C 26 b2 75 8e 66 cf 11 a6 d9 00 aa 00 62 ce 6c 0a &.u.f... ....b.l. 00000EAC f8 8f 00 00 00 00 00 8c 59 e9 68 6e 33 1d 47 8f ........ Y.hn3.G. 00000EBC 2f 57 6e 11 e0 37 c5 c3 0c 00 00 00 00 00 00 01 /Wn..7.. ........ 00000ECC 01 . 上面 36 26 ... 为 <Data object> 开始 <ASF data packet> Next addr = 00000ECD + 0b4f + 4 = 00001A20 Live, seq = 05e7, first frame, packet size= 0b4f – 8 = 0b47 = 2887 00000ECD 24 44 4f 0b e7 05 00 00 00 04 4f 0b 82 00 00 09 $DO..... ..O..... 00000EDD 5d 00 0d c8 01 00 0a 00 82 03 43 be 02 00 00 0a ]....... ..C..... 00000EED ea 03 00 00 80 d3 01 00 28 00 2c 01 07 d0 91 d0 ........ (.,..... <ASF data packet> Next addr = 00001A20 + 0b4f + 4 = 00002573 Live, seq = 05e8 00001A19 04 62 86 dd 4c 94 48 24 44 4f 0b e8 .b..L.H$ DO.. 00001A25 05 00 00 00 00 4f 0b 82 00 00 09 5d 00 18 c8 01 .....O.. ...].... 00001A35 00 5e 00 84 82 a9 ea 09 00 00 08 8e 0a 00 00 d0 .^...... ........ 00001A45 d3 01 00 a4 00 b4 c5 18 44 00 04 1f 2c 86 08 ac ........ D...,... .. <ASF data packet> Next addr = 00002573 + 0b4f + 4 = 000030C6 Live, seq = 05e9 00002561 16 fc 1c fc 85 00 63 4c e2 09 02 48 a2 08 07 b5 ......cL ...H.... 00002571 66 d4 24 44 4f 0b e9 05 00 00 00 00 f.$DO... .... 0000257D 4f 0b 82 00 00 09 5d 00 76 c8 01 00 6c 00 84 03 O.....]. v...l... 0000258D 46 83 02 00 00 0a 25 04 00 00 f8 d3 01 00 28 00 F.....%. ......(. ASF Format
Header Object File Properties Object Stream Properties Object 1 … Stream Properties Object N <Other header objects> Data Object Data Packet 1 … Data Packet M <Other top-level objects> Index Object 1 … Index Object K Simple Index Object 1 … Simple Index Object L The Header Object is represented using the following structure.
ASF_Header_Object 75B22630-668E-11CF-A6D9-00AA0062CE6C
Field name Field type Size (bytes) Object ID GUID 16 Object Size QWORD 8 Number of Header Objects DWORD 4 Reserved1 BYTE 1 Reserved2 BYTE 1 The File Properties Object is represented using the following structure.
ASF_File_Properties_Object 8CABDCA1-A947-11CF-8EE4-00C00C205365
Field name Field type Size (bits) Object ID GUID 128 Object Size QWORD 64 File ID GUID 128 File Size QWORD 64 Creation Date QWORD 64 Data Packets Count QWORD 64 Play Duration QWORD 64 Send Duration QWORD 64 Preroll QWORD 64 Flags DWORD 32 Broadcast Flag 1 (LSB) Seekable Flag 1 Reserved 30 Minimum Data Packet Size DWORD 32 Maximum Data Packet Size DWORD 32 Maximum Bitrate DWORD 32
File Properties Object (104 bytes) Property Value File Position 30 ( 0x1E ) Object ID 8CABDCA1-A947-11CF-8EE4-00C00C205365 Object Size 104 ( 0x68 ) Version 2 MMS ID 00022535-336E-471D-8F2F-576E11E037C5 Total Size 5074973 ( 0x4D701D ) Creation Time 2004-7-6 16:30:17.156 Packets 1756 Duration 02:23.597 Send Duration 02:20.597 Preroll 00:03.000 Flags 0x00000002 Broadcast 0 Seekable 1 Use Packet Template 0 Live 0 Reliable 0 Recordable 0 Unknown Data Size 0 Max Packet Size 2888 ( 0xB48 ) Min Packet Size 2888 ( 0xB48 ) Max Bitrate (bit/sec) 307485 The Data Object is represented using the following structure.
Field name Field type Size (bytes) Object ID GUID 16 Object Size QWORD 8 File ID GUID 16 Total Data Packets QWORD 8 Reserved WORD 2 Data Packets See section 5.2 varies
Data Object (not loaded) (9435146 bytes) Property Value File Position 3471 ( 0xD8F ) Object ID 75B22636-668E-11CF-A6D9-00AA0062CE6C Object Size 9435146 ( 0x8FF80A ) MMS ID 68E9598C-336E-471D-8F2F-576E11E037C5 Packets 3267 Alignment 1 Packet Aligment 1 Raw data dump Size 50 ( 0x32 ) Data 0000: 36 26 B2 75 8E 66 CF 11-A6 D9 00 AA 00 62 CE 6C 6& u f b l0010: 0A F8 8F 00 00 00 00 00-8C 59 E9 68 6E 33 1D 47 Y hn3 G0020: 8F 2F 57 6E 11 E0 37 C5-C3 0C 00 00 00 00 00 00 /Wn 7 0030: 01 01
