CN107124571A - Videotape storage means and device - Google Patents
Videotape storage means and device Download PDFInfo
- Publication number
- CN107124571A CN107124571A CN201710243144.3A CN201710243144A CN107124571A CN 107124571 A CN107124571 A CN 107124571A CN 201710243144 A CN201710243144 A CN 201710243144A CN 107124571 A CN107124571 A CN 107124571A
- Authority
- CN
- China
- Prior art keywords
- frame
- video
- layer
- code stream
- space
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
- H04N5/91—Television signal processing therefor
- H04N5/92—Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N7/00—Television systems
- H04N7/18—Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Television Signal Processing For Recording (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请提供一种录像存储方法及装置,方法包括:获取视频编码器预先配置的码流结构;根据该码流结构记录的码流层为每层划分对应的存储空间;将视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中;其中,每个存储空间中存储的视频帧的优先级和生命周期与其所属层数成负相关关系。本申请通过对码流分层存储,以实现录像的弹性生命周期管理,每个存储空间根据其对应层的优先级高低可以设置不同的生命周期进行管理,在某一层的视频帧的生命周期到期时,将该层对应存储空间中的视频帧丢弃或覆盖,而不需要通过抽帧转存或降低码率转存的方式对存储空间多次读写实现生命周期管理,从而可以降低录像生命周期管理的复杂性。
The present application provides a video storage method and device. The method includes: obtaining the code stream structure pre-configured by the video encoder; dividing the corresponding storage space for each layer according to the code stream layer recorded by the code stream structure; Each video frame in the code stream is sequentially stored in the storage space corresponding to the layer according to the layer it belongs to; wherein, the priority and life cycle of the video frame stored in each storage space are negatively correlated with the number of layers it belongs to. This application implements flexible lifecycle management of video recordings through layered storage of code streams. Each storage space can be managed by setting different lifecycles according to the priority level of its corresponding layer. The lifecycle of video frames in a certain layer When it expires, the video frames in the corresponding storage space of this layer are discarded or overwritten, and there is no need to read and write the storage space multiple times to achieve life cycle management by means of frame dumping or lower bit rate dumping, which can reduce video recording The complexity of lifecycle management.
Description
技术领域technical field
本申请涉及视频监控技术领域,尤其涉及一种录像存储方法及装置。The present application relates to the technical field of video surveillance, and in particular to a video storage method and device.
背景技术Background technique
为了便于事后查证使用,对采集的视频图像进行存储是视频监控系统最基本的功能需求。在相关技术中,视频编码器产生的码流通常为CBR(Constants Bit Rate,恒定码流),因此可以将视频存储设备中的存储空间按照设定大小分割为多个空间单元,每个空间单元存储固定时间单元的录像,以便于实现录像回放的快速检索。将录像存储到视频存储设备之后,还会涉及到对录像的生命周期管理,即根据录像的重要性进行删除或覆盖,或者转码为更低的码率转存,亦或者抽帧转存,然而,无论是降低码率转存还是抽帧转存,都涉及到对原来存储空间的读取,并把抽帧或转码后的新码流覆盖到原来存储空间,这样对存储空间的多次读写增加了生命周期管理的复杂性。In order to facilitate subsequent verification and use, storing the collected video images is the most basic functional requirement of the video surveillance system. In related technologies, the code stream generated by the video encoder is usually CBR (Constants Bit Rate, constant code stream), so the storage space in the video storage device can be divided into multiple space units according to the set size, and each space unit The recording of a fixed time unit is stored for quick retrieval of recording playback. After the video is stored in the video storage device, it also involves the lifecycle management of the video, that is, to delete or overwrite the video according to the importance of the video, or to transcode to a lower bit rate for storage, or to dump the frame. However, no matter whether it is to reduce the code rate or dump the frame, it involves reading the original storage space and overwriting the new code stream after the frame extraction or transcoding to the original storage space, which greatly affects the storage space. Multiple reads and writes add to the complexity of lifecycle management.
发明内容Contents of the invention
有鉴于此,本申请提供一种录像存储方法及装置,以解决现有的存储方式增加了生命周期管理的复杂性的问题。In view of this, the present application provides a video storage method and device to solve the problem that the existing storage method increases the complexity of life cycle management.
根据本申请实施例的第一方面,提供一种录像存储方法,所述方法应用于管理服务器,所述方法包括:According to the first aspect of the embodiments of the present application, a video storage method is provided, the method is applied to a management server, and the method includes:
获取视频编码器预先配置的码流结构;Obtain the code stream structure pre-configured by the video encoder;
根据所述码流结构记录的码流层为每层划分对应的存储空间;divide the corresponding storage space for each layer according to the code stream layer recorded by the code stream structure;
将所述视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中;Each video frame in the code stream sent by the video encoder is sequentially stored in the storage space corresponding to the layer according to the layer to which it belongs;
其中,每个存储空间中存储的视频帧的优先级和生命周期,与其所属的层数成负相关关系。Wherein, the priority and life cycle of video frames stored in each storage space are negatively correlated with the number of layers to which they belong.
根据本申请实施例的第二方面,提供一种录像存储装置,所述装置应用于管理服务器,所述装置包括:According to the second aspect of the embodiments of the present application, a video storage device is provided, the device is applied to a management server, and the device includes:
获取单元,用于获取视频编码器预先配置的码流结构;An acquisition unit, configured to acquire a code stream structure pre-configured by the video encoder;
划分单元,用于根据所述码流结构记录的码流层为每层划分对应的存储空间;A division unit, configured to divide the corresponding storage space for each layer according to the code stream layer recorded in the code stream structure;
第一存储单元,用于将所述视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中;The first storage unit is used to sequentially store each video frame in the code stream sent by the video encoder into the storage space corresponding to the layer according to its layer;
其中,每个存储空间中存储的视频帧的优先级和生命周期,与其所属的层数成负相关关系。Wherein, the priority and life cycle of video frames stored in each storage space are negatively correlated with the number of layers to which they belong.
应用本申请实施例,管理服务器在对某一视频设备的录像进行存储之前,可以先获取其视频编码器中预先配置的码流结构,并根据获取的码流结构记录的码流层为每层划分对应的存储空间,然后再将其视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中,从而对视频编码器产生的码流实现了分层存储的目的,由于每个存储空间中存储的视频帧的优先级和生命周期,与其所属的层数成负相关关系,因此每个存储空间根据其对应层的优先级高低可以设置不同的生命周期进行管理,在某一层的视频帧的生命周期到期时,可以将该层对应存储空间中的视频帧直接丢弃或者覆盖掉,而不需要通过抽帧转存或者降低码率转存的方式对存储空间多次读写实现录像生命周期管理,从而本申请通过分层存储可以实现弹性生命周期管理,降低了录像生命周期管理的复杂性。Applying the embodiment of the present application, before storing the video recording of a certain video device, the management server can obtain the code stream structure pre-configured in its video encoder, and record the code stream layer according to the obtained code stream structure as each layer Divide the corresponding storage space, and then store each video frame in the code stream sent by the video encoder in the corresponding storage space of the layer according to its layer, so that the code stream generated by the video encoder is layered For the purpose of storage, since the priority and life cycle of video frames stored in each storage space are negatively correlated with the number of layers to which they belong, each storage space can set a different life cycle according to the priority of its corresponding layer For management, when the life cycle of a video frame of a certain layer expires, the video frame in the corresponding storage space of the layer can be directly discarded or overwritten, without the need to dump the frame or reduce the bit rate. The storage space is read and written multiple times to realize video life cycle management, so the application can realize flexible life cycle management through layered storage, reducing the complexity of video life cycle management.
附图说明Description of drawings
图1为本申请根据一示例性实施例示出的一种录像存储的场景图;FIG. 1 is a scene diagram of video storage according to an exemplary embodiment of the present application;
图2A为本申请根据一示例性实施例示出的一种录像存储方法的实施例流程图;FIG. 2A is a flow chart of an embodiment of a video storage method according to an exemplary embodiment of the present application;
图2B为本申请根据图2A所示实施例示出的一种码流结构;FIG. 2B is a code stream structure shown in the present application according to the embodiment shown in FIG. 2A;
图2C为本申请根据图2A所示实施例示出的另一种码流结构;FIG. 2C is another code stream structure shown in the present application according to the embodiment shown in FIG. 2A;
图3A为本申请根据一示例性实施例示出的另一种录像存储方法的实施例流程图;Fig. 3A is an embodiment flow chart of another video storage method according to an exemplary embodiment of the present application;
图3B为本申请根据图2B所示的码流结构示出的一种逻辑组和逻辑单元的划分图;FIG. 3B is a division diagram of a logical group and a logical unit shown in the present application according to the code stream structure shown in FIG. 2B;
图3C为本申请根据图3B所示的逻辑组和逻辑单元结构示出的一种存储空间的块空间划分图;FIG. 3C is a block space division diagram of a storage space shown in the present application according to the logical group and logical unit structure shown in FIG. 3B;
图3D为本申请根据图2C所示的码流结构示出的一种逻辑组和逻辑单元的划分图;FIG. 3D is a division diagram of a logical group and a logical unit shown in the present application according to the code stream structure shown in FIG. 2C;
图3E为本申请根据图3D所示的逻辑组和逻辑单元结构示出的一种存储空间的块空间划分图;FIG. 3E is a block space division diagram of a storage space shown in the present application according to the logical group and logical unit structure shown in FIG. 3D;
图4为本申请根据一示例性实施例示出的一种管理服务器的硬件结构图;FIG. 4 is a hardware structural diagram of a management server according to an exemplary embodiment of the present application;
图5为本申请根据一示例性实施例示出的一种录像存储装置的实施例结构图。Fig. 5 is a structural diagram of an embodiment of a video recording storage device according to an exemplary embodiment of the present application.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present application as recited in the appended claims.
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in this application is for the purpose of describing particular embodiments only, and is not intended to limit the application. As used in this application and the appended claims, the singular forms "a", "the", and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本申请可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of the present application, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
图1为本申请根据一示例性实施例示出的一种录像存储的场景图,图1中包括视频设备、管理服务器以及视频存储设备,其中,视频设备可以是IPC(Internet ProtocolCamera,网络摄像机),其设置有视频获取器和视频编码器,视频获取器用于采集监控视频,视频编码器用于对视频获取器采集的监控视频进行编码并生成码流,然后再将生成的码流发送至管理服务器;管理服务器用于将接收到的码流的存储到视频存储设备;视频存储设备可以是NVR(Network Video Recorder,网络视频存储器)或者IPSAN设备,用于为监控视频的码流数据提供存储空间。Fig. 1 is a scene diagram of a video recording storage shown in the present application according to an exemplary embodiment. Fig. 1 includes a video device, a management server and a video storage device, wherein the video device may be an IPC (Internet Protocol Camera, network camera), It is provided with a video acquirer and a video encoder, the video acquirer is used to collect surveillance video, and the video encoder is used to encode the surveillance video collected by the video acquirer and generate a code stream, and then send the generated code stream to the management server; The management server is used to store the received code stream into a video storage device; the video storage device can be an NVR (Network Video Recorder, network video storage) or an IPSAN device, which is used to provide storage space for the code stream data of the surveillance video.
图2A为本申请根据一示例性实施例示出的一种录像存储方法的实施例流程图;图2B为本申请根据图2A所示实施例示出的一种码流结构;图2C为本申请根据图2A所示实施例示出的另一种码流结构,该录像存储方法可以应用于上述图1所示的管理服务器上,如图2A所示,该录像存储方法包括如下步骤:Fig. 2A is a flow chart of an embodiment of a video storage method shown in the present application according to an exemplary embodiment; Fig. 2B is a code stream structure shown in the present application according to the embodiment shown in Fig. 2A; Fig. 2C is a flow chart of the present application according to the Another code stream structure shown in the embodiment shown in Figure 2A, the video storage method can be applied to the management server shown in Figure 1 above, as shown in Figure 2A, the video storage method includes the following steps:
步骤201:获取视频编码器预先配置的码流结构。Step 201: Obtain the code stream structure pre-configured by the video encoder.
在一实施例中,管理服务器可以对视频编码器的编码规则预先进行配置,以得到相应的码流结构,从而可以从视频设备中的视频编码器中获取到相应的码流结构。In an embodiment, the management server may pre-configure the encoding rules of the video encoder to obtain a corresponding code stream structure, so that the corresponding code stream structure may be obtained from the video encoder in the video device.
步骤202:根据该码流结构记录的码流层为每层划分对应的存储空间。Step 202: Divide corresponding storage space for each layer according to the code stream layer recorded in the code stream structure.
在一实施例中,码流结构中可以记录码流层,即视频编码器产生的码流包括的码流层数,通常,码流层中的第0层为基础层,第1层以上的码流层均为增强层,在进行解码时,增强层的视频帧均需要根据基础层的视频帧才能实现最终的解码,因此,基础层中的视频帧比增强层中的视频帧的重要性高,优先级也高,且增强层中的视频帧随着层数的升高,其重要性降低,优先级也降低。本领域技术人员可以理解的是,划分的多个存储空间可以位于视频存储设备的一个硬盘上,也可以位于视频存储设备的多个硬盘上,并且,每个存储空间的大小可以根据实际需求进行设置,可以相同也可以不相同,本申请在此不进行限制。此外,码流结构中还可以记录各视频帧之间的参考关系。In an embodiment, the code stream layer can be recorded in the code stream structure, that is, the number of code stream layers included in the code stream generated by the video encoder. Usually, the 0th layer in the code stream layer is the base layer, and the layer above the 1st layer The code stream layer is an enhancement layer. When decoding, the video frames of the enhancement layer need to be decoded according to the video frames of the base layer. Therefore, the video frames in the base layer are more important than the video frames in the enhancement layer. High, the priority is also high, and as the number of layers increases, the importance of video frames in the enhancement layer decreases, and the priority also decreases. Those skilled in the art can understand that the multiple divided storage spaces can be located on one hard disk of the video storage device, or on multiple hard disks of the video storage device, and the size of each storage space can be adjusted according to actual needs. The settings may be the same or different, which is not limited in this application. In addition, the reference relationship between each video frame can also be recorded in the code stream structure.
需要说明的是,在码流结构中通常会涉及到GOP的概念,GOP(Group Of Picture,视频组长度)指的是一组连续的视频帧,即一个I帧后面连续跟多个P帧,一个GOP的开始帧为I帧,结束帧为下一个GOP的开始帧(I帧)的前一帧(P帧),其中,I帧记录的是一个完整的画面,P帧是一个前向预测帧,记录的是相对于前一帧(I帧或者P帧)的变化。通常I帧的长度最长,属于不同层的P帧的长度不同,但属于同一增强层的P帧的长度一般均相同。此外,一个GOP中可以包括多个根参考帧(I帧或P帧),每两个根参考帧之间包括的帧数相同,一个GOP的开始帧即为第一个根参考帧,前一根参考帧为后一根参考帧的参考帧,且根参考帧均属于码流层的第0层。It should be noted that the concept of GOP is usually involved in the code stream structure. GOP (Group Of Picture, video group length) refers to a group of continuous video frames, that is, one I frame is followed by multiple P frames consecutively. The start frame of a GOP is the I frame, and the end frame is the previous frame (P frame) of the start frame (I frame) of the next GOP, where the I frame records a complete picture, and the P frame is a forward prediction Frame, which records changes relative to the previous frame (I frame or P frame). Usually the length of the I frame is the longest, and the lengths of the P frames belonging to different layers are different, but the lengths of the P frames belonging to the same enhancement layer are generally the same. In addition, a GOP may include multiple root reference frames (I frames or P frames), and the number of frames included between each two root reference frames is the same. The start frame of a GOP is the first root reference frame, and the previous The root reference frame is a reference frame of the next reference frame, and the root reference frames all belong to layer 0 of the code stream layer.
在一示例性的场景中,如图2B所示,其码流层为0层和1层,其中,第0层包括帧0、帧2、帧4、帧6、帧8,第1层包括帧1、帧3、帧5、帧7,且第0层中的帧0和帧8为根参考帧,帧8以帧0为参考帧。此外,两个根参考帧之间包括的3个同属于0层的视频帧(帧2、帧4、帧6)均以同属于0层的前一帧为参考帧,第1层中的视频帧均以其前一帧为参考帧。从而,管理服务器可以划分出两个存储空间(存储空间1和存储空间2),层0对应存储空间1,层1对应存储空间2。In an exemplary scenario, as shown in FIG. 2B , the code stream layers are layer 0 and layer 1, wherein layer 0 includes frame 0, frame 2, frame 4, frame 6, and frame 8, and layer 1 includes Frame 1, frame 3, frame 5, and frame 7, and frame 0 and frame 8 in the 0th layer are the root reference frames, and frame 8 uses frame 0 as the reference frame. In addition, the three video frames (frame 2, frame 4, and frame 6) that belong to layer 0 included between the two root reference frames all use the previous frame that belongs to layer 0 as the reference frame, and the video frames in layer 1 Each frame takes its previous frame as the reference frame. Therefore, the management server can divide two storage spaces (storage space 1 and storage space 2), layer 0 corresponds to storage space 1, and layer 1 corresponds to storage space 2.
在另一示例性的场景中,如图2C所示,其码流层为0层、1层、2层,第0层包括帧0、帧4、帧8、帧12、帧16,第1层包括帧2、帧6、帧10、帧14,第2层包括帧1、帧3、帧5、帧7、帧9、帧11、帧13、帧15,且第0层中的帧0和帧16为根参考帧,帧16以帧0为参考帧。此外,两个根参考帧之间包括的3个同属于0层的视频帧(帧4、帧8、帧12)均以同属于0层的前一帧为参考帧,第1层和第2层中的视频帧均以其前一帧为参考帧。从而,管理服务器可以划分出三个存储空间(存储空间1至存储空间3),层0对应存储空间1、层1对应存储空间2、层2对应存储空间3。In another exemplary scenario, as shown in FIG. 2C , the code stream layers are layer 0, layer 1, and layer 2, and layer 0 includes frame 0, frame 4, frame 8, frame 12, frame 16, and layer 1 Layer includes frame 2, frame 6, frame 10, frame 14, layer 2 includes frame 1, frame 3, frame 5, frame 7, frame 9, frame 11, frame 13, frame 15, and frame 0 in layer 0 And frame 16 is the root reference frame, and frame 16 uses frame 0 as the reference frame. In addition, the three video frames (frame 4, frame 8, and frame 12) that belong to layer 0 included between the two root reference frames all use the previous frame that belongs to layer 0 as the reference frame. Each video frame in a layer uses its previous frame as a reference frame. Therefore, the management server can divide three storage spaces (storage space 1 to storage space 3), layer 0 corresponds to storage space 1, layer 1 corresponds to storage space 2, and layer 2 corresponds to storage space 3.
步骤203:将视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中;其中,每个存储空间中存储的视频帧对应的优先级和生命周期,与其所属的层数成负相关关系。Step 203: Store each video frame in the code stream sent by the video encoder in the storage space corresponding to the layer according to its layer; wherein, the priority and life cycle corresponding to the video frame stored in each storage space, It is negatively correlated with the number of layers it belongs to.
在一实施例中,由于每个存储空间中存储的视频帧对应的优先级和生命周期,与其所属的层数成负相关关系,即层数越低,对应的存储空间存储的视频帧的优先级越低,重要性越低,生命周期越短,因此将属于不同层的视频帧存储到不同的存储空间可以实现录像的弹性生命周期管理。In one embodiment, due to the priority and life cycle corresponding to the video frames stored in each storage space, there is a negative correlation with the number of layers it belongs to, that is, the lower the number of layers, the priority of the video frames stored in the corresponding storage space. The lower the level, the lower the importance and the shorter the life cycle. Therefore, storing video frames belonging to different layers in different storage spaces can achieve flexible life cycle management of recordings.
在一示例性的场景中,再如图2B所示,第0层包括的帧0、帧2、帧4、帧6、帧8可以依次存储到存储空间1,第1层包括的帧1、帧3、帧5、帧7可以依次存储到存储空间2。其中,由于第0层的视频帧的优先级比第1层的视频帧的优先级高,因此存储空间1中存储的视频帧对应的生命周期可以短些,例如,3个月,存储空间2中存储的视频帧对应的生命周期可以长些,例如,6个月,在3个月后,可以将存储空间1中的视频帧直接丢弃或者直接覆盖,在6个月后,再将存储空间2中的视频帧直接丢弃或者直接覆盖。In an exemplary scenario, as shown in FIG. 2B , frame 0, frame 2, frame 4, frame 6, and frame 8 included in the 0th layer can be sequentially stored in the storage space 1, and frames 1, Frame 8 included in the first layer, Frame 3, frame 5, and frame 7 can be stored in storage space 2 in sequence. Wherein, since the priority of the video frame of the 0th layer is higher than that of the video frame of the 1st layer, the corresponding life cycle of the video frame stored in the storage space 1 can be shorter, for example, 3 months, and the storage space 2 The life cycle corresponding to the video frames stored in can be longer, for example, 6 months. After 3 months, the video frames in storage space 1 can be directly discarded or directly overwritten. After 6 months, the storage space The video frames in 2 are directly discarded or directly overwritten.
由上述实施例可知,管理服务器在对某一视频设备的录像进行存储之前,可以先获取其视频编码器中预先配置的码流结构,并根据获取的码流结构记录的码流层为每层划分对应的存储空间,然后再将其视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中,从而对视频编码器产生的码流实现了分层存储的目的,由于每个存储空间中存储的视频帧的优先级和生命周期,与其所属的层数成负相关关系,因此每个存储空间根据其对应层的优先级高低可以设置不同的生命周期进行管理,在某一层的视频帧的生命周期到期时,可以将该层对应存储空间中的视频帧直接丢弃或者覆盖掉,而不需要通过抽帧转存或者降低码率转存的方式对存储空间多次读写实现录像生命周期管理,从而本申请通过分层存储可以实现弹性生命周期管理,降低了录像生命周期管理的复杂性。It can be seen from the above embodiments that before storing the video recording of a certain video device, the management server can first obtain the code stream structure pre-configured in its video encoder, and record the code stream layer according to the obtained code stream structure as each layer Divide the corresponding storage space, and then store each video frame in the code stream sent by the video encoder in the corresponding storage space of the layer according to its layer, so that the code stream generated by the video encoder is layered For the purpose of storage, since the priority and life cycle of video frames stored in each storage space are negatively correlated with the number of layers to which they belong, each storage space can set a different life cycle according to the priority of its corresponding layer For management, when the life cycle of a video frame of a certain layer expires, the video frame in the corresponding storage space of the layer can be directly discarded or overwritten, without the need to dump the frame or reduce the bit rate. The storage space is read and written multiple times to realize video life cycle management, so the application can realize flexible life cycle management through layered storage, reducing the complexity of video life cycle management.
图3A为本申请根据一示例性实施例示出的另一种录像存储方法的实施例流程图;图3B为本申请根据图2B所示的码流结构示出的一种逻辑组和逻辑单元的划分图;图3C为本申请根据图3B所示的逻辑组和逻辑单元结构示出的一种存储空间的块空间划分图;图3D为本申请根据图2C所示的码流结构示出的一种逻辑组和逻辑单元的划分图;图3E为本申请根据图3D所示的逻辑组和逻辑单元结构示出的一种存储空间的块空间划分图,本实施例利用本申请实施例提供的上述方法,以如何将视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中为例进行示例性说明,如图3A所示,该录像存储方法包括如下步骤:Fig. 3A is an embodiment flow chart of another video storage method shown in the present application according to an exemplary embodiment; Fig. 3B is a logic group and a logical unit shown in the present application according to the stream structure shown in Fig. 2B Partition diagram; FIG. 3C is a block space partition diagram of a storage space shown in the present application according to the logical group and logical unit structure shown in FIG. 3B; FIG. 3D is a block space partition diagram shown in the present application according to the code stream structure shown in FIG. 2C A division diagram of a logical group and a logical unit; FIG. 3E is a block space division diagram of a storage space shown in the present application according to the logical group and logical unit structure shown in FIG. 3D , and this embodiment uses the embodiment of the present application to provide The above-mentioned method, how to sequentially store each video frame in the code stream sent by the video encoder into the storage space corresponding to the layer according to the layer to which it belongs is exemplified as an example, as shown in Figure 3A, the video storage method Including the following steps:
步骤301:获取视频编码器预先配置的逻辑单元结构。Step 301: Obtain a pre-configured logical unit structure of a video encoder.
在一实施例中,管理服务器可以在视频编码器中根据配置的码流结构进行逻辑划分,即预先配置逻辑单元结构,该逻辑单元结构可以记录逻辑单元包括的码流层、每层包括的帧数。In an embodiment, the management server can perform logical division in the video encoder according to the configured code stream structure, that is, pre-configure the logical unit structure, and the logical unit structure can record the code stream layers included in the logical unit and the frames included in each layer number.
步骤302:根据该逻辑单元结构对码流进行逻辑单元划分,各逻辑单元对应的时间单元相同。Step 302: Divide the code stream into logical units according to the logical unit structure, and each logical unit corresponds to the same time unit.
针对根据该逻辑单元结构,对码流进行逻辑单元划分的过程,管理服务器可以先根据码流结构记录的两个根参考帧之间包括的帧数对码流划分逻辑组,其中,每个逻辑组为从第0层的某一个根参考帧开始,到第0层的下一个根参考帧的前一帧结束,然后再针对每个逻辑组,根据逻辑单元结构对该逻辑组包括的视频帧划分逻辑单元,其中,该逻辑组包括的帧数是各逻辑单元包括的帧数的整数倍,且前一逻辑单元中的第一帧均为后一逻辑单元中的第一帧的参考帧。For the process of dividing the code stream into logical units according to the logical unit structure, the management server may divide the code stream into logical groups according to the number of frames included between two root reference frames recorded in the code stream structure, wherein each logic A group starts from a certain root reference frame of the 0th layer and ends at the previous frame of the next root reference frame of the 0th layer, and then for each logical group, the video frames included in the logical group according to the logical unit structure Divide logical units, wherein the number of frames included in the logical group is an integer multiple of the number of frames included in each logical unit, and the first frame in the previous logical unit is a reference frame for the first frame in the subsequent logical unit.
其中,由于每个逻辑组为从第0层的某一个根参考帧开始,到第0层的下一个根参考帧的前一帧结束,因此每个逻辑组中包括一个根参考帧(I帧或者P帧),该根参考帧为该逻辑组的引导帧,逻辑组中的其它视频帧(P帧)最终均需要根据该根参考帧才可解码。由于逻辑单元结构为逻辑单元包括的码流层和每层包括的帧数,从而针对每个逻辑组,可以从该逻辑组的引导帧开始按照逻辑单元结构划分逻辑单元,且各逻辑单元对应的时间单元均相同。Wherein, since each logical group starts from a certain root reference frame of the 0th layer and ends at the previous frame of the next root reference frame of the 0th layer, a root reference frame (I frame) is included in each logical group or P frame), the root reference frame is the leading frame of the logical group, and other video frames (P frames) in the logical group can finally be decoded according to the root reference frame. Since the logical unit structure is the code stream layer included in the logical unit and the number of frames included in each layer, for each logical group, the logical unit can be divided according to the logical unit structure starting from the leading frame of the logical group, and the corresponding The time units are all the same.
需要说明的是,一个逻辑组只包括一个根参考帧,且该根参考帧为逻辑组的引导帧,而一个GOP可以包括多个根参考帧,因此逻辑组与GOP没有必然关联性,通常一个GOP中可以包括多个逻辑组。It should be noted that a logical group includes only one root reference frame, and the root reference frame is the leading frame of the logical group, and a GOP can include multiple root reference frames, so the logical group and the GOP are not necessarily related, usually a Multiple logical groups can be included in a GOP.
步骤303:从各逻辑单元包括的码流层和每层包括的帧码流长度中获取每层包括的最大帧码流长度,并在每层对应的存储空间中,按照该层包括的最大帧码流长度为各逻辑单元划分块空间。Step 303: Obtain the maximum frame code stream length included in each layer from the code stream layer included in each logical unit and the frame code stream length included in each layer, and in the storage space corresponding to each layer, according to the maximum frame code stream included in the layer The code stream length divides the block space for each logical unit.
在一实施例中,为了便于录像检索时检索位置的计算,管理服务器可以在存储空间中为每个逻辑单元划分对应的块空间,由于有的逻辑单元中包括有I帧,有的逻辑单元不包括I帧,且属于不同层的P帧的长度也不同,因此划分的每个逻辑单元包括的帧码流长度不可能均相同,因此需要从划分出的各逻辑单元包括的码流层和每层包括的帧码流长度中,获取每层包括的最大帧码流长度,并将该最大帧码流长度作为相应存储空间中每个块空间的大小,从而可以保证各逻辑单元包括的各层的视频帧能够完全存储到相应存储空间的块空间中。In one embodiment, in order to facilitate the calculation of the search position during video retrieval, the management server can divide the corresponding block space for each logical unit in the storage space, because some logical units include I frames, and some logical units do not It includes I frames, and the lengths of P frames belonging to different layers are also different. Therefore, the frame code stream lengths included in each divided logical unit cannot be the same. Among the frame code stream lengths included in each layer, the maximum frame code stream length included in each layer is obtained, and the maximum frame code stream length is used as the size of each block space in the corresponding storage space, so as to ensure that each layer included in each logical unit The video frames of can be completely stored in the block space of the corresponding storage space.
需要说明的是,由于通过一个GOP的视频帧的编码即可得到码流结构,因此管理服务器从各逻辑单元包括的码流层和每层包括的帧码流长度中获取每层包括的最大帧码流长度时,可以从属于一个GOP的各逻辑单元包括的码流层和每层包括的帧码流长度中,获取每层包括的最大帧码流长度,或者也可以从一个GOP包括的各逻辑组的第一个逻辑单元包括的码流层和每层包括的帧码流长度中,获取每层包括的最大帧码流长度,而不是从划分得到的所有逻辑单元中获取,以提高获取效率。It should be noted that since the code stream structure can be obtained by encoding the video frames of a GOP, the management server obtains the maximum frame included in each layer from the code stream layers included in each logical unit and the frame code stream length included in each layer When the code stream length is used, the maximum frame code stream length included in each layer can be obtained from the code stream layers included in each logical unit belonging to a GOP and the frame code stream length included in each layer, or can also be obtained from the code stream lengths included in each layer of a GOP. From the code stream layer included in the first logical unit of the logical group and the frame code stream length included in each layer, the maximum frame code stream length included in each layer is obtained instead of being obtained from all the divided logical units to improve acquisition efficiency.
在一示例性场景中,再如上述图2B所示的一种码流,帧0与帧8均为根参考帧,帧0的帧码流长度为M0字节,帧2、帧4、帧6的帧码流长度均为M1字节,帧1、帧3、帧5、帧7的帧码流长度均为M2字节,逻辑单元结构为0层和1层,第0层包括1个帧,第1层包括1个帧,从而,可以得到如图3B所示的逻辑组和逻辑单元划分,逻辑组(帧0至帧7)中包括4个逻辑单元(逻辑单元0、逻辑单元1、逻辑单元2以及逻辑单元3),逻辑单元0包括帧0和帧1、逻辑单元1包括帧2和帧3、逻辑单元2包括帧4和帧5、逻辑单元3包括帧6和帧7。由于I帧的长度最长,因此,该码流结构中逻辑单元0包括的第0层的帧0的帧码流长度M0字节最大,又由于第1层的P帧的长度均为M2字节,因此每个逻辑单元包括的第1层的最大帧码流长度为M2字节,进而得到如图3C所示的存储空间的块空间划分,每个逻辑单元对应的时间单元为t秒。In an exemplary scenario, as shown in the code stream shown in FIG. 2B above, frame 0 and frame 8 are both root reference frames, the frame code stream length of frame 0 is M0 bytes, frame 2, frame 4, frame The frame code stream length of 6 is M1 byte, the frame code stream length of frame 1, frame 3, frame 5, and frame 7 is M2 byte, the logical unit structure is 0 layer and 1 layer, and the 0 layer includes 1 Frame, the first layer includes 1 frame, thus, can obtain logical group and logical unit division as shown in Fig. 3B, comprise 4 logical units (logical unit 0, logical unit 1 in the logical group (frame 0 to frame 7) , logical unit 2 and logical unit 3), logical unit 0 includes frame 0 and frame 1, logical unit 1 includes frame 2 and frame 3, logical unit 2 includes frame 4 and frame 5, and logical unit 3 includes frame 6 and frame 7. Because the length of the I frame is the longest, the frame code stream length M0 byte of the frame 0 of the 0th layer included in the logic unit 0 in the code stream structure is the largest, and because the length of the P frame of the 1st layer is M2 words Therefore, the maximum frame code stream length of the first layer included in each logical unit is M2 bytes, and then the block space division of the storage space as shown in Figure 3C is obtained, and the time unit corresponding to each logical unit is t seconds.
在另一示例性场景中,再如上述图2C所示的另一种码流,帧0和帧16均为根参考帧,帧0的帧码流长度为M3字节,帧4、帧8、帧12的帧码流长度均为M4字节,帧2、帧6、帧10、帧14的帧码流长度均为M5字节,帧1、帧3、帧5、帧7、帧9、帧11、帧13、帧15的帧码流长度均为M6字节,逻辑单元结构为0层、1层和2层,第0层包括1个帧,第1层包括1个帧,第2层包括2个帧,从而,可以得到如图3D所示的逻辑组和逻辑单元划分,逻辑组(帧0至帧15)中包括4个逻辑单元(逻辑单元0、逻辑单元1、逻辑单元2以及逻辑单元3),逻辑单元0包括帧0至帧3、逻辑单元1包括帧4至帧7、逻辑单元2包括帧8至帧11、逻辑单元3包括帧12至帧15。由于I帧的长度最长,因此该码流结构中逻辑单元0包括的第0层的帧0的帧码流长度M3字节最大,又由于第1层的P帧的长度均为M3字节,因此每个逻辑单元包括的第1层的最大帧码流长度为M5字节,又由于第2层的P帧的长度均为M6字节,因此每个逻辑单元包括的第2层的最大帧码流长度为2*M6,进而得到如图3E所示的存储空间的块空间划分,每个逻辑单元对应的时间单元为t秒。In another exemplary scenario, as another code stream shown in FIG. 2C above, frame 0 and frame 16 are both root reference frames, the frame code stream length of frame 0 is M3 bytes, and frame 4 and frame 8 , The frame code stream length of frame 12 is M4 bytes, the frame code stream length of frame 2, frame 6, frame 10, frame 14 is M5 bytes, frame 1, frame 3, frame 5, frame 7, frame 9 , Frame 11, Frame 13, and Frame 15 have a frame code stream length of M6 bytes. The logical unit structure is layer 0, layer 1, and layer 2. Layer 0 includes 1 frame, layer 1 includes 1 frame, and layer 1 includes 1 frame. Layer 2 includes 2 frames, thus, the logical group and logical unit division as shown in Figure 3D can be obtained, and the logical group (frame 0 to frame 15) includes 4 logical units (logical unit 0, logical unit 1, logical unit 2 and logical unit 3), logical unit 0 includes frames 0 to 3, logical unit 1 includes frames 4 to 7, logical unit 2 includes frames 8 to 11, and logical unit 3 includes frames 12 to 15. Because the length of the I frame is the longest, the frame code stream length M3 bytes of the frame 0 of the 0th layer included in the logic unit 0 in the code stream structure is the largest, and because the length of the P frame of the 1st layer is M3 bytes , so the maximum frame stream length of the first layer included in each logical unit is M5 bytes, and since the length of the P frame of the second layer is M6 bytes, the maximum length of the second layer included in each logical unit The length of the frame code stream is 2*M6, and then the block space division of the storage space as shown in FIG. 3E is obtained, and the time unit corresponding to each logical unit is t seconds.
步骤304:将各逻辑单元包括的视频帧,按照其所属层存储到相应存储空间的对应块空间中。Step 304: Store the video frames included in each logical unit in the corresponding block space of the corresponding storage space according to the layer they belong to.
需要说明的是,为了在录像回放时,快速的检索到录像的存放位置并进行读取回放,管理服务器可以将步骤303获取的每层包括的最大帧码流长度确定为逻辑单元在相应存储空间中占用的空间大小,并将确定的逻辑单元在每个存储空间中占用的空间大小、每个存储空间的起始位置和码流的起始时间记录到索引列表中,当接收到检索指令时,根据索引列表中记录的每个存储空间的起始位置和逻辑单元在每个存储空间中占用的空间大小、检索指令携带的检索录像的起止时间获得检索录像在每个存储空间中的起止位置,并根据获得的每个存储空间中的起止位置并行读取各存储空间中的视频帧,最后将读取的视频帧按照帧序号写入解码缓存列表,并将解码缓存列表发送至解码器,以使解码器进行解码并回放。由于每个存储空间在物理上是分离的,因此在获得每个存储空间中的起止位置后,可以并行的读取每个存储空间中的视频帧,而现有技术中只能在一个存储空间中读取,进而可以降低录像检索和回放的时延。It should be noted that, in order to quickly retrieve the storage location of the video and perform playback during video playback, the management server can determine the maximum frame code length included in each layer obtained in step 303 as the logical unit in the corresponding storage space The size of the space occupied by the logical unit, and record the space occupied by the determined logical unit in each storage space, the starting position of each storage space and the starting time of the code stream in the index list, when the retrieval command is received According to the start position of each storage space recorded in the index list, the space occupied by the logical unit in each storage space, and the start and end time of the retrieval video carried by the retrieval command, the start and end positions of the retrieval video in each storage space are obtained , and read the video frames in each storage space in parallel according to the obtained start and end positions in each storage space, and finally write the read video frames into the decoding buffer list according to the frame number, and send the decoding buffer list to the decoder, to enable the decoder to decode and play back. Since each storage space is physically separated, after obtaining the start and end positions in each storage space, the video frames in each storage space can be read in parallel, while in the prior art only one storage space In this way, the time delay of video retrieval and playback can be reduced.
进一步地,管理服务器根据检索指令携带的检索录像的起止时间还可以计算出该起止时间段内包括的逻辑单元数,另外,还可以计算出某一逻辑单元在每个存储空间中的位置,从而可以实现属于同一个逻辑单元的存储于不同存储空间且在时间上紧相邻的属于不同层的视频帧的快速检索和回放。Furthermore, the management server can also calculate the number of logical units included in the start and end time period according to the start and end time of the retrieved video carried by the retrieval instruction, and also calculate the position of a certain logic unit in each storage space, so that Fast retrieval and playback of video frames belonging to different layers that are stored in different storage spaces and that are closely adjacent in time and belong to the same logical unit can be realized.
在一示例性场景中,如图3C所示,假设索引列表中记录的存储空间1的起始位置为K1,存储空间2的起始位置为K2,码流的起始时间为T,逻辑单元在存储空间1中占用的空间大小为M0字节,在存储空间2中占用的空间大小为M2字节,且逻辑单元对应的时间单元为t秒,如果接收到的检索指令携带的检索录像的起止时间为T-start和T-end,则检索录像在存储空间1中的起止位置分别为K1+(T-start-T)/t*M0和K1+(T-end-T)/t*M0,在存储空间2中的起止位置分别为K2+(T-start-T)/t*M2和K2+(T-end-T)/t*M2,从而可以读取存储空间1中起止位置为K1+(T-start-T)/t*M0和K1+(T-end-T)/t*M0中的视频帧和存储空间2中起止位置为K2+(T-start-T)/t*M2和K2+(T-end-T)/t*M2中的视频帧,并将读取的视频帧按照帧序号写入解码缓存列表并发送至解码器,以使解码器进行解码并回放。In an exemplary scenario, as shown in FIG. 3C , assuming that the starting position of storage space 1 recorded in the index list is K1, the starting position of storage space 2 is K2, and the starting time of the code stream is T, the logic unit The space occupied in storage space 1 is M0 bytes, and the space occupied in storage space 2 is M2 bytes, and the time unit corresponding to the logic unit is t seconds. The start and end times are T-start and T-end, then the start and end positions of the retrieved video in storage space 1 are K1+(T-start-T)/t*M0 and K1+(T-end-T)/t*M0 respectively, The start and end positions in storage space 2 are K2+(T-start-T)/t*M2 and K2+(T-end-T)/t*M2 respectively, so that the start and end positions in storage space 1 can be read as K1+(T -start-T)/t*M0 and K1+(T-end-T)/t*M0 in the video frame and storage space 2 start and end positions are K2+(T-start-T)/t*M2 and K2+(T -end-T)/t*M2, and write the read video frame into the decoding buffer list according to the frame number and send it to the decoder, so that the decoder can decode and play back.
此外,管理服务器还可以计算出该起止时间段内包括的逻辑单元数为m=(T-end-T-start)/t。第n(n<=m)个逻辑单元在存储空间1中的位置为K1+(T-start-T)/t*M0*n,在存储空间2中的位置为K2+(T-start-T)/t*M2*n。In addition, the management server can also calculate the number of logic units included in the start-end time period as m=(T-end-T-start)/t. The position of the nth (n<=m) logical unit in storage space 1 is K1+(T-start-T)/t*M0*n, and the position in storage space 2 is K2+(T-start-T) /t*M2*n.
需要进一步说明的是,管理服务器可以在每个存储空间中的各块空间头部设置一个预设大小的单元,在将各逻辑单元包括的视频帧,按照其所属层存储到相应存储空间中的同时,将其实际帧码流长度存储到该块空间头部的预设大小的单元中。从而,对于针对每个存储空间,读取该存储空间的起止位置段中的视频帧的过程,管理服务器可以针对每个存储空间,根据该存储空间的起止位置段中的各块空间头部存储的实际帧码流长度读取各块空间中的视频帧,以提高读取效率。It should be further explained that the management server can set a unit with a preset size at the head of each block in each storage space, and store the video frames included in each logical unit in the corresponding storage space according to the layer it belongs to. At the same time, the actual frame code stream length is stored in a unit of a preset size in the head of the block space. Therefore, for each storage space, the process of reading the video frames in the start and end position segments of the storage space, the management server may, for each storage space, store The actual frame code stream length reads the video frames in each block space to improve the reading efficiency.
由上述实施例可知,管理服务器在对视频编码器发送的码流按照层存储时,可以先获取视频编码器预先配置的逻辑单元结构,并根据逻辑单元结构对码流进行逻辑单元划分,且各逻辑单元对应的时间单元相同,然后从各逻辑单元包括的码流层和每层包括的帧码流长度中获取每层包括的最大帧码流长度,并在每层对应的存储空间中,按照该层包括的最大帧码流长度为各逻辑单元划分块空间,最后将各逻辑单元包括的视频帧,按照其所属层存储到相应存储空间的对应块空间中,从而通过逻辑单元可以实现分离式存储。此外,由于每个逻辑单元在各个存储空间中均对应一个块空间,且每个逻辑单元对应的时间单元相同,因此可以方便录像检索时检索位置的快速计算。It can be seen from the above embodiments that when the management server stores the code stream sent by the video encoder according to the layer, it can first obtain the logical unit structure pre-configured by the video encoder, and divide the code stream into logical units according to the logical unit structure, and each The time units corresponding to the logical units are the same, and then the maximum frame code stream length included in each layer is obtained from the code stream layers included in each logical unit and the frame code stream length included in each layer, and in the storage space corresponding to each layer, according to The maximum frame stream length included in this layer divides the block space for each logical unit, and finally stores the video frames included in each logical unit in the corresponding block space of the corresponding storage space according to its layer, so that the separated type can be realized through the logical unit storage. In addition, since each logical unit corresponds to a block space in each storage space, and each logical unit corresponds to the same time unit, it is convenient to quickly calculate the retrieval position during video retrieval.
与前述录像存储方法的实施例相对应,本申请还提供了录像存储装置的实施例。Corresponding to the foregoing embodiment of the video storage method, the present application also provides an embodiment of a video storage device.
本申请录像存储装置的实施例可以应用在管理服务器上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图4所示,为本申请根据一示例性实施例示出的一种管理服务器的硬件结构图,除了图4所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的设备通常根据该设备的实际功能,还可以包括其他硬件,对此不再赘述。The embodiment of the video recording storage device of the present application can be applied on the management server. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for operation by the processor of the device where it is located. From the perspective of hardware, as shown in FIG. 4, it is a hardware structure diagram of a management server according to an exemplary embodiment of the present application, except for the processor, memory, network interface, and non-volatile In addition to the non-volatile memory, the device where the device in the embodiment is located usually may also include other hardware according to the actual function of the device, which will not be repeated here.
图5为本申请根据一示例性实施例示出的一种录像存储装置的实施例结构图,该录像存储装置可以应用于管理服务器上,如图5所示,该录像存储装置包括:获取单元51、划分单元52、第一存储单元53。FIG. 5 is a structural diagram of an embodiment of a video storage device according to an exemplary embodiment of the present application. The video storage device can be applied to a management server. As shown in FIG. 5 , the video storage device includes: an acquisition unit 51 , a division unit 52 , and a first storage unit 53 .
其中,获取单元51,用于获取视频编码器预先配置的码流结构;Wherein, the obtaining unit 51 is used to obtain the code stream structure pre-configured by the video encoder;
划分单元52,用于根据所述码流结构记录的码流层为每层划分对应的存储空间;A division unit 52, configured to divide the corresponding storage space for each layer according to the code stream layer recorded in the code stream structure;
第一存储单元53,用于将所述视频编码器发送的码流中的各视频帧按照其所属层依次存储到该层对应的存储空间中;The first storage unit 53 is configured to sequentially store each video frame in the code stream sent by the video encoder into the storage space corresponding to the layer according to its layer;
其中,每个存储空间中存储的视频帧的优先级和生命周期,与其所属的层数成负相关关系。Wherein, the priority and life cycle of video frames stored in each storage space are negatively correlated with the number of layers to which they belong.
在一可选的实现方式中,所述第一存储单元53,具体用于获取所述视频编码器预先配置的逻辑单元结构;根据所述逻辑单元结构对所述码流进行逻辑单元划分;其中,各逻辑单元对应的时间单元相同;从各逻辑单元包括的码流层和每层包括的帧码流长度中获取每层包括的最大帧码流长度;在每层对应的存储空间中,按照该层包括的最大帧码流长度为各逻辑单元划分块空间;将各逻辑单元包括的视频帧,按照其所属层存储到相应存储空间的对应块空间中。In an optional implementation manner, the first storage unit 53 is specifically configured to acquire a pre-configured logical unit structure of the video encoder; divide the code stream into logical units according to the logical unit structure; wherein , each logical unit corresponds to the same time unit; obtain the maximum frame code stream length included in each layer from the code stream layer included in each logical unit and the frame code stream length included in each layer; in the storage space corresponding to each layer, according to The maximum frame code stream length included in this layer divides the block space for each logical unit; the video frames included in each logical unit are stored in the corresponding block space of the corresponding storage space according to the layer they belong to.
在一可选的实现方式中,所述第一存储单元53,还具体用于在根据所述逻辑单元结构对所述码流进行逻辑单元划分过程中,根据所述码流结构记录的两个根参考帧之间包括的帧数对所述码流划分逻辑组;其中,每个逻辑组为从第0层的某一根参考帧开始,到第0层的下一个根参考帧的前一帧结束;针对每个逻辑组,根据所述逻辑单元结构对该逻辑组包括的视频帧划分逻辑单元;其中,该逻辑组包括的帧数是各逻辑单元包括的帧数的整数倍,且前一逻辑单元中的第一帧均为后一逻辑单元中的第一帧的参考帧。In an optional implementation manner, the first storage unit 53 is also specifically configured to, during the process of dividing the code stream into logical units according to the logical unit structure, record the two The number of frames included between the root reference frames divides the code stream into logical groups; wherein, each logical group starts from a certain root reference frame of the 0th layer and goes to the previous one of the next root reference frame of the 0th layer The frame ends; for each logical group, divide the video frame included in the logical group into logical units according to the logical unit structure; wherein, the number of frames included in the logical group is an integer multiple of the number of frames included in each logical unit, and the previous The first frame in a logical unit is the reference frame of the first frame in the next logical unit.
在一可选的实现方式中,所述装置还包括(图5中未示出):In an optional implementation, the device further includes (not shown in FIG. 5 ):
记录单元,用于将获取的每层包括的最大帧码流长度确定为逻辑单元在相应存储空间中占用的空间大小;将确定的逻辑单元在每个存储空间中占用的空间大小、每个存储空间的起始位置和所述码流的起始时间记录到索引列表中;The recording unit is used to determine the obtained maximum frame code stream length included in each layer as the space size occupied by the logic unit in the corresponding storage space; the space size occupied by the determined logic unit in each storage space, each storage space The starting position of the space and the starting time of the code stream are recorded in the index list;
检索回放单元,用于当接收到检索指令时,根据所述索引列表中记录的每个存储空间的起始位置和逻辑单元在每个存储空间中占用的空间大小、所述检索指令携带的检索录像的起止时间、逻辑单元对应的时间单元获得检索录像在每个存储空间中的起止位置;根据获得的每个存储空间中的起止位置并行读取各存储空间中的视频帧;将读取的视频帧按照帧序号写入解码缓存列表,并将所述解码缓存列表发送至解码器,以使所述解码器进行解码并回放。The retrieval playback unit is configured to, when a retrieval instruction is received, according to the starting position of each storage space recorded in the index list and the size of the space occupied by the logical unit in each storage space, the retrieval information carried by the retrieval instruction The start and end time of video recording, the time unit corresponding to the logical unit obtain the start and end position of retrieval video recording in each storage space; read the video frames in each storage space in parallel according to the obtained start and end position in each storage space; read the The video frame is written into the decoding buffer list according to the frame number, and the decoding buffer list is sent to the decoder, so that the decoder performs decoding and playback.
在一可选的实现方式中,在每个存储空间中的各块空间头部均设置有一个预设大小的单元,所述装置还包括(图5中未示出):In an optional implementation manner, each block space header in each storage space is provided with a unit of a preset size, and the device further includes (not shown in FIG. 5 ):
第二存储单元,用于在将各逻辑单元包括的视频帧按照其所属层存储到相应存储空间的对应块空间中的同时,将其实际帧码流长度存储到该块空间头部的预设大小的单元中;The second storage unit is used to store the video frames included in each logical unit in the corresponding block space of the corresponding storage space according to the layer to which they belong, and at the same time store the actual frame code stream length in the preset of the head of the block space in units of size;
所述检索回放单元,具体用于在针对每个存储空间,读取该存储空间的起止位置段中的视频帧过程中,针对每个存储空间,根据该存储空间的起止位置段中的各块空间头部存储的实际帧码流长度读取各块空间中的视频帧。The retrieval and playback unit is specifically configured to, for each storage space, read the video frames in the start and end position segments of the storage space, for each storage space, according to each block in the start and end position segments of the storage space The actual frame code stream length stored in the head of the space reads the video frames in each space.
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and effects of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method for details, and will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this application. It can be understood and implemented by those skilled in the art without creative effort.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above is only a preferred embodiment of the application, and is not intended to limit the application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the application should be included in the application. within the scope of protection.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710243144.3A CN107124571B (en) | 2017-04-14 | 2017-04-14 | Video storage method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710243144.3A CN107124571B (en) | 2017-04-14 | 2017-04-14 | Video storage method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107124571A true CN107124571A (en) | 2017-09-01 |
CN107124571B CN107124571B (en) | 2020-01-14 |
Family
ID=59725540
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710243144.3A Active CN107124571B (en) | 2017-04-14 | 2017-04-14 | Video storage method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107124571B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109413374A (en) * | 2018-02-07 | 2019-03-01 | 中科太网科技(北京)有限公司 | Monitor video processing method, device, video processing equipment and processing system for video |
CN109996022A (en) * | 2017-12-29 | 2019-07-09 | 浙江宇视科技有限公司 | Monitoring storage expansion method and video monitoring system |
CN112219404A (en) * | 2018-05-25 | 2021-01-12 | 连普乐士株式会社 | Method and system for transmitting and playing dynamic bit rate video using multiple channels |
CN112732177A (en) * | 2020-12-28 | 2021-04-30 | 深圳市华宝电子科技有限公司 | Video storage method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040218827A1 (en) * | 2003-05-02 | 2004-11-04 | Michael Cohen | System and method for low bandwidth video streaming for face-to-face teleconferencing |
CN1784003A (en) * | 2004-11-29 | 2006-06-07 | 索尼株式会社 | Content transfer system, communication device, communication method and programme |
CN102595085A (en) * | 2011-12-31 | 2012-07-18 | 杭州华三通信技术有限公司 | Data storage management method and equipment thereof |
CN105706451A (en) * | 2013-10-11 | 2016-06-22 | Vid拓展公司 | High level syntax for HEVC extensions |
-
2017
- 2017-04-14 CN CN201710243144.3A patent/CN107124571B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040218827A1 (en) * | 2003-05-02 | 2004-11-04 | Michael Cohen | System and method for low bandwidth video streaming for face-to-face teleconferencing |
CN1784003A (en) * | 2004-11-29 | 2006-06-07 | 索尼株式会社 | Content transfer system, communication device, communication method and programme |
CN102595085A (en) * | 2011-12-31 | 2012-07-18 | 杭州华三通信技术有限公司 | Data storage management method and equipment thereof |
CN105706451A (en) * | 2013-10-11 | 2016-06-22 | Vid拓展公司 | High level syntax for HEVC extensions |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109996022A (en) * | 2017-12-29 | 2019-07-09 | 浙江宇视科技有限公司 | Monitoring storage expansion method and video monitoring system |
CN109996022B (en) * | 2017-12-29 | 2021-08-31 | 浙江宇视科技有限公司 | Surveillance storage expansion method and video surveillance system |
CN109413374A (en) * | 2018-02-07 | 2019-03-01 | 中科太网科技(北京)有限公司 | Monitor video processing method, device, video processing equipment and processing system for video |
CN109413374B (en) * | 2018-02-07 | 2021-06-08 | 中科太网科技(北京)有限公司 | Monitoring video processing method and device, video processing equipment and video processing system |
CN112219404A (en) * | 2018-05-25 | 2021-01-12 | 连普乐士株式会社 | Method and system for transmitting and playing dynamic bit rate video using multiple channels |
CN112732177A (en) * | 2020-12-28 | 2021-04-30 | 深圳市华宝电子科技有限公司 | Video storage method, device, equipment and storage medium |
CN112732177B (en) * | 2020-12-28 | 2024-03-26 | 深圳市华宝电子科技有限公司 | Video storage method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107124571B (en) | 2020-01-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5303023B2 (en) | Data processing device | |
JP3356991B2 (en) | Optical disc, recording method, recording device, reproducing method, and reproducing device | |
US8300702B2 (en) | Data processing apparatus, data processing method, data processing program, data structure, recording medium, reproducing apparatus, reproducing method, and reproducing program | |
CN107124571B (en) | Video storage method and device | |
CN101843099B (en) | Apparatus and method of storing video data | |
JP4481889B2 (en) | Data recording apparatus and method, program, and recording medium | |
EP1486979A1 (en) | Data recording method, data recording device, data recording medium, data reproduction method, and data reproduction device | |
US7603520B2 (en) | Record apparatus, record method, and program for writing data to optical disc in a second unit larger than a first unit | |
CN1491387B (en) | Device and method for managing access to storage medium | |
US8655139B2 (en) | Video recording and reproducing system and reading method of video data | |
CN100424778C (en) | Method and device for recording multimedia digital data | |
JP2005020378A (en) | Disk device, control method for disk device, and control program for disk device | |
CN115328391A (en) | A storage method, device and management method for local recording of video capture equipment | |
US20090016703A1 (en) | Information processing device, information processing method, and computer program | |
JP2012080361A (en) | Recording device, imaging recording device, recording method, and program | |
US8515250B2 (en) | Video recording device, video reproduction device, and method thereof | |
JP2002373480A (en) | Data-recording method, data recorder and recording medium | |
JP2003022621A (en) | Method for recording data, method for modifying data and apparatus therefor | |
JP2000165794A (en) | Recording / reproducing device and video data management system | |
JP4449812B2 (en) | Recording apparatus, recording method, and recording program | |
CN119893224A (en) | MP4 video reverse playing device and method | |
US7715402B2 (en) | Method and device for processing digital data | |
JP2000278645A (en) | Device and method for recording data and device and method for reproducing data | |
JP2009026368A (en) | Method and device for recording/reproducing | |
JP2008199203A (en) | Video recording/reproducing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |