[go: up one dir, main page]

CN101399949A - Method for recording audio and video interlaced format file - Google Patents

Method for recording audio and video interlaced format file Download PDF

Info

Publication number
CN101399949A
CN101399949A CNA2007101513067A CN200710151306A CN101399949A CN 101399949 A CN101399949 A CN 101399949A CN A2007101513067 A CNA2007101513067 A CN A2007101513067A CN 200710151306 A CN200710151306 A CN 200710151306A CN 101399949 A CN101399949 A CN 101399949A
Authority
CN
China
Prior art keywords
audio
recording
recording information
video
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2007101513067A
Other languages
Chinese (zh)
Other versions
CN100596185C (en
Inventor
庄顺宇
林柏纬
潘廷建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sunplus Technology Co Ltd
Original Assignee
Sunplus Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sunplus Technology Co Ltd filed Critical Sunplus Technology Co Ltd
Priority to CN200710151306A priority Critical patent/CN100596185C/en
Publication of CN101399949A publication Critical patent/CN101399949A/en
Application granted granted Critical
Publication of CN100596185C publication Critical patent/CN100596185C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

The invention discloses a method for recording audio and video interlaced format files, wherein the audio and video interlaced format files comprise file headers and content blocks, and the method comprises the following steps: respectively writing preset values of a plurality of recording information into corresponding fields in a file header and a content block, wherein the recording information is the video and audio length of an audio and video interlaced format file; when receiving the multimedia data, writing the multimedia data into a content block, and recording an audio and video interlaced format file; and when the audio and video interlaced format file is recorded, correcting the file header and the field corresponding to the recording information in the content block according to the actual value of the recording information. By applying the invention, when the recording process encounters abnormal interruption, the audio and video interlaced format file can be ensured to be normally accessed because the audio and video interlaced format file has a complete and legal structure.

Description

一种录制音频视频交错格式文件的方法 A method for recording audio and video interleaved format files

技术领域 technical field

本发明涉及一种文件录制方法,特别涉及一种录制音频视频交错格式文件的方法。The invention relates to a file recording method, in particular to a method for recording audio and video interleaved format files.

背景技术 Background technique

随着多媒体技术的发展,监控系统已能通过实时录影来对影像进行追踪,例如:应用于安全的监控系统。而诸如此类的监控系统录制的内容具有高度的重要性,且对于录制内容的连续性要求极高。With the development of multimedia technology, the monitoring system has been able to track the image through real-time recording, for example: applied to the security monitoring system. The content recorded by such a monitoring system is of high importance, and the continuity of the recorded content is extremely high.

音频视频交错格式文件(AVI file,audio and video interleaved file)是实时录影最常使用的文件格式之一。将音频及视频切割成多数据块(datachunk),且交错(interleave)传输音频及视频数据块的文件格式,在本发明中,泛称交错传输的数据块为多媒体数据(multiplexed media data)。而且,音频视频交错格式文件采用数据交互文件格式的储存方式,即采用一种将数据块储存在被标记的区块(tagged chunks)中的档案格式(meta-format)。Audio and video interleaved format file (AVI file, audio and video interleaved file) is one of the most commonly used file formats for real-time video recording. Cutting audio and video into multiple data chunks, and interleaving (interleave) the file format of audio and video data chunks, in the present invention, the data chunks of interleaved transmission are generally referred to as multimedia data (multiplexed media data). Moreover, the audio and video interleaved format file adopts the storage method of the data interactive file format, that is, adopts a file format (meta-format) in which data blocks are stored in tagged chunks.

一般而言,完整的音频视频交错格式文件必须具备符合AVI标准所规范的文件头(header),用于供多媒体播放器播放。因此,倘若在录制过程中发生非正常中断时,例如:电力中断,则所录制的文件格式很有可能因为未存在合法描述结构的文件头而使得多媒体播放器无法重现电力中断前所录制的影音数据。Generally speaking, a complete audio and video interleaved format file must have a file header (header) conforming to the specification of the AVI standard for playing by a multimedia player. Therefore, if an abnormal interruption occurs during the recording process, such as a power outage, the recorded file format is likely to be unable to reproduce the recorded file before the power outage because there is no file header legally describing the structure. Video data.

图1为现有技术中录制音频视频交错格式文件的流程示意图。请参照图1,一般而言,在录制的开始会先设定音频视频交错格式文件的初始信息(步骤S101),例如:录制语音的取样频率。而在录制时,逐一地写入影音数据(步骤S102),并且判断录制是否结束(步骤S103)。若录制未结束则持续地写入影音数据(步骤S102)。若录制结束,便组织影音数据所包含的索引,并根据完整的影音数据写入文件头(步骤S104)。FIG. 1 is a schematic flow chart of recording audio and video interleaved format files in the prior art. Please refer to FIG. 1 , generally speaking, the initial information of the audio and video interleaved format file is set at the beginning of the recording (step S101 ), such as the sampling frequency of the recorded voice. While recording, write video and audio data one by one (step S102), and determine whether the recording is over (step S103). If the recording is not finished, continue to write video and audio data (step S102). If the recording is finished, the index contained in the audio-visual data is organized, and the file header is written according to the complete audio-visual data (step S104).

然而,上述录制方法是在录制完成后,依据完整的影音数据来写入文件头,也就是说,在录制过程中是无法得知最后应写入的正确文件头。这样导致倘若在录制过程中遭遇电力中断或者失效时,录制的音频视频交错格式文件便会因为未存在合法且完整的文件头,而无法重现中断前所录制的影音数据。However, the above-mentioned recording method is to write the file header according to the complete audio-visual data after the recording is completed, that is to say, it is impossible to know the correct file header that should be written at last during the recording process. As a result, if the power is interrupted or fails during the recording process, the recorded audio and video interleaved format files will not be able to reproduce the audio and video data recorded before the interruption because there is no legal and complete file header.

因此,现有技术中,通过时常地更新文件头来实现重现中断前所录制的影音数据的目的。Therefore, in the prior art, the purpose of reproducing the video and audio data recorded before the interruption is realized by updating the file header from time to time.

图2为现有技术中录制音频视频交错格式文件的另一流程示意图。请参照图2,与图1不同的是,图2中在每次写入影音数据(步骤S202)后,依据所录制的影音数据来更新文件头(步骤S203)。当录制结束(步骤S204)后,再依据完整的影音数据修正文件头(步骤S205)。Fig. 2 is another schematic flowchart of recording audio and video interleaved format files in the prior art. Please refer to FIG. 2 . The difference from FIG. 1 is that in FIG. 2 , after each video data is written (step S202 ), the file header is updated according to the recorded video data (step S203 ). After the recording is finished (step S204), the file header is corrected according to the complete video and audio data (step S205).

上述方法可以实现重放中断前所录制的影音数据,但由于文件头随录制内容经常性地更动,而造成录制系统的工作效能大幅地降低。The above method can realize replaying the audio-visual data recorded before the interruption, but the working efficiency of the recording system is greatly reduced due to the frequent change of the file header along with the recording content.

发明内容 Contents of the invention

本发明提供一种录制音频视频交错格式文件的方法,用于在录制过程中遭遇非正常中断时,保证录制系统能正常存取中断前所录制的音频视频交错格式文件。The invention provides a method for recording audio and video interleaved format files, which is used to ensure that the recording system can normally access the audio and video interleaved format files recorded before the interruption when encountering abnormal interruption during the recording process.

本发明提供的一种录制音频视频交错格式文件的方法,其中,音频视频交错格式文件包含文件头及内容块。该方法将多个录制信息的预设值分别写入文件头及内容块内与录制信息对应的字段,录制信息为音频视频交错格式文件的影音长度。当接收到多媒体数据,则将多媒体数据写入于内容块,录制音频视频交错格式文件。The present invention provides a method for recording audio and video interleaved format files, wherein the audio and video interleaved format files include file headers and content blocks. The method writes a plurality of preset values of the recording information into the file header and the field corresponding to the recording information in the content block respectively, and the recording information is the audio-video length of the audio-video interleaved format file. When the multimedia data is received, the multimedia data is written into the content block, and the audio and video interleaved format files are recorded.

本发明还提供一种录制音频视频交错格式文件的方法,其中,音频视频交错格式文件包含文件头及内容块。该方法将多个录制信息的预设值分别写入文件头及内容块内与录制信息对应的字段,录制信息为音频视频交错格式文件的影音长度。当接收到多媒体数据,则将多媒体数据写入于内容块,录制音频视频交错格式文件。每隔预设时间,则用一临限值更新文件头及内容块内各录制信息对应的字段,其中,该临限值为大于或等于截至下次更新前所需时间而换算的各录制信息的值。The present invention also provides a method for recording audio and video interleaved format files, wherein the audio and video interleaved format files include file headers and content blocks. The method writes a plurality of preset values of the recording information into the file header and the field corresponding to the recording information in the content block respectively, and the recording information is the audio-video length of the audio-video interleaved format file. When the multimedia data is received, the multimedia data is written into the content block, and the audio and video interleaved format files are recorded. Every preset time, a threshold value is used to update the corresponding fields of the recording information in the file header and the content block, wherein the threshold value is greater than or equal to the conversion of each recording information until the time required for the next update value.

上述一种录制音频视频交错格式文件的方法,包括执行初始化处理,用于设定音频视频交错格式文件的初始信息。The above-mentioned method for recording audio and video interleaved format files includes performing initialization processing for setting initial information of the audio and video interleaved format files.

上述一种录制音频视频交错格式文件的方法,音频视频交错格式文件进一步包含索引块,将内容块所包含的多个子块的块类型,以及播放各子块的偏移量写入于索引块。In the above-mentioned method for recording an audio-video interleaved format file, the audio-video interleaved format file further includes an index block, and the block types of multiple sub-blocks contained in the content block and the offsets for playing each sub-block are written into the index block.

由上述技术方案可见,本发明的一种录制音频视频交错格式文件的方法,在录制时,预先写入关于音频视频交错格式文件的录制信息的预设值。因此,即使录制过程中遭遇非正常中断,也可因为录制的音频视频交错格式文件符合规范的结构,而能存取中断前所录制的音频视频交错格式文件。It can be seen from the above technical solution that, in a method for recording an audio-video interleaved format file according to the present invention, when recording, pre-write the preset value of the recording information about the audio-video interleaved format file. Therefore, even if an abnormal interruption is encountered during the recording process, the interleaved audio and video files recorded before the interruption can be accessed because the recorded audio and video interleaved format files conform to the standard structure.

附图说明 Description of drawings

图1为现有技术中录制音频视频交错格式文件的流程示意图。FIG. 1 is a schematic flow chart of recording audio and video interleaved format files in the prior art.

图2为现有技术中录制音频视频交错格式文件的另一流程示意图。Fig. 2 is another schematic flowchart of recording audio and video interleaved format files in the prior art.

图3为本发明音频视频交错格式文件的结构示意图。FIG. 3 is a schematic structural diagram of an audio and video interleaved format file according to the present invention.

图4为本发明实施例一录制音频视频交错格式文件的流程示意图。FIG. 4 is a schematic flowchart of recording audio and video interleaved format files according to Embodiment 1 of the present invention.

图5为本发明另一实施例录制音频视频交错格式文件的流程示意图。Fig. 5 is a schematic flowchart of recording audio and video interleaved format files according to another embodiment of the present invention.

附图中的标号说明Explanation of symbols in the attached drawings

301:数据交换文件格式块301: Data Interchange File Format Block

301a:文件头301a: file header

301b:内容块301b: Content Block

301c:索引块301c: Index Block

302a、302b:子块302a, 302b: sub-blocks

具体实施方式 Detailed ways

为使本发明的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本发明作进一步详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples.

本发明的实施例提供一种在录制过程中遭遇非正常中断时,仍能在录制的媒体上存取中断前所录制的影音数据的方法。Embodiments of the present invention provide a method for accessing video and audio data recorded before the interruption on the recording medium when an abnormal interruption occurs during the recording process.

图3为本发明音频视频交错格式文件的结构示意图。请参照图3,每一个音频视频交错格式文件由一数据交换文件格式块(RIFF chunk)建构而成,且数据交换文件格式块可包含多个子块(sub-chunk)。其中,数据交换文件格式子块可以是目录块(LIST chunk),也可以是正规子块(regular sub-chunk),例如,目录块为文件头301a、内容块301b,而正规子块为索引块301c。目录块的结构与数据交换文件格式块的结构相同,可以包含目录子块或者正规子块,但是正规子块不能再包含任何子块。FIG. 3 is a schematic structural diagram of an audio and video interleaved format file according to the present invention. Please refer to FIG. 3 , each audio and video interleaved format file is constructed by a data exchange file format block (RIFF chunk), and the data exchange file format block can include multiple sub-chunks (sub-chunk). Wherein, the sub-chunk of the data exchange file format can be a directory block (LIST chunk) or a regular sub-chunk (regular sub-chunk). For example, the directory block is a file header 301a, a content block 301b, and the regular sub-chunk is an index block 301c. The structure of the directory block is the same as that of the data exchange file format block, which can contain directory sub-blocks or regular sub-blocks, but regular sub-blocks cannot contain any sub-blocks.

一个完整的数据交换文件格式块301包含有文件头301a、内容块301b以及可选的索引块301c。文件头301a用来记录音频视频交错格式文件的录制信息,例如:数据交换文件格式块的大小(RIFF size)、影音数据的帧数(avih#frames)、视频数据的长度(video length)(即视频数据的帧数)、音频数据的长度(audio length)(即音频数据的样本数)等有关影音数据长度的相关字段。内容块301b则用来记录其所包含的影音数据的大小(movi size)以及录制的影音数据。A complete data exchange file format block 301 includes a file header 301a, a content block 301b and an optional index block 301c. The file header 301a is used to record the recording information of the audio-video interleaved format file, for example: the size (RIFF size) of the data exchange file format block, the frame number (avih#frames) of the audio-visual data, the length (video length) of the video data (ie The number of frames of video data), the length of audio data (audio length) (that is, the number of samples of audio data) and other related fields related to the length of audio and video data. The content block 301b is used to record the size (movi size) of the video and audio data it contains and the video and audio data recorded.

由于影音数据被分割成多个数据块,例如:每一视频数据块为一帧,且这些数据块分别被记录在内容块301b所包含的子块302a、302b中,在本实施例中,为描述方便,以2个子块进行说明,实际应用中,内容块也可以包含多个子块。索引块301c用来记录播放这些数据块的偏移量(offset)以及数据块的内容大小(size),用于在重放(playback)、快转或者回转影音数据时能快速地寻到所欲播放的数据块。另外,索引块301c也可用来记录数据块的块类型,例如:视频数据块的块类型是否为I(intra)帧。Since video and audio data is divided into multiple data blocks, for example: each video data block is a frame, and these data blocks are respectively recorded in the sub-blocks 302a and 302b included in the content block 301b, in this embodiment, The description is convenient, and two sub-blocks are used for illustration. In practical applications, a content block may also include multiple sub-blocks. The index block 301c is used to record the offset (offset) of playing these data blocks and the content size (size) of the data blocks, so as to quickly find the desired data when replaying (playback), fast-forwarding or reversing audio-visual data. The chunk of data to play. In addition, the index block 301c can also be used to record the block type of the data block, for example: whether the block type of the video data block is an I (intra) frame.

图4为本发明实施例一录制音频视频交错格式文件的流程示意图。请参照图3与图4,在录制一开始会先执行初始化处理(步骤S401),用于设定音频视频交错格式文件的初始信息,例如:音频取样频率或者视频压缩格式等。接着,将录制信息的预设值写入文件头301a以及内容块301b内与录制信息对应的字段(步骤S402),其中录制信息与音频视频交错格式文件的影音长度相关,例如:视频数据帧数、影音数据大小、或音频数据样本数等。将录制信息写入与音频视频交错格式文件影音长度有关的字段,这是本领域的公知常识,在此不再赘述。FIG. 4 is a schematic flowchart of recording audio and video interleaved format files according to Embodiment 1 of the present invention. Please refer to FIG. 3 and FIG. 4 , at the beginning of recording, an initialization process (step S401 ) is performed to set the initial information of the audio and video interleaved format file, such as audio sampling frequency or video compression format. Next, write the preset value of the recording information into the field corresponding to the recording information in the file header 301a and the content block 301b (step S402), wherein the recording information is related to the video and video length of the audio and video interleaved format file, for example: the number of frames of video data , the size of video and audio data, or the number of audio data samples, etc. It is common knowledge in the art to write the recording information into the field related to the video length of the audio-video interleaved format file, so it will not be repeated here.

本实施例中,在文件头301a中写入的录制信息的预设值,可以是多个录制的信息的预设值,预设值可以为RIFF区块的大小(相当于影音数据的大小)、视频数据帧数、音频数据样本数,而在内容块301b中写入的录制信息的预设值可以为影音数据的大小。由于在实际的录制系统中,规范的音频视频交错格式文件字段,对于这些录制信息都有一定的限制,所以在本实施例中,较佳的录制信息的预设值为符合标准所规范的录制信息的最大值,更佳地为符合录制系统所能刻录的录制信息的最大值,或者为大于或等于录制系统所刻录的录制信息的实际值。In this embodiment, the preset value of the recording information written in the file header 301a can be a preset value of multiple recorded information, and the preset value can be the size of a RIFF block (equivalent to the size of video and audio data) , the number of video data frames, and the number of audio data samples, and the preset value of the recording information written in the content block 301b may be the size of the video and audio data. Since in the actual recording system, the standardized audio and video interleaved format file fields have certain restrictions on these recording information, so in this embodiment, the preferred preset value of the recording information is the recording specified by the standard The maximum value of the information is more preferably consistent with the maximum value of the recorded information that the recording system can record, or is greater than or equal to the actual value of the recorded information recorded by the recording system.

举例来说,国家电视标准委员会(national television standards committee,以下简称NTSC)所规范的视频帧速率大约为30帧/秒(frames/second)。倘若欲录制NTSC格式的影音数据,且录制系统可刻录的影音长度,例如为3小时,则文件头301a内视频数据长度(video length)与影音文件帧数(avih#frames)的字段中将写入录制系统可允许刻录的最大视频数据帧数,即3小时×60分/小时×60秒/分×30帧/秒=324000帧。而在音频数据长度的字段中也将填入录制系统可允许刻录的最大音频数据样本数。同理,在其他字段中相应写入录制系统可允许刻录的最大值。根据本领域技术人员常用的技术手段,如果欲录制欧洲国家电视标准(phase alternating line,PAL)格式的影音数据时,可依据标准规范的最大帧速率做相应设定。For example, the video frame rate regulated by the National Television Standards Committee (hereinafter referred to as NTSC) is about 30 frames/second (frames/second). If the audio-visual data in NTSC format is to be recorded, and the video-audio length that can be recorded by the recording system is, for example, 3 hours, then in the field of the video data length (video length) and the video-audio file frame number (avih#frames) in the file header 301a, write The maximum number of video data frames that can be recorded into the recording system, that is, 3 hours x 60 minutes/hour x 60 seconds/minute x 30 frames/second = 324,000 frames. The maximum number of audio data samples allowed to be recorded by the recording system will also be filled in the field of audio data length. In the same way, correspondingly write the maximum value that the recording system can record in other fields. According to the technical means commonly used by those skilled in the art, if you want to record video and audio data in the European national television standard (phase alternating line, PAL) format, you can make corresponding settings according to the maximum frame rate of the standard specification.

接着,将多媒体数据写入于内容块301b,进行录制音频视频交错格式文件(步骤S403),并且判断录制是否完成(步骤S404)。若录制未完成时,则继续将多媒体数据写入内容块301b(步骤S403)。若录制完成,则依据录制信息的实际值修正文件头301a以及内容块301b内录制信息对应的字段(步骤S405)。一般而言,在将多媒体数据写入内容块301b的同时,也会将内容块301b所包含的子块(例如:302a、302b)的块类型,以及播放各子块的偏移量记录于索引块301c中。在录制完成后,组织索引块301c内所记录的信息。Next, write the multimedia data into the content block 301b, record the audio and video interleaved format file (step S403), and determine whether the recording is completed (step S404). If the recording is not completed, continue to write the multimedia data into the content block 301b (step S403). If the recording is completed, the field corresponding to the recording information in the file header 301a and the content block 301b is corrected according to the actual value of the recording information (step S405). Generally speaking, when the multimedia data is written into the content block 301b, the block types of the sub-blocks (for example: 302a, 302b) contained in the content block 301b, and the offsets of playing each sub-block will also be recorded in the index in block 301c. After the recording is completed, the information recorded in the index block 301c is organized.

从图4的流程示意图可以得知,即使在录制过程中遭遇到非正常中断,虽然不能预知最后录制完成的录制信息,但由于中断前所录制的音频视频交错格式文件因具有符合规范且完整的结构,而能被正常存取。因此,与现有技术中在录制结束后依据实际录制信息写入文件头的方法(如图1所示)相比,本发明实施例在录制过程中遭遇非正常中断时,能重现中断前所录制的影音数据。而且,本实施例相对于现有技术中时常性更新文件头的方法(如图2所示),具有较高的工作效率。From the flow diagram in Figure 4, it can be seen that even if an abnormal interruption is encountered during the recording process, although the recording information of the final recording cannot be predicted, the audio and video interleaved format files recorded before the interruption have standard and complete structure, which can be accessed normally. Therefore, compared with the method in the prior art that writes the file header according to the actual recording information after the recording ends (as shown in Figure 1), the embodiment of the present invention can reproduce the file header before the interruption when encountering an abnormal interruption during the recording process. The recorded video and audio data. Moreover, this embodiment has higher work efficiency compared with the method of updating the file header frequently in the prior art (as shown in FIG. 2 ).

图5为本发明另一实施例录制音频视频交错格式文件的流程示意图。在本实施例中,通过设定预设时间T1,周期性地更新文件头301a及内容块301b内所记录的录制信息。请参照图3与图5,在录制一开始执行初始化处理,用于设定音频视频交错格式文件的初始信息(步骤S501)。接着,将预设时间T1所换算的录制信息的预设值写入文件头301a及内容块301b内与录制信息对应的字段(步骤S502),并写入多媒体数据于内容块301b,进行录制音频视频交错格式文件(步骤S503)。第一次写入的录制信息的预设值为记录至少T1时间所换算成的录制信息的值。Fig. 5 is a schematic flowchart of recording audio and video interleaved format files according to another embodiment of the present invention. In this embodiment, by setting a preset time T1, the recording information recorded in the file header 301a and the content block 301b is periodically updated. Referring to FIG. 3 and FIG. 5 , an initialization process is performed at the beginning of recording for setting initial information of audio and video interleaved format files (step S501 ). Next, write the preset value of the recording information converted by the preset time T1 into the field corresponding to the recording information in the file header 301a and the content block 301b (step S502), and write multimedia data in the content block 301b to record audio Video interlaced format file (step S503). The default value of the recording information written for the first time is the value of recording information converted from recording at least T1 time.

接着,判断录制是否结束(步骤S504),若录制完成,可依据录制信息的实际值来修正文件头301a以及内容块301b内录制信息对应的字段(步骤S505)。若录制未完成,则判断录制时间是否达到上述的预设时间T1(步骤S506)。若还未达到此预设时间T1,则继续写入多媒体数据(步骤S503)。当录制时间达到此预设时间T1时,进行第1次更新,用一临限值更新文件头301a以及内容块301b内与录制信息对应的字段(步骤S502),其中,此临限值为大于或等于截至下次更新所需时间而换算的录制信息的值。Next, it is judged whether the recording is finished (step S504). If the recording is completed, the field corresponding to the recording information in the file header 301a and the content block 301b can be modified according to the actual value of the recording information (step S505). If the recording is not completed, it is judged whether the recording time reaches the above-mentioned preset time T1 (step S506). If the preset time T1 has not been reached, continue to write multimedia data (step S503). When the recording time reaches the preset time T1, the first update is performed, and a threshold value is used to update the field corresponding to the recording information in the file header 301a and the content block 301b (step S502), wherein the threshold value is greater than Or equal to the value of the recording information scaled up to the time required for the next update.

举例来说,假设录制信息为视频帧数,且设定系统每隔30分钟更新一次,则在进行录制的初始化处理时,第一次写入视频帧数的预设值至少为30分钟长度(亦即,大于或等于在更新前实际录制的时间长度)所换算的视频帧数的值。当录制经过一段时间,例如18分钟,遇到非正常中断时,因为音频视频交错格式文件的文件头中记录着至少30分钟长度的视频帧数,所以录制系统仍能播放非正常中断前所录制的影音数据。For example, assuming that the recording information is the number of video frames, and the system is set to be updated every 30 minutes, then when initializing the recording, the default value of the number of video frames written for the first time is at least 30 minutes ( That is, greater than or equal to the value of the number of video frames converted from the actual recording time before updating). When the recording passes for a period of time, such as 18 minutes, and encounters an abnormal interruption, the recording system can still play the recording before the abnormal interruption because the file header of the audio and video interleaved format file records the number of video frames at least 30 minutes long video data.

倘若正常录制经过30分钟,则系统进行第1次更新,此时以至少60分钟长度(亦即,截至下次更新前所经过的总时间长度)所换算的视频帧数写入其对应的字段(即文件头301a内视频数据长度的字段)中,如此可确保在录制过程中遇到非正常中断时,仍能播放第60分钟以前所录制的影音数据。If 30 minutes of normal recording have elapsed, the system will perform the first update. At this time, the number of video frames converted by at least 60 minutes (that is, the total time elapsed until the next update) is written into its corresponding field (that is, the field of video data length in the file header 301a), so that it can be ensured that when an abnormal interruption is encountered during the recording process, the video and audio data recorded before the 60th minute can still be played.

由上述可知,在本实施例中,当进行第N次进行更新时,所写入的临限值至少为T1×(1+N)时间所换算的录制信息的值,其中N为零或正整数。因此,通过周期性的更新录制信息,使得在录制过程中遇到非正常中断时,仍能确保系统能播放在中断前所录制的影音数据。As can be seen from the above, in this embodiment, when updating for the Nth time, the written threshold value is at least the value of the recording information converted from T1×(1+N) time, where N is zero or positive integer. Therefore, by periodically updating the recording information, when an abnormal interruption occurs during the recording process, it can still ensure that the system can play the video and audio data recorded before the interruption.

实际应用中,本实施例并不局限写入录制信息的预设值(步骤S502),以及写入多媒体数据(步骤S503)的顺序。写入的录制信息的预设值(步骤S502)为预设时间T1所换算成的录制信息的值,也可以如图4的说明,采用符合音频视频交错格式文件的标准所规范的录制信息的最大值,或大于或者等于录制系统可刻录的录制信息的实际值,或者录制系统所能刻录的录制信息的最大值作为写入的录制信息的预设值。In practice, this embodiment is not limited to the order of writing the preset value of the recording information (step S502 ) and writing the multimedia data (step S503 ). The preset value of the recording information written (step S502) is the value of the recording information converted into the preset time T1, and as shown in Figure 4, the recording information conforming to the standard of the audio and video interlaced format file can be adopted. The maximum value, or greater than or equal to the actual value of the recording information that can be recorded by the recording system, or the maximum value of the recording information that can be recorded by the recording system is used as the preset value of the recorded recording information.

综上所述,本实施例在录制时,在文件头301a及内容块301b内录制信息对应的字段写入录制信息的预设值,并写入多媒体数据,进行录制音频视频交错格式文件。因此,即使在录制过程中遭遇到非正常中断,虽然不能获得录制完成后正确的录制信息,但中断前所录制的音频视频交错格式文件因具有符合标准且完整的结构,而能被正常存取。To sum up, in this embodiment, when recording, the preset value of the recording information is written in the fields corresponding to the recording information in the file header 301a and the content block 301b, and multimedia data is written to record audio and video interleaved format files. Therefore, even if an abnormal interruption is encountered during the recording process, although the correct recording information after the recording is completed cannot be obtained, the audio and video interleaved format files recorded before the interruption can be accessed normally due to their standard and complete structure .

在本实施例的录制过程中,周期性地以大于或等于截至下次更新所需时间(例如,T1×(1+N),其中T1为预设的更新时间,而N为更新次数)而换算的录制信息的值(即临限值)来更新文件头及内容块内与录制信息对应的字段,以确保非正常中断前的录制信息能被播放。In the recording process of this embodiment, the time period is greater than or equal to the time required for the next update (for example, T1×(1+N), where T1 is the preset update time, and N is the number of updates). The value of the converted recording information (that is, the threshold value) is used to update the field corresponding to the recording information in the file header and the content block, so as to ensure that the recording information before the abnormal interruption can be played.

上述实施例在录制完成后,可选择性地依据录制信息的实际值,修正文件头301a及内容块301b内与录制信息对应的字段。In the above embodiment, after the recording is completed, the fields corresponding to the recording information in the file header 301a and the content block 301b can be modified selectively according to the actual value of the recording information.

虽然本发明已以较佳实施例揭露如上,然并非用以限定本发明,任何所属技术领域中普通技术人员,在不脱离本发明的精神和范围内,可作些许的更动与润饰,因此本发明所主张的权利范围应以发明申请范围所述为准,而非仅限于上述实施例。Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some changes and modifications without departing from the spirit and scope of the present invention. Therefore The scope of rights claimed in the present invention should be based on the description of the application scope of the invention, rather than being limited to the above-mentioned embodiments.

Claims (17)

1.一种录制音频视频交错格式文件的方法,其中,所述音频视频交错格式文件包含一文件头以及一内容块,其特征在于,该方法包括:1. A method for recording an audio-video interleaved format file, wherein the audio-video interleaved format file comprises a file header and a content block, it is characterized in that the method comprises: 将多个录制信息的预设值分别写入所述文件头及所述内容块内与所述录制信息对应的字段,所述录制信息为所述音频视频交错格式文件的影音长度;以及Writing a plurality of preset values of recording information into the file header and the field corresponding to the recording information in the content block respectively, the recording information being the audio-video length of the audio-video interleaved format file; and 将一多媒体数据写入所述内容块,录制所述音频视频交错格式文件。A multimedia data is written into the content block, and the audio and video interleaved format file is recorded. 2.如权利要求1所述的方法,其特征在于,该方法进一步包括:2. The method of claim 1, further comprising: 当录制完所述音频视频交错格式文件,依据所述录制信息的实际值,分别修正所述文件头及所述内容块内对应的字段。After recording the audio and video interleaved format file, modify the corresponding fields in the file header and the content block respectively according to the actual value of the recording information. 3.如权利要求1所述的方法,其特征在于,所述录制信息的预设值为所述音频视频交错格式文件标准所规范的所述录制信息的最大值。3. The method according to claim 1, wherein the preset value of the recording information is the maximum value of the recording information regulated by the audio-video interleaved format file standard. 4.如权利要求1所述的方法,其特征在于,所述录制信息的预设值为大于或等于一录制系统可刻录的所述录制信息的实际值。4. The method according to claim 1, wherein the preset value of the recording information is greater than or equal to an actual value of the recording information that can be recorded by a recording system. 5.如权利要求1所述的方法,其特征在于,所述录制信息的预设值为一录制系统所能刻录的所述录制信息的最大值。5. The method according to claim 1, wherein the preset value of the recording information is the maximum value of the recording information that can be recorded by a recording system. 6.如权利要求1所述的方法,其特征在于,该方法进一步包括:6. The method of claim 1, further comprising: 执行一初始化处理,用于设定所述音频视频交错格式文件的多个初始信息。Executing an initialization process for setting a plurality of initial information of the audio and video interleaved format file. 7.如权利要求1所述的方法,其特征在于,所述音频视频交错格式文件进一步包含一索引块,该方法进一步包括:7. The method of claim 1, wherein the audio-video interleaved format file further comprises an index block, the method further comprising: 将所述内容块包含的多个子块的块类型,以及播放各所述子块的偏移量写入所述索引块。Write the block types of the multiple sub-blocks included in the content block and the offsets for playing each of the sub-blocks into the index block. 8.如权利要求1所述的方法,其特征在于,所述录制信息包含所述音频视频交错格式文件的下述之一或其任意组合:一视频数据帧数、一音频数据样本数、一总帧数、一数据交互文件格式块大小、内容块大小。8. The method according to claim 1, wherein the recording information comprises one of the following or any combination thereof of the audio and video interleaved format file: a video data frame number, an audio data sample number, a The total number of frames, the format block size of a data interaction file, and the content block size. 9.一种录制音频视频交错格式文件的方法,其中,所述音频视频交错格式文件包含一文件头以及一内容块,其特征在于,该方法包括:9. A method for recording an audio-video interleaved format file, wherein the audio-video interleaved format file comprises a file header and a content block, it is characterized in that the method comprises: 将多个录制信息的预设值分别写入所述文件头及所述内容块内与所述录制信息对应的字段,所述录制信息为所述音频视频交错格式文件的影音长度;Writing preset values of a plurality of recording information into the file header and the field corresponding to the recording information in the content block respectively, the recording information is the audio-video length of the audio-video interleaved format file; 将一多媒体数据写入所述内容块,录制所述音频视频交错格式文件;以及writing a multimedia data into the content block, recording the audio video interleaved format file; and 每隔一预设时间,用一临限值更新所述文件头及所述内容块内对应的字段,所述临限值为大于或等于截至下次更新所需时间而换算的所述录制信息的值。Every preset time, update the corresponding fields in the file header and the content block with a threshold value, the threshold value is greater than or equal to the conversion of the recording information up to the time required for the next update value. 10.如权利要求9所述的方法,其特征在于,该方法进一步包括:10. The method of claim 9, further comprising: 当录制完所述音频视频交错格式文件,依据所述录制信息的实际值,分别修正所述文件头及所述内容块内对应的字段。After recording the audio and video interleaved format file, modify the corresponding fields in the file header and the content block respectively according to the actual value of the recording information. 11.如权利要求9所述的方法,其特征在于,所述录制信息的预设值为所述音频视频交错格式文件标准所规范的所述录制信息的最大值。11. The method according to claim 9, wherein the preset value of the recording information is the maximum value of the recording information regulated by the audio-video interleaved format file standard. 12.如权利要求9所述的方法,其特征在于,所述录制信息的预设值为大于或等于一录制系统所刻录的所述录制信息的实际值。12. The method according to claim 9, wherein the preset value of the recording information is greater than or equal to an actual value of the recording information recorded by a recording system. 13.如权利要求9所述的方法,其特征在于,所述录制信息的预设值为一录制系统所能刻录的所述录制信息的最大值。13. The method according to claim 9, wherein the preset value of the recording information is the maximum value of the recording information that can be recorded by a recording system. 14.如权利要求9所述的方法,其特征在于,所述录制信息的预设值为根据所述预设时间进行换算的所述录制信息的值。14. The method according to claim 9, wherein the preset value of the recording information is the value of the recording information converted according to the preset time. 15.如权利要求9所述的方法,其特征在于,该方法进一步包括:15. The method of claim 9, further comprising: 执行一初始化处理,用于设定一音频视频交错格式文件的多个初始信息。Executing an initialization process for setting a plurality of initial information of an audio and video interleaved format file. 16.如权利要求9所述的方法,其特征在于,所述音频视频交错格式文件进一步包含一索引块,该方法进一步包括:16. The method of claim 9, wherein the audio-video interleaved format file further comprises an index block, the method further comprising: 将所述内容块包含的多个子块的块类型,以及播放各所述子块的偏移量写入所述索引块。Write the block types of the multiple sub-blocks included in the content block and the offsets for playing each of the sub-blocks into the index block. 17.如权利要求9所述的方法,其特征在于,所述录制信息包含所述音频视频交错格式文件的下述之一或其任意组合:一视频数据帧数、一音频数据样本数、一总帧数、一数据交互文件格式块大小、内容块大小。17. The method according to claim 9, wherein the recording information includes one of the following or any combination of the audio and video interleaved format files: a video data frame number, an audio data sample number, a The total number of frames, the format block size of a data interaction file, and the content block size.
CN200710151306A 2007-09-24 2007-09-24 Method for recording audio and video interlaced format file Expired - Fee Related CN100596185C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200710151306A CN100596185C (en) 2007-09-24 2007-09-24 Method for recording audio and video interlaced format file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200710151306A CN100596185C (en) 2007-09-24 2007-09-24 Method for recording audio and video interlaced format file

Publications (2)

Publication Number Publication Date
CN101399949A true CN101399949A (en) 2009-04-01
CN100596185C CN100596185C (en) 2010-03-24

Family

ID=40518163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200710151306A Expired - Fee Related CN100596185C (en) 2007-09-24 2007-09-24 Method for recording audio and video interlaced format file

Country Status (1)

Country Link
CN (1) CN100596185C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103165154A (en) * 2011-12-14 2013-06-19 佳能株式会社 Recording apparatus
CN104239160A (en) * 2013-06-14 2014-12-24 晶睿通讯股份有限公司 Security monitoring device with network and video recording functions and debugging and repairing method of storage device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5581706A (en) * 1994-06-30 1996-12-03 Rca Thomson Licensing Corporation Method forming an audio/video interactive data signal
EP1239644A1 (en) * 2001-03-08 2002-09-11 THOMSON multimedia Method for managing isochronous file transfers in a HAVI environment
JP2006120237A (en) * 2004-10-21 2006-05-11 Matsushita Electric Ind Co Ltd VIDEO / AUDIO RECORDING / REPRODUCING DEVICE, CONTROL METHOD AND PROGRAM THEREOF
JP2006217126A (en) * 2005-02-02 2006-08-17 Matsushita Electric Ind Co Ltd Optical disc playback apparatus and video / audio playback apparatus
US20070067472A1 (en) * 2005-09-20 2007-03-22 Lsi Logic Corporation Accurate and error resilient time stamping method and/or apparatus for the audio-video interleaved (AVI) format

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103165154A (en) * 2011-12-14 2013-06-19 佳能株式会社 Recording apparatus
CN103165154B (en) * 2011-12-14 2016-09-28 佳能株式会社 Recording equipment
CN104239160A (en) * 2013-06-14 2014-12-24 晶睿通讯股份有限公司 Security monitoring device with network and video recording functions and debugging and repairing method of storage device
CN104239160B (en) * 2013-06-14 2017-05-31 晶睿通讯股份有限公司 Security monitoring device with network and video recording functions and debugging and repairing method of storage device

Also Published As

Publication number Publication date
CN100596185C (en) 2010-03-24

Similar Documents

Publication Publication Date Title
CN100414984C (en) Recording device and recording method
JP4481889B2 (en) Data recording apparatus and method, program, and recording medium
CN100562088C (en) file reproduction method
TW200912901A (en) Error recovery method of recording an audio and video interleaved file
US20110235995A1 (en) Methods for reserving index memory space in avi recording apparatus
CN103731625A (en) Method for simultaneously and synchronously playing multiple paths of audios and videos
JP2004178788A (en) Recording device and recording method
JP2003022658A (en) Information recording medium, device for recording and reproducing information on information recording medium
CN101399949A (en) Method for recording audio and video interlaced format file
TWI278834B (en) Information storage medium storing multi angle data, and recording method and reproducing apparatus thereof
JP2012065087A (en) Video recording and reproducing apparatus, recording and reproducing method of the same, program of the same, and memory storing program
CN101365088A (en) Hard disc video recording method
JP2004128938A (en) AV data recording and reproducing apparatus and method
CN1702633A (en) Method for establishing medium file system
US20090067818A1 (en) Video recording and reproducing system and reading method of video data
CN1798309A (en) Content reproduce system, reproduce device, and reproduce method and distribution server
CN100531351C (en) Recording/reproducing device and method
JP2006073038A (en) Video or audio recording / playback device
US8515250B2 (en) Video recording device, video reproduction device, and method thereof
JP2004334969A (en) Multi-file real-time recording and playback methods
JP3926102B2 (en) MPEG video / audio data recording system and editing system thereof
JPS62181531A (en) Processing method for picture data
JP2001126405A (en) Bit stream recording/reproducing device
JP4255796B2 (en) DATA RECORDING DEVICE, DATA RECORDING METHOD, DATA RECORDING PROGRAM, AND RECORDING MEDIUM CONTAINING THE PROGRAM
JP4289403B2 (en) Editing apparatus and editing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100324

Termination date: 20170924

CF01 Termination of patent right due to non-payment of annual fee