Video frame packaging method, electronic equipment and computer readable storage medium

By real-time correction of the maximum packaged memory of the frame unit and the maximum packaged memory of the picture group, the problem that the network video recorder cannot decode video frames when receiving high-resolution video packets is solved, and the resource utilization and user experience are improved.

CN119767070AActive Publication Date: 2025-04-04TP-LINK
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411861374.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-04
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

When a network video recorder receives a high-resolution video packet, the size of the video frame may exceed the upper limit of the decoding memory of the NVR, resulting in the inability to play the video frame normally.

Method used

By real-time correction of the maximum encapsulated memory of the frame unit and the maximum encapsulated memory of the picture group, the appropriate memory size is determined based on resource utilization, ensuring that the video frame can be successfully encapsulated and decoded.

Benefits of technology

It improves the resource utilization rate of online video recorders, avoids the inability to decode video frames, and ensures the stability and user experience of video playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119767070A_ABST
    Figure CN119767070A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a video frame packaging method, electronic equipment and a computer readable storage medium, and the method comprises the steps: obtaining the maximum packaging memory of a frame unit and the maximum packaging memory of a picture group, and the maximum packaging memory of the frame unit and the maximum packaging memory of the picture group are both in negative correlation with a resource utilization rate. And in response to the received first data packet, determining a first memory required for storing the first data packet. And if the first memory is smaller than or equal to the maximum packaging memory of the frame unit, packaging the first data packet to obtain a first frame unit. And if the first frame unit meets the independent packaging condition, packaging the first frame unit to obtain a first picture group. And determining a decoding memory according to the maximum packaging memory of the frame unit. And decoding the first picture group based on the decoding memory to obtain a first video. The resource utilization rate of the network video recorder can be improved, and the situation that video frames cannot be decoded is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a video frame encapsulation method, an electronic device, and a computer-readable storage medium. Background Art

[0002] IPC (Internet Protocol Camera) and NVR (Network Video Recorder) are important components of the network video surveillance system. IPC can convert the captured video signal into a digital signal and transmit the digital signal to the NVR in the form of a data packet through the network. The NVR encapsulates the received data packets into video frames, and then encapsulates the video frames into GOP (Group of Pictures) for storage. Users can view the video (one or more decoded groups of pictures) remotely or locally through the NVR.

[0003] In traditional technical solutions, the memory used by the NVR to encapsulate the group of pictures and the memory used to decode the group of pictures are usually pre-set fixed values. However, when the resolution of the data packet received by the NVR is higher, such as when the NVR is connected to a high-resolution IPC, the video frame in the group of pictures will become larger. If the size of the video frame exceeds the upper limit of the memory used by the NVR to decode the group of pictures, the NVR will not be able to decode the group of pictures, resulting in the video frame not being able to play normally. Summary of the invention

[0004] The embodiments of the present application provide a video frame encapsulation method, device, chip, electronic device and computer-readable storage medium, which can improve the resource utilization of a network video recorder and avoid the situation where the video frame cannot be decoded.

[0005] In a first aspect, the present application provides a video frame encapsulation method, comprising: obtaining a maximum encapsulation memory of a frame unit and a maximum encapsulation memory of a picture group, wherein the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group are both negatively correlated with resource utilization. In response to receiving a first data packet, a first memory required to store the first data packet is determined. If the first memory is less than or equal to the maximum encapsulation memory of the frame unit, the first data packet is encapsulated to obtain a first frame unit. If the first frame unit meets the independent encapsulation condition, the first frame unit is encapsulated to obtain a first picture group, and the second memory required for the first picture group is less than the maximum encapsulation memory of the picture group.

[0006] In some embodiments, obtaining the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group includes: obtaining the maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group. Determine the resource utilization rate according to the bandwidth occupancy rate, the preset bandwidth weight, the memory utilization rate and the preset memory weight, and the bandwidth occupancy rate and the memory utilization rate are both positively correlated with the resource utilization rate. According to the resource utilization rate, the initial frame unit maximum encapsulation memory is corrected to obtain the frame unit maximum encapsulation memory, and the frame unit maximum encapsulation memory is negatively correlated with the resource utilization rate. According to the resource utilization rate, the initial picture group maximum encapsulation memory is corrected to obtain the picture group maximum encapsulation memory, and the picture group maximum encapsulation memory is negatively correlated with the resource utilization rate.

[0007] In some implementations, the resource usage rate is the sum of the product of the bandwidth occupancy rate and the bandwidth weight, and the product of the memory usage rate and the memory weight.

[0008] In some embodiments, the maximum encapsulation memory of the initial frame unit is corrected according to the resource utilization rate to obtain the maximum encapsulation memory of the frame unit, including: obtaining the minimum encapsulation memory of the frame unit. The difference between the initial maximum encapsulation memory of the frame unit and the minimum encapsulation memory of the frame unit is determined to be the frame unit memory difference. The complement of the resource utilization rate and the product of the frame unit memory difference are added to the minimum encapsulation memory of the frame unit to obtain the maximum encapsulation memory of the frame unit. The maximum encapsulation memory of the initial picture group is corrected according to the resource utilization rate to obtain the maximum encapsulation memory of the picture group, including: obtaining the minimum encapsulation memory of the picture group. The difference between the initial maximum encapsulation memory of the picture group and the minimum encapsulation memory of the picture group is determined to be the picture group memory difference. The complement of the resource utilization rate and the product of the picture group memory difference are added to the obtained minimum encapsulation memory of the picture group to obtain the maximum encapsulation memory of the picture group.

[0009] In some embodiments, the independent encapsulation condition is that the third memory required by the first frame unit is greater than or equal to the minimum encapsulation memory of the frame unit, and the first frame unit is an intra-frame coded frame.

[0010] In some embodiments, if the first frame unit does not meet the independent encapsulation condition, the difference between the maximum encapsulation memory of the picture group and the memory occupied by the second picture group is determined to be the remaining memory of the second picture group, and the encapsulation state of the second picture group is in encapsulation. If the remaining memory is greater than or equal to the third memory, the first frame unit is encapsulated into the second picture group. If the remaining memory is less than the third memory, a third picture group is newly created, and the first frame unit is encapsulated into the third picture group, and the encapsulation state of the second picture group is updated to encapsulation end, and the encapsulation state of the third picture group is set to encapsulation, and the third picture group is after the second picture group and adjacent to the second picture group.

[0011] In some embodiments, if the first frame unit meets the independent encapsulation condition, encapsulating the first frame unit to obtain a first picture group includes: if the first frame unit meets the independent encapsulation condition, updating the encapsulation state of the fourth picture group in the encapsulation to the end of encapsulation. Encapsulating the first frame unit to obtain a first picture group, and setting the encapsulation state of the first picture group to the end of encapsulation, the first picture group is located after the fourth picture group and is adjacent to the fourth picture group, the first frame unit exists in the first picture group, and no other frame units exist.

[0012] In some embodiments, the method in the first aspect above also includes: determining the decoding memory based on the maximum encapsulation memory of the frame unit, the maximum encapsulation memory of the frame unit is positively correlated with the decoding memory; decoding the first picture group, the second picture group, the third picture group or the fourth picture group based on the decoding memory to obtain the first video, the second video, the third video or the fourth video, the first video is the video corresponding to the first picture group, the second video is the video corresponding to the second picture group, the third video is the video corresponding to the third picture group, and the fourth video is the video corresponding to the fourth picture group.

[0013] In some implementations, the decoding memory is equal to the maximum packing memory of the frame unit.

[0014] In a second aspect, the present application provides a packaging device, the device comprising:

[0015] The acquisition module is used to obtain the maximum package memory of the frame unit and the maximum package memory of the picture group. The maximum package memory of the frame unit and the maximum package memory of the picture group are negatively correlated with the resource utilization rate.

[0016] The processing module is used for determining a first memory required to store the first data packet in response to receiving the first data packet.

[0017] The encapsulation module is used to encapsulate the first data packet to obtain the first frame unit when the first memory is less than or equal to the maximum encapsulation memory of the frame unit.

[0018] The encapsulation module is further used to encapsulate the first frame unit to obtain a first picture group when the first frame unit meets the independent encapsulation condition, and the second memory required by the first picture group is smaller than the maximum encapsulation memory of the picture group.

[0019] The processing module is further used to determine the decoding memory according to the maximum encapsulation memory of the frame unit, and the maximum encapsulation memory of the frame unit is positively correlated with the decoding memory.

[0020] The decoding module is used to decode the first picture group based on the decoding memory to obtain the first video.

[0021] In a third aspect, the present application provides a chip, which is used to execute any method in the first aspect.

[0022] In a fourth aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement a method as described in any one of the first aspects above. Or,

[0023] The electronic device comprises the chip as in the second aspect.

[0024] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method as described in any one of the above-mentioned first aspects.

[0025] In the technical solution provided by the embodiment of the present application, the network video recorder can obtain the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group that are corrected in real time, and when the first memory required to store the first data packet is less than or equal to the maximum encapsulation memory of the frame unit, the first data packet is encapsulated to obtain the first frame unit. When the first frame unit meets the independent encapsulation condition, encapsulating the first frame unit to obtain the first picture group can improve the resource utilization rate, so that one or more frame units in the encapsulated picture group are successfully decoded, avoiding the situation where the video frame cannot be decoded. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0027] Figure 1 It is a schematic diagram of a memory correction process of a video frame encapsulation method provided in an embodiment of the present application;

[0028] Figure 2 It is a schematic diagram of a data packet encapsulation and decoding process of a video frame encapsulation method provided in an embodiment of the present application;

[0029] Figure 3 is a structural schematic diagram of a video frame encapsulation device provided in an embodiment of the present application;

[0030] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0032] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0033] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0034] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0035] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0036] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0037] Network monitoring systems can be used for security supervision of home security, commercial security, and public security. IPC and NVR are key components of network monitoring systems. IPC can collect video data and audio data, and transmit the video data and audio data to NVR through the network in the form of data packets. IPC and NVR can transmit video data and audio data through RSTP (Real Time Streaming Protocol).

[0038] NVR can encapsulate and store the received data packets and provide them to users for viewing and management. In the process of encapsulating data packets, NVR can first encapsulate the received data packets into video frames, and then encapsulate the video frames into GOP units. In the traditional technical solution, NVR has an encapsulation upper limit for encapsulating GOP units, that is, the maximum memory occupied by a GOP unit after encapsulation will not exceed the preset encapsulation upper limit. In the decoding process of GOP units, NVR usually has a fixed decoding memory. If there are no video frames in the multiple video frames in the GOP unit that exceed the NVR decoding memory, NVR can successfully decode the GOP unit for users to view. However, when the resolution of the data packets received by NVR becomes higher, for example, when NVR is connected to a high-resolution IPC, the multiple video frames in the GOP unit encapsulated by NVR will become larger. In the process of NVR decoding the GOP unit, if the size of the video frame in the GOP unit exceeds the decoding memory of NVR, NVR cannot decode the GOP unit, and users cannot view the video captured by IPC.

[0039] The embodiment of the present application provides a video frame encapsulation method, which can improve the resource utilization of a network video recorder and avoid the situation where the video frame cannot be decoded.

[0040] The technical solution provided in the embodiment of the present application can be applied to network video recorders, mobile phones, computers, tablet computers, smart watches and other devices with video frame packaging and decoding functions or electronic devices with image processing functions. The embodiment of the present application does not limit the specific category of electronic devices.

[0041] For the convenience of description, the embodiment of the present application takes a network video recorder as the execution subject and exemplarily describes the specific process of encapsulating and decoding the video frame.

[0042] Combine the following Figures 1 to 3 The examples in the description describe the technical solutions of the embodiments of the present application.

[0043] like Figure 1 As shown, the method for determining the maximum package memory of the frame unit and the maximum package memory of the picture group by the network video recorder may include the following steps:

[0044] Step S101: obtaining the maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group.

[0045] In the embodiment of the present application, the maximum encapsulation memory of the initial frame unit may be the maximum memory occupied by the frame unit (i.e., video frame, hereinafter referred to as frame unit) obtained after the network video recorder encapsulates the received data packet. The maximum encapsulation memory of the initial picture group may be the maximum memory occupied by the picture group (i.e., GOP unit, hereinafter referred to as picture group) obtained after the network video recorder encapsulates one or more frame units.

[0046] The maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group can be user-set values ​​received by the network video recorder, or can be values ​​determined by the network video recorder based on the total memory and bandwidth, and this application does not limit this.

[0047] Taking the network video recorder determining the maximum package memory of the initial frame unit and the maximum package memory of the initial picture group according to the total memory and bandwidth as an example, the method for the network video recorder to determine the maximum package memory of the initial frame unit and the maximum package memory of the initial picture group may include:

[0048] A1: Get the total memory and bandwidth.

[0049] Different network video recorders have different total memory and bandwidth. For example, if the network video recorder is device A, the total memory of device A is 2G and the bandwidth is 300M.

[0050] A2: Determine the codec memory.

[0051] The network video recorder can use part of the total memory for encoding and decoding. For example, the proportion of encoding and decoding memory can be 30%. If the total memory of device A is 2G, the encoding and decoding memory can be 2G×0.3=614.4MB.

[0052] A3: Determine the maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group according to the total memory, bandwidth, and codec memory.

[0053] The network video recorder can determine the number of encoding paths according to the bandwidth, and determine the encoding average memory according to the number of encoding paths, decoding paths and encoding and decoding memory.

[0054] For example, when the bandwidth of device A is 300M, if each IPC in the IPC that establishes a communication connection with the network video recorder occupies 4M bandwidth, then device A can simultaneously receive data packets sent by 300÷4=75 IPCs at most. It can be understood that the number of IPCs received by the network video recorder is a power of 2, so device A with a bandwidth of 300M can simultaneously receive data packets sent by 64 IPCs at most (i.e., it can support 64 previews at most).

[0055] The number of decoding channels supported by a network video recorder is usually a preset value. For example, device A can support up to 16 preview channels. The calculation formula of the encoding average memory X can be: X = M ÷ (a + b); where M represents the encoding and decoding memory, a represents the number of encoding channels, and b represents the number of decoding channels.

[0056] For example, when M=614.4MB, a=64, b=16, the encoding average memory X=614.4÷(64+16)=7.675.

[0057] The network video recorder can determine the maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group according to the average encoding memory.

[0058] In the embodiment of the present application, the network video recorder can round up the average encoding memory to obtain the maximum package memory of the initial picture group, and round down the average encoding memory to obtain the maximum package memory of the initial frame unit. For example, if the average encoding memory is 7.675MB, the network video recorder can determine the maximum package memory of the initial picture group to be 8MB, and the maximum package memory of the initial frame unit to be 7MB.

[0059] In some embodiments, the network video recorder may also determine the maximum package memory of the initial frame unit and the maximum package memory of the initial picture group within a preset floating range according to the encoding average memory. For example, when the preset floating range is ±2MB of the encoding average memory, if the encoding average memory is 7.675MB, the network video recorder may determine the maximum package memory of the initial picture group to be 8MB and the maximum package memory of the initial frame unit to be 6MB.

[0060] It is understandable that the maximum encapsulation memory of the initial frame unit must be less than or equal to the maximum encapsulation memory of the initial picture group, so that the network video recorder can encapsulate the frame unit into a picture group.

[0061] Step S102: determining resource utilization rate according to the bandwidth utilization rate, the preset bandwidth weight, the memory utilization rate and the preset memory weight, wherein the resource utilization rate is positively correlated with the bandwidth utilization rate and the memory utilization rate.

[0062] In an embodiment of the present application, a preset bandwidth weight can be used to characterize the importance of bandwidth occupancy in the process of calculating resource utilization, and a preset memory weight can be used to characterize the importance of memory utilization in the process of calculating resource utilization. Exemplarily, resource utilization can be the product of bandwidth occupancy and bandwidth weight, and the sum of the product of memory utilization and memory weight. Optionally, resource utilization can also be bandwidth occupancy or memory utilization. The embodiment of the present application does not limit the calculation method of resource utilization.

[0063] Exemplarily, the calculation formula of resource utilization rate can be: resource utilization rate = bandwidth utilization rate × preset bandwidth weight + memory utilization rate × preset memory weight. For example, if the preset bandwidth weight is 0.3, the preset memory weight is 0.7, the bandwidth utilization rate is 50%, and the memory utilization rate is 70%, then the resource utilization rate = 50% × 0.3 + 70% × 0.7 = 64%.

[0064] Step S103: the initial frame unit maximum encapsulation memory is corrected according to the resource utilization rate to obtain the frame unit maximum encapsulation memory, and the frame unit maximum encapsulation memory is negatively correlated with the resource utilization rate.

[0065] In the embodiment of the present application, the network video recorder corrects the maximum package memory of the initial frame unit according to the resource usage rate, and the method for obtaining the maximum package memory of the frame unit can be:

[0066] B1: Get the minimum encapsulation memory of the frame unit.

[0067] The minimum package memory of the frame unit may be the minimum value of the maximum package memory of the frame unit obtained after correcting the initial maximum package memory of the frame unit, that is, the maximum package memory of the frame unit is not less than the minimum package memory of the frame unit.

[0068] The minimum package memory of the frame unit may be positively correlated with the total memory of the network video recorder, and the present application does not limit the specific value of the minimum package memory of the frame unit. For example, when the total memory of device A is 2GB, the minimum package memory of the frame unit of device A may be 2MB.

[0069] The minimum encapsulation memory of the frame unit can be a value set by the user according to the video code stream of the IPC, or it can be other values ​​smaller than the maximum encapsulation memory of the frame unit, and this application does not limit this.

[0070] B2: The difference between the initial frame unit maximum package memory and the frame unit minimum package memory is determined as the frame unit memory difference.

[0071] In the embodiment of the present application, the frame unit memory difference may be: the initial frame unit maximum encapsulation memory minus the frame unit minimum encapsulation memory.

[0072] For example, if the maximum package memory of the initial frame unit is 6 MB and the minimum package memory of the frame unit is 2 MB, the frame unit memory difference is: 6-2=4 MB.

[0073] B3: Determine the remaining resource utilization rate, which is the difference between 1 and the resource utilization rate.

[0074] B4: Add the product of the remaining resource usage rate and the frame unit memory difference to the minimum encapsulation memory of the frame unit to obtain the maximum encapsulation memory of the frame unit.

[0075] In the embodiment of the present application, the maximum encapsulation memory of the frame unit may be: the frame unit memory difference×(1-resource utilization rate)+the minimum encapsulation memory of the frame unit.

[0076] For example, if the frame unit memory difference is 4 MB, the resource usage rate is 64%, and the frame unit minimum package memory is 2 MB, then the frame unit maximum package memory is: 4×(1-64%)+2=3.44 MB.

[0077] In the embodiment of the present application, the maximum encapsulation memory of the frame unit is negatively correlated with the resource utilization rate, that is, the higher the resource utilization rate, the smaller the maximum encapsulation memory of the frame unit, and the lower the resource utilization rate, the larger the maximum encapsulation memory of the frame unit.

[0078] In the technical solution provided in the embodiment of the present application, the higher the resource utilization rate, the higher the memory utilization rate and / or bandwidth occupancy rate of the network video recorder, the insufficient codec memory of the network video recorder, and the network video recorder cannot store overly large frame units. It is understandable that when the codec memory of the network video recorder is insufficient, the smaller the single frame unit, the more frame units the network video recorder can store. The technical solution provided in the embodiment of the present application can increase the number of frame unit encapsulations by reducing the maximum encapsulation memory of the frame unit when the codec memory of the network video recorder is insufficient, thereby reducing the loss rate of video information and improving user experience.

[0079] The lower the resource utilization rate, the lower the memory utilization rate and / or bandwidth occupancy rate of the network video recorder, the more sufficient the codec memory of the network video recorder is, and the network video recorder has enough memory to store larger frame units. The technical solution provided in the embodiment of the present application can store larger frame units and reduce the number of frame unit losses by increasing the maximum encapsulation memory of the frame unit when the codec memory of the network video recorder is sufficient, thereby reducing the loss rate of video information and improving user experience.

[0080] Step S104: modifying the initial maximum package memory of the picture group according to the resource utilization rate to obtain the maximum package memory of the picture group. The maximum package memory of the picture group is negatively correlated with the resource utilization rate.

[0081] In the embodiment of the present application, the network video recorder corrects the maximum package memory of the initial picture group according to the resource utilization rate, and the method for obtaining the maximum package memory of the picture group can be:

[0082] C1: Get the minimum package memory of the picture group.

[0083] The minimum package memory of the picture group may be the minimum value of the maximum package memory of the picture group obtained after correcting the initial maximum package memory of the picture group, that is, the maximum package memory of the picture group is not less than the minimum package memory of the picture group.

[0084] The minimum package memory of the picture group may be positively correlated with the total memory of the network video recorder, and the present application does not limit the specific value of the minimum package memory of the picture group. For example, when the total memory of device A is 2GB, the minimum package memory of the picture group of device A may be 4MB.

[0085] The minimum package memory of the picture group can be a value set by the user according to the video code stream of the IPC, or it can be other values ​​smaller than the maximum package memory of the picture group, and this application does not limit it here.

[0086] It is understandable that the minimum encapsulation memory of the frame unit must be less than or equal to the minimum encapsulation memory of the picture group, so that the network video recorder can encapsulate the frame unit into a picture group.

[0087] C2: The difference between the maximum package memory of the initial picture group and the minimum package memory of the picture group is determined as the picture group memory difference.

[0088] In the embodiment of the present application, the picture group memory difference may be: the maximum encapsulation memory of the initial picture group minus the minimum encapsulation memory of the picture group.

[0089] For example, if the maximum package memory of the initial GOP is 8 MB and the minimum package memory of the GOP is 4 MB, the GOP memory difference is: 8-4=4 MB.

[0090] C3: Add the product of the remaining resource usage rate and the picture group memory difference to the minimum package memory of the picture group to obtain the maximum package memory of the picture group.

[0091] In the embodiment of the present application, the maximum package memory of the picture group may be: the picture group memory difference×(1-resource usage rate)+the minimum package memory of the picture group.

[0092] For example, if the GOP memory difference is 4 MB, the resource usage is 64%, and the GOP minimum package memory is 4 MB, then the GOP maximum package memory is: 4×(1-64%)+4=5.44 MB.

[0093] It can be understood that, since the initial frame unit maximum encapsulation memory is less than or equal to the initial picture group maximum encapsulation memory, the frame unit minimum encapsulation memory is less than or equal to the picture group minimum encapsulation memory. When the resource usage rate remains unchanged, the frame unit maximum encapsulation memory and the picture group maximum encapsulation memory are only related to the initial frame unit maximum encapsulation memory, the initial picture group maximum encapsulation memory, the frame unit minimum encapsulation memory and the picture group minimum encapsulation memory. Therefore, the frame unit maximum encapsulation memory is less than or equal to the picture group maximum encapsulation memory.

[0094] In the embodiment of the present application, the maximum package memory of the picture group is negatively correlated with the resource utilization rate, that is, the higher the resource utilization rate, the smaller the maximum package memory of the picture group, and the lower the resource utilization rate, the larger the maximum package memory of the picture group.

[0095] In the technical solution provided in the embodiment of the present application, the higher the resource utilization rate, the higher the memory utilization rate and / or bandwidth occupancy rate of the network video recorder, the insufficient codec memory of the network video recorder, and the network video recorder cannot store too large a group of pictures. It is understandable that when the codec memory of the network video recorder is insufficient, the smaller the single group of pictures, the more groups of pictures that the network video recorder can store. The technical solution provided in the embodiment of the present application can increase the number of picture groups to be packaged by reducing the maximum package memory of the picture group when the codec memory of the network video recorder is insufficient, thereby reducing the loss rate of video information, and improving the rationality of the memory allocation of the network video recorder, thereby improving the user experience.

[0096] The lower the resource utilization rate, the lower the memory utilization rate and / or bandwidth occupancy rate of the network video recorder, the more sufficient the codec memory of the network video recorder is, and the network video recorder has enough memory to store a larger group of pictures. The technical solution provided in the embodiment of the present application can store a larger group of pictures by increasing the maximum encapsulation memory of the group of pictures when the codec memory of the network video recorder is sufficient, thereby reducing the number of lost groups of pictures, thereby reducing the loss rate of video information, and improving the rationality of the memory allocation of the network video recorder, thereby improving the user experience.

[0097] In the technical solution provided in the embodiment of the present application, the network video recorder can correct the maximum package memory of the frame unit and the maximum package memory of the picture group in real time according to the resource utilization rate, so as to make full use of the device resources and improve the user experience.

[0098] In some embodiments, the network video recorder can also modify the decoding memory in real time according to the maximum package memory of the frame unit. For example, the decoding memory can be positively correlated with or equal to the maximum package memory of the frame unit. For example, when the maximum package memory of the frame unit is 3.44MB, the network video recorder can modify the decoding memory to 3.44MB.

[0099] It can be understood that when the maximum encapsulation memory of the frame unit increases, one or more frame units in the encapsulated picture group will also increase, and the network video recorder can increase the decoding memory to facilitate the successful decoding of one or more frame units in the encapsulated picture group, thereby avoiding the situation where the video frame cannot be decoded.

[0100] In the technical solution provided in the embodiment of the present application, the network video recorder can encapsulate and decode the received data packets according to the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group corrected in real time. Figure 2 As shown, including:

[0101] Step S201: obtaining the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group, wherein the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group are negatively correlated with the resource usage rate.

[0102] In the embodiment of the present application, the network video recorder can determine the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group through the above steps S101 to S104, which will not be elaborated in this application.

[0103] Step S202: In response to receiving a first data packet, determining a first memory required to store the first data packet.

[0104] The network video recorder can establish a communication connection with multiple IPCs to receive data packets sent by the multiple IPCs. The first data packet can be a data packet sent by any one of the multiple IPCs. The embodiment of the present application takes one of the IPCs as an example for exemplary description. It can be understood that the method for the network video recorder to encapsulate and decode data packets sent by other IPCs also has the same or similar principles, and the present application will not elaborate on them here.

[0105] Step S203: If the first memory is less than or equal to the maximum encapsulation memory of the frame unit, encapsulate the first data packet to obtain a first frame unit.

[0106] In the embodiment of the present application, the network video recorder can determine the size of the first memory and the maximum encapsulation memory of the frame unit, and if the first memory is less than or equal to the maximum encapsulation memory of the frame unit, the first data packet is encapsulated to obtain the first frame unit. If the first memory is greater than the maximum encapsulation memory of the frame unit, the network video recorder can discard the first data packet.

[0107] For example, if the first memory is 3MB, the maximum frame unit package memory is 3.44MB, 3MB < 3.44MB, the network video recorder will package the first data packet to obtain the first frame unit. If the first memory is 4MB, the maximum frame unit package memory is 3.44MB, 4MB > 3.44MB, the network video recorder will discard the first data packet.

[0108] Step S204: if the first frame unit meets the independent encapsulation condition, encapsulate the first frame unit to obtain a first picture group, and the second memory required by the first picture group is smaller than the maximum encapsulation memory of the picture group.

[0109] In the embodiment of the present application, the independent packaging conditions may include:

[0110] Condition 1: The third memory required to store the first frame unit is greater than or equal to the minimum package memory of the frame unit.

[0111] Condition 2: The first frame unit is an I frame (intra picture, intra-coded frame).

[0112] If the first frame unit can satisfy both condition 1 and condition 2, the network video recorder can encapsulate the first frame unit to obtain the first picture group. It can be understood that when the third memory required for encapsulating the first frame unit is greater than or equal to the minimum encapsulation memory of the frame unit, the first frame unit is a large video frame. To ensure that the network video recorder can successfully decode the picture group containing the first frame unit, the network video recorder packages the first frame unit separately into a picture group.

[0113] Specifically, the network video recorder can update the encapsulation state of the fourth picture group in encapsulation to the end of encapsulation, and encapsulate the first frame unit to obtain the first picture group, and set the encapsulation state of the first picture group to the end of encapsulation, the first picture group is located after the fourth picture group and is adjacent to the fourth picture group, the first frame unit exists in the first picture group, and no other frame units exist.

[0114] In the embodiment of the present application, if the first frame unit does not meet the independent encapsulation condition, that is, the first frame unit cannot meet condition 1 and condition 2 at the same time, the network video recorder determines the remaining memory of the maximum encapsulation memory of the picture group minus the memory occupied by the second picture group. If the remaining memory is greater than or equal to the third memory, the network video recorder encapsulates the first frame unit into the second picture group, and the encapsulation state of the second picture group is the picture group in the encapsulation. If the remaining memory is less than the third memory, a new third picture group is created, and the first frame unit is encapsulated into the third picture group, and the encapsulation state of the second picture group is updated to the end of encapsulation, and the encapsulation state of the third picture group is set to encapsulation, and the third picture group is after the second picture group and adjacent to the second picture group.

[0115] The decoding memory is determined according to the maximum encapsulation memory of the frame unit, and the maximum encapsulation memory of the frame unit is positively correlated with the decoding memory. The first picture group is decoded based on the decoding memory to obtain the first video.

[0116] In the embodiment of the present application, after the network video recorder corrects the maximum encapsulation memory of the frame unit in real time, it encapsulates the first data packet according to the corrected maximum encapsulation memory of the frame unit, obtains the picture group including the first data packet, and then corrects the decoding memory. Optionally, the network video recorder can also correct the decoding memory in real time according to the maximum encapsulation memory of the frame unit. This application does not limit this.

[0117] When the maximum encapsulation memory of the frame unit increases, one or more frame units in the encapsulated picture group will increase, and the modified decoding memory will also increase. Decoding the first picture group based on the modified decoding memory can successfully decode one or more frame units in the encapsulated picture group, avoiding the situation where the video frame cannot be decoded. When the maximum encapsulation memory of the frame unit decreases, memory can be saved, thereby reducing the resource utilization rate of the network video recorder to reduce system pressure.

[0118] It is understandable that the network video recorder can also encapsulate and decode the second data packet after the first data packet according to the real-time corrected maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group. The method for the network video recorder to encapsulate and decode the second data packet has the same or similar calculation principle as the method for encapsulating and decoding the first data packet, and this application will not repeat it here.

[0119] In the technical solution provided by the embodiment of the present application, the network video recorder can obtain the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group corrected in real time, and when the first memory required to store the first data packet is less than or equal to the maximum encapsulation memory of the frame unit, the first data packet is encapsulated to obtain the first frame unit. When the first frame unit meets the independent encapsulation condition, the first frame unit is encapsulated to obtain the first picture group. The decoding memory is corrected according to the maximum encapsulation memory of the frame unit corrected in real time, and the first picture group is decoded by the corrected decoding memory. It can improve the resource utilization rate, so that one or more frame units in the encapsulated picture group are successfully decoded, avoiding the situation where the video frame cannot be decoded.

[0120] It should be understood that, under the premise of no logical conflict, the above-mentioned various application embodiments can be implemented in combination with each other to meet actual application requirements. The specific embodiments or implementation plans obtained after these combinations still fall within the protection scope of this application.

[0121] Corresponding to the video frame encapsulation method in the above-mentioned embodiment, an embodiment of the present application provides a video frame encapsulation device, which can be implemented by software, hardware or a combination of both to become part or all of a computer device, and is used to execute the steps in the video frame encapsulation method in the above-mentioned embodiment.

[0122] Figure 3 A schematic structural diagram of a packaging device 30 provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0123] Reference Figure 3 The device 30 includes an acquisition module 310, a processing module 320, a packaging module 330 and a decoding module 340.

[0124] The acquisition module 310 is used to acquire the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group, wherein the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group are negatively correlated with the resource usage rate.

[0125] The processing module 320 is configured to determine a first memory required to store the first data packet in response to receiving the first data packet.

[0126] The encapsulation module 330 is used to encapsulate the first data packet to obtain the first frame unit when the first memory is less than or equal to the maximum encapsulation memory of the frame unit.

[0127] The encapsulation module 330 is further configured to encapsulate the first frame unit to obtain a first picture group when the first frame unit meets the independent encapsulation condition, and the second memory required by the first picture group is smaller than the maximum encapsulation memory of the picture group.

[0128] In some embodiments, the acquisition module 310 is specifically used to: obtain the maximum encapsulation memory of the initial frame unit and the maximum encapsulation memory of the initial picture group. The resource utilization rate is determined according to the bandwidth occupancy rate, the preset bandwidth weight, the memory utilization rate and the preset memory weight, and the bandwidth occupancy rate and the memory utilization rate are both positively correlated with the resource utilization rate. The maximum encapsulation memory of the initial frame unit is corrected according to the resource utilization rate to obtain the maximum encapsulation memory of the frame unit, and the maximum encapsulation memory of the frame unit is negatively correlated with the resource utilization rate. The maximum encapsulation memory of the initial picture group is corrected according to the resource utilization rate to obtain the maximum encapsulation memory of the picture group, and the maximum encapsulation memory of the picture group is negatively correlated with the resource utilization rate.

[0129] In some implementations, the resource usage rate is the sum of the product of the bandwidth occupancy rate and the bandwidth weight, and the product of the memory usage rate and the memory weight.

[0130] In some embodiments, the acquisition module 310 is specifically used to: obtain the minimum encapsulation memory of the frame unit. Determine the difference between the initial maximum encapsulation memory of the frame unit and the minimum encapsulation memory of the frame unit, which is the frame unit memory difference. Add the complement of the resource utilization rate and the frame unit memory difference to the minimum encapsulation memory of the frame unit to obtain the maximum encapsulation memory of the frame unit. Obtain the minimum encapsulation memory of the picture group. Determine the difference between the initial maximum encapsulation memory of the picture group and the minimum encapsulation memory of the picture group, which is the picture group memory difference. Add the complement of the resource utilization rate and the picture group memory difference to the obtained minimum encapsulation memory of the picture group to obtain the maximum encapsulation memory of the picture group.

[0131] In some embodiments, the independent encapsulation condition is that the third memory required by the first frame unit is greater than or equal to the minimum encapsulation memory of the frame unit, and the first frame unit is an intra-frame coded frame.

[0132] In some embodiments, the encapsulation module 330 is further used to: when the first frame unit does not meet the independent encapsulation condition, determine the difference between the maximum encapsulation memory of the picture group and the memory occupied by the second picture group as the remaining memory of the second picture group, and the encapsulation state of the second picture group is encapsulation. If the remaining memory is greater than or equal to the third memory, encapsulate the first frame unit into the second picture group. If the remaining memory is less than the third memory, create a new third picture group, encapsulate the first frame unit into the third picture group, update the encapsulation state of the second picture group to encapsulation end, set the encapsulation state of the third picture group to encapsulation, and the third picture group is after the second picture group and adjacent to the second picture group.

[0133] In some embodiments, the encapsulation module 330 is specifically configured to: when the first frame unit meets the independent encapsulation condition, update the encapsulation state of the fourth picture group in the encapsulation to the encapsulation end. Encapsulate the first frame unit to obtain the first picture group, and set the encapsulation state of the first picture group to the encapsulation end, the first picture group is located after the fourth picture group and is adjacent to the fourth picture group, the first frame unit exists in the first picture group, and no other frame units exist.

[0134] In some embodiments, the encapsulation module 330 is further used to: determine the decoding memory based on the maximum encapsulation memory of the frame unit, the maximum encapsulation memory of the frame unit is positively correlated with the decoding memory; decode the first picture group, the second picture group, the third picture group or the fourth picture group based on the decoding memory to obtain the first video, the second video, the third video or the fourth video, the first video is the video corresponding to the first picture group, the second video is the video corresponding to the second picture group, the third video is the video corresponding to the third picture group, and the fourth video is the video corresponding to the fourth picture group.

[0135] In some implementations, the decoding memory is equal to the maximum packing memory of the frame unit.

[0136] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0137] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0138] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.

[0139] Figure 4 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: at least one processor 410 ( Figure 4 ), a memory 420, and a communication module 440, wherein the memory 420 stores a computer program 430 that may be run on the processor 410. When the processor 410 executes the computer program 430, the steps in the above-mentioned video frame encapsulation method embodiment are implemented, such as Figure 2 201 to step 204 as shown. Alternatively, when the processor 410 executes the computer program 430, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 3 The functions of the modules 310 to 340 are shown, and the communication module 440 can be a separate communication unit for communicating with an external server or terminal device.

[0140] The electronic device 4 may include, but is not limited to: a processor 410 and a memory 420. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 4 may also include an input sending device, a network access device, a bus, etc.

[0141] The processor 410 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0142] In some embodiments, the memory 420 may be an internal storage unit of the electronic device 4, such as a hard disk or memory of the electronic device 4. The memory 420 may also be an external storage device of the electronic device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 4. The memory 420 may also include both an internal storage unit of the electronic device 4 and an external storage device. The memory 420 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of a computer program 430, etc. The memory 420 may also be used to temporarily store data that has been sent or is to be sent.

[0143] In addition, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0144] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on an electronic device, the electronic device executes the steps in the above-mentioned method embodiments.

[0145] An embodiment of the present application provides a chip, which includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, the steps in the above-mentioned method embodiments are implemented.

[0146] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the steps in the above-mentioned method embodiments.

[0147] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0148] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).

[0149] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0150] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0151] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0152] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0153] 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 distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to a large-screen device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0156] Finally, it should be noted that the above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A video frame encapsulation method, characterized in that: The method comprises: Obtaining a maximum encapsulation memory of a frame unit and a maximum encapsulation memory of a picture group, wherein the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group are both negatively correlated with a resource usage rate; In response to receiving a first data packet, determining a first memory required to store the first data packet; If the first memory is less than or equal to the maximum encapsulation memory of the frame unit, encapsulate the first data packet to obtain a first frame unit; If the first frame unit meets the independent encapsulation condition, the first frame unit is encapsulated to obtain a first picture group, and the second memory required by the first picture group is smaller than the maximum encapsulation memory of the picture group.

2. The video frame encapsulation method according to claim 1, characterized in that: The obtaining of the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group includes: Get the maximum package memory of the initial frame unit and the maximum package memory of the initial picture group; Determine a resource utilization rate according to the bandwidth utilization rate, the preset bandwidth weight, the memory utilization rate and the preset memory weight, wherein the resource utilization rate is positively correlated with the bandwidth utilization rate and the memory utilization rate; Correcting the initial frame unit maximum encapsulation memory according to the resource utilization rate to obtain the frame unit maximum encapsulation memory, wherein the frame unit maximum encapsulation memory is negatively correlated with the resource utilization rate; The initial maximum package memory of the picture group is corrected according to the resource utilization rate to obtain the maximum package memory of the picture group, and the maximum package memory of the picture group is negatively correlated with the resource utilization rate.

3. The video frame encapsulation method according to claim 2, characterized in that: The resource usage rate is the sum of the product of the bandwidth occupancy rate and the bandwidth weight, and the product of the memory usage rate and the memory weight.

4. The video frame encapsulation method according to claim 2, characterized in that: The step of correcting the initial frame unit maximum encapsulation memory according to the resource usage rate to obtain the frame unit maximum encapsulation memory includes: Get the minimum encapsulation memory of the frame unit; Determine the difference between the initial frame unit maximum encapsulation memory and the frame unit minimum encapsulation memory as the frame unit memory difference; Determine a remaining resource utilization rate, where the remaining resource utilization rate is a difference between 1 and the resource utilization rate; The product of the remaining resource usage rate and the frame unit memory difference is added to the frame unit minimum encapsulation memory to obtain the frame unit maximum encapsulation memory; The step of correcting the maximum encapsulation memory of the initial picture group according to the resource usage rate to obtain the maximum encapsulation memory of the picture group includes: Get the minimum package memory of the picture group; Determine the difference between the maximum package memory of the initial picture group and the minimum package memory of the picture group as the picture group memory difference; The maximum encapsulation memory of the group of pictures is obtained by adding the product of the remaining resource usage rate and the memory difference of the group of pictures to the minimum encapsulation memory of the group of pictures.

5. The video frame encapsulation method according to any one of claims 1 to 4, characterized in that: The independent encapsulation condition is that the third memory required to store the first frame unit is greater than or equal to the minimum encapsulation memory of the frame unit, and the first frame unit is an intra-frame coded frame.

6. The video frame encapsulation method according to claim 5, characterized in that: The method further comprises: If the first frame unit does not meet the independent encapsulation condition, determining the difference between the maximum encapsulation memory of the picture group and the memory occupied by the second picture group as the remaining memory of the second picture group, and the encapsulation state of the second picture group is encapsulation; If the remaining memory is greater than or equal to the third memory, encapsulating the first frame unit into the second picture group; If the remaining memory is less than the third memory, a third picture group is newly created, and the first frame unit is encapsulated into the third picture group, and the encapsulation state of the second picture group is updated to encapsulation end, and the encapsulation state of the third picture group is set to encapsulation, and the third picture group is after the second picture group and adjacent to the second picture group.

7. The video frame encapsulation method according to claim 5, characterized in that: If the first frame unit meets the independent encapsulation condition, encapsulating the first frame unit to obtain a first picture group includes: If the first frame unit meets the independent encapsulation condition, updating the encapsulation state of the fourth picture group in encapsulation to encapsulation completion; The first frame unit is encapsulated to obtain the first picture group, and the encapsulation state of the first picture group is set to encapsulation end, the first picture group is located after the fourth picture group and is adjacent to the fourth picture group, the first picture group includes the first frame unit, and does not include other frame units.

8. The video frame encapsulation method according to any one of claims 6 or 7, characterized in that: After the method, the method further comprises: Determine a decoding memory according to the maximum encapsulation memory of the frame unit, wherein the maximum encapsulation memory of the frame unit is positively correlated with the decoding memory; The first picture group, the second picture group, the third picture group or the fourth picture group is decoded based on the decoding memory to obtain a first video, a second video, a third video or a fourth video, wherein the first video is a video corresponding to the first picture group, the second video is a video corresponding to the second picture group, the third video is a video corresponding to the third picture group, and the fourth video is a video corresponding to the fourth picture group.

9. The video frame encapsulation method according to claim 8, characterized in that: The decoding memory is equal to the maximum encapsulation memory of the frame unit.

10. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the method as claimed in any one of claims 1 to 9.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method as described in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Memory distribution method and device of WiFi module

    CN106339325A

  • Video recording data packaging method and device

    CN110248205A

  • Video loading method and device and electronic equipment

    CN111107438A

  • Data frame queue scheduling method and system, and vehicle-mounted Ethernet switch

    CN118488023A

  • Network video recorder and data encryption storage method

    CN118869917A