rm文件格式.docx

上传人:b****6 文档编号:8183330 上传时间:2023-01-29 格式:DOCX 页数:11 大小:21.12KB
下载 相关 举报
rm文件格式.docx_第1页
第1页 / 共11页
rm文件格式.docx_第2页
第2页 / 共11页
rm文件格式.docx_第3页
第3页 / 共11页
rm文件格式.docx_第4页
第4页 / 共11页
rm文件格式.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

rm文件格式.docx

《rm文件格式.docx》由会员分享,可在线阅读,更多相关《rm文件格式.docx(11页珍藏版)》请在冰豆网上搜索。

rm文件格式.docx

rm文件格式

RealMediaFormat

Thisisthenewerformatwhichstoresbothaudioandvideo.Allmulti-bytenumbersarestoredinbig-endianformat.

ARealMediafileconsistsofaseriesofchunks.Eachchunkhasthefollowingformat:

dwordchunktype(FOURCC)

dwordchunksize,including8-bytepreamble

wordchunkversion

byte[]chunkpayload

Realchunktypes:

∙.RMF:

RealMediafileheader(onlyoneperfile,mustbethefirstchunk)

∙PROP:

Fileproperties(onlyoneperfile)

∙MDPR:

Streamproperties(oneforeachstream)

∙CONT:

Contentdescription/metadata(typicallyoneperfile)

∙DATA:

Filedata

∙INDX:

Fileindex(typicallyoneperstream)

RealMediafileheader(.RMF)

ThismustbethefirstchunkinaRealMediafile.Onlyone.RMFcanbepresentinafile.Theonlyusefulinformationcarriedby.RMFisthenumberofheaders.

A.RMFchunkhasthefollowingformat

dwordchunktype('.RMF')

dwordchunksize(typically0x12)

wordchunkversion(always0,foreveryknownfile)

dwordfileversion

dwordnumberofheaders

Filepropertiesheader(PROP)

ThischunkcontainssomeinformationaboutthegeneralpropertiesofaRealMediafile.OnlyonePROPchunkcanbepresentinafile.

APROPchunkhasthefollowingformat

dwordChunktype('PROP')

dwordChunksize(typically0x32)

wordChunkversion(always0,foreveryknownfile)

dwordMaximumbitrate

dwordAveragebitrate

dwordSizeoflargestdatapacket

dwordAveragesizeofdatapacket

dwordNumberofdatapacketsinthefile

dwordFiledurationinms

dwordSuggestednumberofmstobufferbeforestartingplayback

dwordOffsetofthefirstINDXchunkformthestartofthefile

dwordOffsetofthefirstDATAchunkformthestartofthefile

wordNumberofstreamsinthefile

wordFlags(bitfield,seebelow)

Flags:

∙bit0:

filecanbesavedondisk

∙bit1:

PerfectPlaycanbeused(extrabuffering)

∙bit2:

thefileisalivebroadcast

Mediapropertiesheader(MDPR)

ThischunkcontainsinformationaboutthepropertiesofaRealMediastream.Thisheaderdefinesthetypeofastreamandthecodecused.Allcodec-relateddataisinthetypespecificpartofthisheader.

ManyfieldssharethesamemeaningsastheonesinPROPchunk,butinthiscasetheyarespecificforonestream.

ThereisoneMDPRchunkforeverystreaminthefile.

AMDPRchunkhasthefollowingformat

dwordChunktype('MDPR')

dwordChunksize

wordChunkversion(always0,foreveryknownfile)

wordStreamnumber

dwordMaximumbitrate

dwordAveragebitrate

dwordSizeoflargestdatapacket

dwordAveragesizeofdatapacket

dwordStreamstartoffsetinms

dwordPrerollinms(tobesubtractedfromtimestamps?

dwordStreamdurationinms

byteSizeofstreamdescriptionstring

byte[]Streamdescriptionstring

byteSizeofstreammimetypestring

byte[]Mimetypestring

dwordSizeoftypespecificpartoftheheader

byte[]Typespecificdata,meaningandformatdependsonmimetype

Audio(audio/)

audio/x-pn-realaudioandaudio/x-pn-multirate-realaudio

ThesemimetypesareusedtospecifystreamswithRealAudiocodecs.Thereare3knownversionsofthisdatablock:

ra3,ra4,ra5.ra3isusedonlywiththeold14_4codec,ra4andra5canbeusedwithalltheothercodecs.

Theaudioblockhasthisformat

byte[4]Headersignature('.','r','a',0xfd)

wordVersion(3,4or5)

#ifversion==3

wordHeadersize,notincludingfirst8bytes

byte[10]Unknown

dwordDatasize

byteTitlestringlength

byte[]Titlestring

byteAuthorstringlength

byte[]Authorstring

byteCopyrightstringlength

byte[]Copyrightstring

byteCommentstringlength

byte[]Commentstring

byteUnknown*

byteFourccstringlength(always4)*

byte[]Fourccstring(always"lpcJ")*

#elseifversion==4orversion==5

wordUnused(always0)

byte[4]rasignature(".ra4"or".ra5",dependingonversion)

dwordUnknown(maybedatasize)

wordVersion2(alwaysequaltoversion)

dwordHeadersize

wordCodecflavor

dwordCodedframesize

byte[12]Unknown

wordSubpacketh

wordFramesize

wordSubpacketsize

wordUnknown

#ifversion==5

byte[6]Unknown

#endif

wordSamplerate

wordUnknown

wordSamplesize

wordChannels

#ifversion==4

byteInterleaverIDstringlength(always4)

byte[]InterleaverIDstring

byteFourCCstringlength(always4)

byte[]FourCCstring

#endif

#ifversion==5

dwordInterleaverID

dwordFourCC

#endif

byte[3]Unknown

#ifversion==5

byteUnknown

#endif

dwordCodecextradatalength

byte[]Codecextradata

#endif

audio/X-MP3-draft-00

ThisisusedtostoreMP3audioinrmcontainer.Whenthismimetypeisusedthetype-specificpartoftheMDPRheaderisnotused,anditslengthissetto0.

TheMP3framesarestoredinADUformat(seeRFC3119fordetails)withnointerleaving(atleastthisistrueintheonlyknownsample).

audio/x-ralf-mpeg4

Thisisusedtostoreralflosslessaudio.ThisistheonlyknownRealAudiocodecthatdoesnotusethex-pn-realaudiomimetype.

Theformatofthistype-specificdataisnotknown.

Contentdescriptionheader(CONT)

Thischunkcontainssometextinformation(liketitle,author,...)aboutthecontentofthefile.Thisheaderhasaninformativepurposeonlyandit'snotneededtodemuxthefile.

ACONTchunkhasthefollowingformat

dwordChunktype('CONT')

dwordChunksize

wordChunkversion(always0,foreveryknownfile)

wordTitlestringlength

byte[]Titlestring

wordAuthorstringlength

byte[]Authorstring

wordCopyrightstringlength

byte[]Copyrightstring

wordCommentstringlength

byte[]Commentstring

Dataheader(DATA)

Thischunkcontainsagroupofdatapackets.Packetsfromeachstreamareinterleaved,exceptformultiratefiles.

ADATAchunkhasthefollowingformat

dwordChunktype('DATA')

dwordChunksize

wordChunkversion(always0,foreveryknownfile)

dwordNumberofdatapacketsinthischunk

dwordOffsetofthenextDATAchunk(formthestartofthefile)

byte[]Datapackets

Eachdatapackethasthisformat

wordPacketversion(0or1inavailablesamples)

wordPacketsize

wordStreamnumber

dwordTimestamp(inms)

byteUnknown

byteFlags(bitfield,seebelow)

#ifversion==1

byteUnknown

#endif

byte[]Stream-specificdata

Flags:

∙bit0:

reliablepacket(referstonetworktransmissionmethod)

∙bit1:

keyframe

Note:

Thepreviousdescriptionofthedatapacketcomesfromworkingdemuxercode,thedescriptioninofficialRealdocs(somewhereonHelixsite)isabitdifferent:

wordPacketversion

wordPacketsize

wordStreamnumber

dwordTimestamp

#ifversion==0

bytePacketgroup

byteFlags

#endif

#ifversion==1

wordASMrule

byteASMflags

#endif

byte[]Stream-specificdata

wherepacketgroupis"Thepacketgrouptowhichthepacketbelongs.Ifpacketgroupingisnotused,setthisfieldto0(zero)",asmruleis"TheASMruleassignedtothispacket"andasmflags"ContainsHX_flagsthatdictatestreamswitchingpoints".

Indexheader(INDX)

Thischunkcontainsindexentries.ItcomesafteralltheDATAchunks.Anindexchunkcontainsdataforasinglestream,AfilecanhavemorethanoneINDXchunk.

AINDXchunkhasthefollowingformat

dwordChunktype('INDX')

dwordChunksize

wordChunkversion(always0,foreveryknownfile)

dwordNumberofentriesinthischunk

wordStreamnumber

dwordOffsetofthenextINDXchunk(formthestartofthefile)

byte[]Indexentries

Eachindexentryhasthisformat

wordEntryversion(always0,foreveryknownfile)

dwordTimestamp(inms)

dwordPacketoffsetinfile(formthestartofthefile)

dwordPacketnumber

rm文件包含如下域字段

.RMF[.RMS]

CONT

PROP

MDPR

上面的四个域字段哪个老外已经分析了,附后

DATA

INDX

下面仅对data,indx域字段进行分析

DATA字段包含的内容:

      +0:

    dword“DATA”字段标志

      +4:

    dword  该字段总长度。

      +8:

    word  应该为零

      +a:

    dword  总帧数

      +c--11h  0[估计是保留的]

      +12:

以包为单位的流数据格式如下:

          另在DATA部分的数据是按包进行组织的,包的格式如下:

          12个字节为包头  

          +0:

dword记录是这个包的长度[包裹头在内]

          +4:

word音频或视频标志

          +6:

dword如果是音频则是相对开始的时间[以ms为单位]

                  如果是视频则是压缩给定的一个标定时间。

          +a:

  word该包的位置是否在索引表中,0不在,2在。

          +c:

压缩后的数据[长度等于+0处的长度-12]

            又加入6--7字节的头

          +c:

  d7:

  如果为1表示帧结束包。

否则该帧有很多包组成

              d6:

=1表示在后续的+10,11字节表示的意思是帧的时间标号

              d3--d0:

为零表示没有包编号字节

          +d:

d7:

  等于1,后面用四个字节表示压缩后帧数据长度。

之后推移到+10解释相同

                  下面的解释是  d7==0的。

              d6--d0:

帧编号字节[可能没有,如果没有下面的依次前移一个字节]

          +e:

d7--d6:

压缩后的数据长度表示,后面要用多少个字节

              d5---d0:

压缩后的数据长度的高6bit

          +f:

压缩后的一帧数据长的低8bit

          +10:

d7--d6:

压缩后的数据长度相对位置,后面要用多少个字节表示

              d5----d0  相对位置表示的高6bit[如果是最后一个slice包,则表示这个帧在这个包中还剩余的字节数]

          +11:

相对位置表示的低8bit[如果是最后一个slice包,则表示这个帧在这个包中还剩余的字节数]

              [如果一个帧压缩后很小,那么上面的10,11可能表示该帧的时间标号]

          +12:

帧编号在该包中。

一个包可以包含很多帧因为,有时帧压缩后可能很小

            

INDX  字段包含的内容:

      +0:

  dword“INDX”字段标志

      +4:

  dword  该字段总长度。

      +8:

  word  应该为零

      +a:

  dword  总索引个数

      +e:

  word  索引类型,表示是音频的还是视频的。

      +10:

dword  下一个索引表的位置

      +14:

  以长度为14[e]的索引表

        视频的字段定义如下:

          +0:

word  [保留为零]

          +2:

dword  时间标号,压缩时给定的

          +6:

dword  该帧的位置相对整个文件

          +a:

dword  该帧的编号

          

        音频的字段定义如下:

          +0:

byte  [保留0]

          +2:

dowrd  此语音相对开始的时间[以ms为单位],与视频的时间标号相对应

          +6:

dowrd  该段语音在文件中的相对位置

          +a:

dword  对应的视频帧的编号。

     

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 营销活动策划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1