Video code stream storage method and device, computer equipment and storage medium
By prioritizing video channels and adopting different decoding strategies and encoding parameters, the problem of large video stream storage space is solved, and storage space is optimized and user experience is improved.
Patent Information
- Application Number
- CN202511142574.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-10-10
AI Technical Summary
The existing technology has a problem that video code stream storage occupies a large storage space and there is no effective solution.
By dividing video channels into different priorities, different decoding strategies and encoding parameters are used to decode, splice and store video frames, including high priority, low priority and medium priority processing methods, and resources are reasonably allocated to reduce storage space.
While reducing storage space, it ensures user experience and achieves reasonable resource allocation and storage efficiency improvement of video channels.
Smart Images

Figure CN120769006A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a video code stream storage method, apparatus, computer equipment, and storage medium. Background Art
[0002] NVR (Network Video Recorder) and XVR (Extended Video Recorder) are network storage devices whose main function is to receive digital video streams transmitted by front-end IPC (IP Camera) devices over the network and provide functions such as storage, management, playback and preview of multiple streams.
[0003] Currently, the back-end XVR / NVR stores recorded videos by directly storing the encoded bit stream sent by each front-end channel directly on the hard disk. However, as customer needs continue to increase, the required resolution is getting higher and higher, and the encoding bit rate is getting higher and higher. As a result, the amount of data stored on the hard disk for each video channel is also increasing, which will take up a large amount of storage space.
[0004] With regard to the problem in related technologies that storage of video code streams occupies a large storage space, no effective solution has been proposed so far. Summary of the Invention
[0005] Based on this, it is necessary to provide a video stream storage method, device, computer equipment and storage medium that can reduce the video stream storage space in order to address the above technical problems.
[0006] In a first aspect, a video stream storage method is provided in this embodiment, including:
[0007] Get the code stream of each front-end video channel;
[0008] Dividing the video channels into at least two priorities, with the number of video channels of each priority increasing from high to low;
[0009] When it is determined that the device resources meet the decoding conditions, the code streams of the corresponding video channels are decoded using the decoding strategies preset by the priorities to obtain original video frames; after the original video frames are spliced according to the priorities, the spliced original video frames are encoded and stored using the encoding parameters corresponding to the priorities.
[0010] In some embodiments, dividing the video channels into at least two priorities includes:
[0011] The video channels are divided into low priority, medium priority and high priority according to the picture content and preset quantity requirements of the video channels.
[0012] In some embodiments, decoding the bitstreams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; splicing the original video frames according to the priorities, and encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities include:
[0013] When the priority is high, decoding the code stream of the video channel at full frame rate to obtain the original video frame;
[0014] The spliced original video frames are encoded and stored at the original resolution and full frame rate.
[0015] In some embodiments, decoding the bitstreams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; splicing the original video frames according to the priorities, and encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities include:
[0016] When the priority is medium priority and target motion is recognized in the picture content of the video channel, decoding the code stream of the video channel to obtain the original video frame;
[0017] The spliced original video frames are encoded and stored at the original resolution and medium frame rate.
[0018] In some embodiments, decoding the bitstreams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; splicing the original video frames according to the priorities, and encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities include:
[0019] When the priority is low and target motion is recognized in the picture content of the video channel, I-frame decoding is performed on the code stream of the video channel to obtain the original video frame;
[0020] Allocating original video frames of each video channel to at least one virtual channel;
[0021] After the original video frames of the virtual channels are spliced together, the spliced original video frames are encoded and stored at a low resolution and a low frame rate.
[0022] In some embodiments, the method further comprises:
[0023] When it is determined that the device resources do not meet the decoding condition, the number of preview channels of the device is reduced, and / or the preview resolution of the device is lowered.
[0024] In some embodiments, the method further comprises:
[0025] Store the code stream of each video channel obtained from the front end;
[0026] When it is determined that the storage limit of the device hard disk has been reached, the code stream is read, the code stream is re-stored according to the priority, and the read code stream is deleted.
[0027] In a second aspect, a video stream storage device is provided in this embodiment, including:
[0028] The code stream acquisition module is used to obtain the code stream of each video channel of the front end;
[0029] A priority division module, configured to divide the video channels into at least two priorities, with the number of video channels of each priority increasing from high to low;
[0030] The storage module is used to decode the code stream of the corresponding video channel using the decoding strategy preset by the priority to obtain the original video frame when it is determined that the device resources meet the decoding conditions; after splicing the original video frames according to the priority, encode and store the spliced original video frames using the encoding parameters corresponding to the priority.
[0031] In a third aspect, a computer device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the video stream storage method described in the first aspect is implemented.
[0032] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored. When the program is executed by a processor, the video stream storage method described in the first aspect is implemented.
[0033] Compared with related technologies, the video stream storage method, device, computer equipment and storage medium provided in this embodiment obtain the stream of each video channel at the front end; divide the video channels into at least two priorities, with the number of video channels at each priority increasing from high to low; when it is determined that the device resources meet the decoding conditions, the stream of the corresponding video channel is decoded using the decoding strategy preset by the priority to obtain the original video frame; after splicing the original video frames according to the priority, the spliced original video frames are encoded and stored using the encoding parameters corresponding to the priority. Through this embodiment, the video channels at the front end can be prioritized, and the video channels can be decoded, spliced and encoded according to the priority and then stored, so that the stream of each video channel can be stored in a smaller storage space, solving the problem of the storage of video streams occupying a large storage space.
[0034] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0036] Figure 1 is a hardware structure block diagram of a terminal of a video code stream storage method in an embodiment;
[0037] Figure 2 is a flowchart of a method for storing a video stream in one embodiment;
[0038] Figure 3 is a schematic diagram of storing high-priority and medium-priority code streams in an embodiment;
[0039] Figure 4 is a schematic diagram of low-priority code stream storage in an embodiment;
[0040] Figure 5 is a schematic diagram of a video stream storage method in an embodiment;
[0041] Figure 6 The diagram is a structural block diagram of a video code stream storage device in an embodiment.
[0042] In the figure: 102, processor; 104, memory; 106, transmission device; 108, input and output device; 10, code stream acquisition module; 20, priority division module; 30, storage module. DETAILED DESCRIPTION
[0043] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0044] Unless otherwise defined, technical terms or scientific terms used in the present application shall have the same meaning as those commonly understood by a person of ordinary skill in the art to which the present application belongs. The terms "one", "a", "an", "the", "these", and similar terms in the present application do not mean "only one" or "exactly one", but can mean "one or more". The terms "include", "contain", "have", and any variant thereof in the present application are intended to cover the non-exclusive inclusion; for example, a process, method, system, product or device containing a series of steps or modules (units) is not limited to the listed steps or modules (units), but can include steps or modules (units) not listed, or can include other steps or modules (units) inherent to the process, method, product or device. The terms "connect", "connect", "couple" and the like in the present application are not limited to physical or mechanical connection, but can include electrical connection, whether direct or indirect. The term "multiple" in the present application means two or more. The term "and / or" describes the association between the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that A exists alone, A and B exist together, and B exists alone. Generally, the character " / " represents an "or" relationship between the associated objects. The terms "first", "second", "third" and the like in the present application are only used to distinguish similar objects, and do not represent a specific order of the objects.
[0045] The method embodiments provided in the present embodiment can be executed in a terminal, a computer or a similar computing device. For example, the method embodiments are executed on a terminal, Figure 1 is a hardware structure block diagram of the terminal of the video stream storage method of the present embodiment. As shown in Figure 1 , the terminal can include one or more (only one is shown in Figure 1 ) processor 102 and memory 104 for storing data, wherein the processor 102 can include but not limited to processing device such as microprocessor MCU or programmable logic device FPGA. The above terminal can also include transmission device 106 for communication function and input / output device 108. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above terminal. For example, the terminal can include more or less components than those shown in Figure 1 , or have a different configuration from that shown in Figure 1 .
[0046] Memory 104 can be used to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the video stream storage method in this embodiment. Processor 102 executes the computer program stored in memory 104 to execute various functional applications and data processing, thereby implementing the above-mentioned method. Memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory remotely located relative to processor 102, and such remote memory may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0047] Transmission device 106 is used to receive or transmit data via a network. This network may include a wireless network provided by the terminal's communications provider. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0048] In this embodiment, a video code stream storage method is provided. Figure 2 FIG. 1 is a flow chart of the video code stream storage method in this embodiment. Figure 2 As shown, the method includes the following steps:
[0049] Step S201: Obtain the code stream of each front-end video channel.
[0050] Specifically, for devices such as XVR / NVR, they are connected to the front-end IPC to obtain real-time video streams from multiple front-end cameras. Each video channel corresponds to an independent stream.
[0051] Step S202: Divide the video channels into at least two priorities, with the number of video channels of each priority increasing from high to low.
[0052] Specifically, the video channels are prioritized according to their importance, with the number of channels increasing from high to low priority. For example, the number of low-priority video channels is greater than that of high-priority video channels. This is because for video channels with low importance, splicing more video channels during storage can save resources.
[0053] Priority levels can be configured by the user or automatically assigned based on the identified scene (image content) into at least two priority levels, such as high priority and low priority, or high priority, medium priority, and low priority. For example, for scenes like warehouse interiors and entrances and exits, the corresponding video channel can be assigned high priority, while for scenes like corridors and hallways, the corresponding video channel can be assigned low priority. Furthermore, after the priority level is assigned, it can be dynamically adjusted based on user configuration or the identified scene, such as adjusting the corresponding video channel's priority to high priority in the event of an emergency such as an intrusion.
[0054] In step S203, when it is determined that the device resources meet the decoding conditions, the code streams of the corresponding video channels are decoded using the decoding strategies preset by the priorities to obtain the original video frames; after the original video frames are spliced according to the priorities, the spliced original video frames are encoded and stored using the encoding parameters corresponding to the priorities.
[0055] Specifically, since devices such as XVR / NVR also support the preview function, some device resources will be occupied for decoding and other operations during preview. Therefore, the current device resources are queried through commands to determine whether the device resources meet the decoding conditions. The decoding condition is that the device has at least sufficient resources to complete the decoding of the high-priority video channel stream. Device resources include but are not limited to the remaining CPU (Central Processing Unit), DDR (Double Data Rate Synchronous Dynamic Random-Access Memory) bandwidth, etc. The decoding conditions can further set specific threshold parameters for the remaining CPU, DDR bandwidth, etc., such as the remaining CPU is greater than 80%, the DDR bandwidth is greater than 10GB / s, etc.
[0056] When it is determined that the device resources meet the decoding conditions, the decoding of high-priority streams is prioritized. If the device resources are sufficient, the decoding of other priority streams is further performed. The corresponding decoding strategy and encoding parameters are set in advance for each priority. For the stream of each priority video channel, it is decoded with the preset decoding strategy to obtain the original video frame. The original video frames decoded from all video channels in each priority are then YUV spliced. Finally, the spliced original video frames are encoded and stored with the corresponding encoding parameters. The encoding parameters include but are not limited to resolution and encoding frame rate. Among them, different decoding strategies and encoding parameters for different priorities can achieve precise adaptation to the scene and reasonable allocation of resources. For example, a full-frame rate decoding strategy and higher encoding parameters can be adopted for a high-priority video channel stream, while an event-triggered decoding strategy and lower encoding parameters can be adopted for other priority video channel streams.
[0057] The original video frames of multiple video channels in each priority level are spliced and merged into a single picture. This reduces the bitstream storage space while ensuring the user experience. The high-priority bitstream with higher importance has higher resolution and better video playback effect. Other priorities with lower importance can splice more video channel bitstreams and use lower resolution to save storage space.
[0058] Through the above steps, the video channels are prioritized according to their importance, and the divided video channels are decoded, spliced, encoded and stored respectively using the decoding strategies and encoding parameters corresponding to the priorities. Different decoding strategies and encoding parameters are used for different priorities to achieve precise adaptation to the scene and reasonable allocation of resources. The code streams of each video channel are stored in a smaller storage space, which not only reduces the code stream storage space but also ensures user experience and solves the problem of video code stream storage occupying a large storage space.
[0059] In some embodiments, the method further comprises the following steps:
[0060] Stores the code streams of each video channel obtained from the front end; when it is determined that the device hard disk has reached the storage limit, reads the code streams, re-stores the code streams according to priority, and deletes the read code streams.
[0061] Specifically, because the current back-end XVR / NVR storage method for recordings directly stores each encoded stream sent by the front-end directly on the hard disk, the amount of data stored on the hard disk for each video channel is increasing. As a result, the number of days that can be stored in the limited hard disk space is reduced. When the hard disk is full, the newly stored recordings will overwrite the earliest recorded recordings, causing the earliest recordings to be lost. Therefore, when directly storing the streams of each video channel obtained from the front-end, the above-mentioned video stream storage method can also be applied when the hard disk is almost full. When it is determined that the device hard disk has reached the storage limit, the stream is read. The stream read can be the recording that is about to be overwritten on the hard disk. Specifically, the recording time can be prioritized to read the recording with the longest storage time. After reading the stream, the video channels are divided into at least two priority levels. The streams are decoded, spliced, and encoded according to the priority level and then re-stored. The read streams are deleted, and the freed storage space is used to store the new video channel streams.
[0062] In this embodiment, when it is determined that the device hard disk has reached its storage limit, a small amount of memory can be used to store the video channel stream that is about to be overwritten, saving a large amount of memory space, increasing the number of days of video storage, allowing users to play back videos, and improving user experience.
[0063] In some embodiments, dividing the video channels into at least two priorities in step S202 includes the following steps:
[0064] Based on the picture content and preset quantity requirements of the video channels, the video channels are divided into low priority, medium priority and high priority.
[0065] Specifically, the priority division can be configured by the user or divided into high priority, medium priority, and low priority based on the recognized scene (image content) and preset quantity requirements. The preset quantity requirement is at least the number of video channels of each priority level increasing from high to low. The division ratio of each priority level can also be set. For example, the ratio is approximately 1:2:3 based on the total number of channels. The ratio can be adjusted according to the total number of channels. For example, 28 video channels can be divided into 4 high priority channels, 8 medium priority channels, and 16 low priority channels.
[0066] It should be noted that after the priorities are divided, the priorities may be configured by the user or dynamically adjusted according to the identified scenarios.
[0067] By prioritizing the video channels according to their importance in this embodiment, the corresponding video channel streams can be decoded, spliced, and encoded at different priorities in the subsequent steps, thereby achieving reasonable resource allocation while reducing storage space.
[0068] In some embodiments, step S203 decodes the bitstreams of the corresponding video channels using a decoding strategy preset by priority to obtain original video frames; splices the original video frames according to the priority, and then encodes and stores the spliced original video frames using encoding parameters corresponding to the priority, including the following steps:
[0069] When the priority is high, the code stream of the video channel is decoded at full frame rate to obtain the original video frame; the spliced original video frame is encoded and stored at the original resolution and full frame rate.
[0070] High-priority video channel streams are particularly important, requiring permanent storage of all recorded video at full frame rate and high resolution. The video channel streams are decoded at full frame rate to obtain the original video frames (YUV data). The decoded YUV data from all video channels is then concatenated and fed into the encoder, where it is encoded and stored at the original resolution (i.e., the resolution at the time of decoding) at full frame rate. For example, if an NVR is connected to 32 channels of 1080p@25fps encoded streams, the high-priority video channels have an original resolution of 1080p and a full frame rate of 25fps / 30fps.
[0071] When the priority is medium and target motion is recognized in the picture content of the video channel, the code stream of the video channel is decoded to obtain the original video frame; the spliced original video frame is encoded and stored at the original resolution and medium frame rate.
[0072] For medium-priority video channel streams, recording is relatively important, but storing all recorded frames is not necessary. Therefore, decoding is performed when motion is detected in the image content to obtain the original video frame. The decoded YUV data of all video channels is then spliced and fed into the encoder for encoding and storage at the original resolution and medium frame rate. Compared to the high-priority full frame rate, the medium frame rate can be determined by halving the frame rate, i.e., 12fps / 15fps.
[0073] Figure 3 This is a schematic diagram of the code stream storage of high priority and medium priority in this embodiment, as shown in FIG. Figure 3 As shown in the figure, after the decoder decodes the code stream of each video channel using a preset priority decoding strategy, the scaling module unifies the resolution of each video channel to facilitate subsequent splicing. The YUV data of the decoded video channel code stream is spliced and sent to the encoder for encoding before being saved.
[0074] In some embodiments, step S203 decodes the bitstreams of the corresponding video channels using a decoding strategy preset by priority to obtain original video frames; splices the original video frames according to the priority, and then encodes and stores the spliced original video frames using encoding parameters corresponding to the priority, including the following steps:
[0075] When the priority is low and target motion is recognized in the picture content of the video channel, the I-frame decoding of the video channel's code stream is performed to obtain the original video frame; the original video frames of each video channel are allocated to at least one virtual channel; after the original video frames of each virtual channel are spliced, the spliced original video frames are encoded and stored at a low resolution and low frame rate.
[0076] Low-priority video channel streams are relatively unimportant, so there's no need to store all recorded video. Instead, only the I-frames (key frames) where motion occurs can be restored. Specifically, when motion is detected, the I-frames are decoded to retrieve the original video frames.
[0077] In addition, considering the large number of low-priority video channels and the low probability of simultaneous target motion in each video channel, directly stitching the high- and medium-priority channels together may result in poor stitching results. Therefore, at least one virtual channel can be set up. The original video frames (resolution D1) after I-frame decoding are allocated to the virtual channel through a dynamic routing mechanism. The virtual channel contains recordings of target motion in multiple video channels. The stitched original video frames are encoded and stored as I-frames at low resolution (D1) and low frame rate (1fps).
[0078] Taking 16 low-priority video channels and 8 virtual channels as an example, if target motion that does not occur at the same time is detected in the image content of two video channels, the original video frames after decoding the I frames of the two video channels can be assigned to the same virtual channel. In this way, the 16-channel video channel stream can be saved by splicing and encoding the 8 virtual channels, improving the video playback effect while saving resources.
[0079] Figure 4 This is a schematic diagram of low-priority code stream storage in this embodiment, such as Figure 4 As shown in the figure, after the decoder decodes the bitstream of each video channel using a preset priority decoding strategy, the scaling module unifies the resolution of each video channel to facilitate subsequent splicing. The YUV data of the decoded video channel bitstream is allocated to virtual channel 1 and virtual channel 2 respectively. Here, the YUV data of video channels with similar picture content are preferentially merged into the same virtual channel. Finally, the original video frames of virtual channel 1 and virtual channel 2 are YUV spliced together and sent to the encoder for encoding before being saved.
[0080] In this embodiment, different decoding strategies, splicing methods and encoding parameters are used at different priorities to store the code stream of the video channel. In the decoding link, high-priority full-frame rate decoding ensures the integrity of details, medium-priority decoding during target motion and low-priority key frame decoding save resources, high-priority low-density splicing ensures picture clarity in the splicing link, low-priority high-density splicing sacrifices details for capacity, and in the encoding link, the adjustment of encoding parameters directly affects the storage volume and image quality, which can optimize resource allocation and reduce the storage resources of the video channel code stream.
[0081] In some embodiments, the method further comprises:
[0082] When it is determined that the device resources do not meet the decoding conditions, the number of preview channels of the device is reduced and / or the preview resolution of the device is lowered.
[0083] Specifically, when it is determined that the device resources do not meet the decoding conditions, it is determined whether the number of preview channels can be reduced or the preview resolution can be lowered. Specifically, the customer can be notified, and the number of preview channels and / or the resolution of the preview channels can be automatically reduced after the user agrees. The number of relevant channels and / or the channel resolution can also be reduced when the user's usage frequency decreases (a fixed time period with reduced usage frequency is determined after long-term analysis, such as at night) to release decoding capabilities and related performance.
[0084] After reducing the number of preview channels of the device and / or lowering the preview resolution of the device, it is determined whether the device resources after the resources are released meet the decoding conditions. If so, the video channel code stream is decoded with priority.
[0085] The present embodiment is described and illustrated below through preferred embodiments.
[0086] This embodiment provides a method for storing a video stream, which includes the following steps:
[0087] Step S501: Store the code streams of each video channel obtained from the front end; when the device hard disk reaches the storage limit, determine whether the device resources meet the decoding conditions.
[0088] Step S502: When the device resources do not meet the decoding conditions, the number of preview channels of the device is reduced and / or the preview resolution of the device is lowered.
[0089] Step S503: When the device resources meet the decoding conditions, the video channels are divided into high priority, medium priority and low priority according to their priorities.
[0090] Step S504 , when the priority is high, decoding the code stream of the video channel at full frame rate to obtain original video frames; encoding and storing the spliced original video frames at original resolution and full frame rate.
[0091] Step S505 , when the priority is medium priority and target motion is recognized in the picture content of the video channel, the code stream of the video channel is decoded to obtain the original video frame; the spliced original video frame is encoded and stored at the original resolution and medium frame rate.
[0092] Step S506: When the priority is low and target motion is recognized in the picture content of the video channel, the bit stream of the video channel is decoded into I frames to obtain original video frames; the original video frames of each video channel are allocated to at least one virtual channel; the original video frames of each virtual channel are spliced together, and the spliced original video frames are encoded and stored at a low resolution and low frame rate.
[0093] Figure 5FIG. 1 is a schematic diagram of a video code stream storage method in this embodiment. Figure 5 As shown, when the device hard disk reaches the storage limit, it is determined whether the device resources meet the decoding conditions.
[0094] When the device resources do not meet the decoding conditions, determine whether the number of preview channels of the device can be reduced and the preview resolution of the device can be lowered. If not, wait and then determine whether the device resources meet the decoding conditions. If so, after reducing the number of preview channels of the device and lowering the preview resolution of the device, determine whether the device resources meet the decoding conditions.
[0095] When the device resources meet the decoding conditions, the video channels are prioritized into high priority, medium priority, and low priority. When the priority is high priority, the video channel's bitstream is decoded at full frame rate to obtain the original video frames, the original video frames are spliced together to create a data stream, and the data stream is encoded at full frame rate at the original resolution and full frame rate. When the priority is medium priority, when target motion is detected in the video channel's image content, the video channel's bitstream is decoded at full frame rate to obtain the original video frames, the original video frames are spliced together to create a data stream, and the data stream is encoded at half the full frame rate. When the priority is low priority, when target motion is detected in the video channel's image content, the video channel's bitstream I frame is decoded to obtain the original video frames, the original video frames are spliced together to create a data stream, and the data stream is encoded at I frame. Finally, the encoded bitstream is saved to disk, and the bitstream that has been read from the hard disk is deleted.
[0096] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0097] This embodiment also provides a video code stream storage device for implementing the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. The terms "module," "unit," "subunit," etc. used below may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0098] Figure 6 This is a structural block diagram of the video code stream storage device in this embodiment. Figure 6 As shown, the device includes:
[0099] The code stream acquisition module 10 is used to obtain the code stream of each video channel of the front end;
[0100] A priority division module 20 is configured to divide video channels into at least two priority levels, with the number of video channels of each priority level increasing from high to low;
[0101] The storage module 30 is used to decode the code stream of the corresponding video channel using the decoding strategy preset by the priority to obtain the original video frame when it is determined that the device resources meet the decoding conditions; after splicing the original video frames according to the priority, encode and store the spliced original video frames using the encoding parameters corresponding to the priority.
[0102] Through the device provided in this embodiment, priority is divided according to the importance of the video channels, and the divided video channels are decoded, spliced and encoded respectively according to the decoding strategies and encoding parameters corresponding to the priorities and then stored. Different decoding strategies and encoding parameters are used for different priorities to achieve precise adaptation to the scene and reasonable allocation of resources. The code stream of each video channel is stored in a smaller storage space, which not only reduces the code stream storage space but also ensures user experience and solves the problem of video code stream storage occupying a large storage space.
[0103] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0104] This embodiment further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0105] Optionally, the computer device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0106] It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.
[0107] In addition, in conjunction with the video stream storage method provided in the above embodiments, a storage medium may be provided in this embodiment to implement the method. The storage medium stores a computer program that, when executed by a processor, implements any of the video stream storage methods in the above embodiments.
[0108] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0109] It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0110] Obviously, the accompanying drawings are merely examples or embodiments of the present application. A person skilled in the art can also apply the present application to other similar situations based on these drawings without inventive effort. Furthermore, it is understandable that, although the work involved in this development process may be complex and lengthy, certain design, manufacturing, or production changes based on the technical content disclosed in this application are merely routine technical means for a person skilled in the art and should not be considered to constitute a deficiency in the disclosure of the present application.
[0111] The term "embodiment" as used in this application refers to specific features, structures, or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is understood, either explicitly or implicitly, by those skilled in the art that the embodiments described in this application can be combined with other embodiments when there is no conflict.
[0112] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A video code stream storage method, characterized in that: include: Get the code stream of each video channel on the front end; Dividing the video channels into at least two priorities, with the number of video channels of each priority increasing from high to low; When it is determined that the device resources meet the decoding conditions, the code streams of the corresponding video channels are decoded using the decoding strategies preset by the priorities to obtain original video frames; after the original video frames are spliced according to the priorities, the spliced original video frames are encoded and stored using the encoding parameters corresponding to the priorities.
2. The video code stream storage method according to claim 1, wherein: The dividing the video channels into at least two priorities includes: The video channels are divided into low priority, medium priority and high priority according to the picture content and preset quantity requirements of the video channels.
3. The video code stream storage method according to claim 1, wherein: Decoding the bit streams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; After splicing the original video frames according to the priorities, encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities, including: When the priority is high, decoding the code stream of the video channel at full frame rate to obtain the original video frame; The spliced original video frames are encoded and stored at the original resolution and full frame rate.
4. The video code stream storage method according to claim 1, wherein: Decoding the bit streams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; After splicing the original video frames according to the priorities, encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities, including: When the priority is medium priority and target motion is recognized in the picture content of the video channel, decoding the code stream of the video channel to obtain the original video frame; The spliced original video frames are encoded and stored at the original resolution and medium frame rate.
5. The video code stream storage method according to claim 1, wherein: Decoding the bit streams of the corresponding video channels using the decoding strategies preset according to the priorities to obtain original video frames; After splicing the original video frames according to the priorities, encoding and storing the spliced original video frames using encoding parameters corresponding to the priorities, including: When the priority is low and target motion is recognized in the picture content of the video channel, I-frame decoding is performed on the code stream of the video channel to obtain the original video frame; Allocating original video frames of each video channel to at least one virtual channel; After the original video frames of the virtual channels are spliced together, the spliced original video frames are encoded and stored at a low resolution and a low frame rate.
6. The video code stream storage method according to claim 1, wherein: The method further comprises: When it is determined that the device resources do not meet the decoding condition, the number of preview channels of the device is reduced, and / or the preview resolution of the device is lowered.
7. The video code stream storage method according to claim 1, wherein: The method further comprises: Store the code stream of each video channel obtained from the front end; When it is determined that the storage limit of the device hard disk has been reached, the code stream is read, the code stream is re-stored according to the priority, and the read code stream is deleted.
8. A video code stream storage device, characterized in that: include: The code stream acquisition module is used to obtain the code stream of each video channel of the front end; A priority division module, configured to divide the video channels into at least two priorities, with the number of video channels of each priority increasing from high to low; The storage module is used to decode the code stream of the corresponding video channel using the decoding strategy preset by the priority to obtain the original video frame when it is determined that the device resources meet the decoding conditions; after splicing the original video frames according to the priority, encode and store the spliced original video frames using the encoding parameters corresponding to the priority.
9. A computer device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the video stream storage method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the video stream storage method according to any one of claims 1 to 7 are implemented.