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

By real-time correction of the frame unit and maximum encapsulation memory of the network video recorder, the problem of video frames being unable to be decoded due to high-resolution data packets was solved, achieving more efficient resource utilization and improved user experience.

CN119767070BActive Publication Date: 2026-02-27TP-LINK
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional network video recorders cannot play videos properly when receiving high-resolution data packets because the video frame size exceeds the decoding memory limit.

Method used

By adjusting the maximum encapsulation memory of frame units and picture groups in real time and adjusting the memory size according to resource utilization, we can ensure that data packets can be successfully encapsulated and decoded.

Benefits of technology

It improves the resource utilization of network video recorders, avoids situations where video frames cannot be decoded, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119767070B_ABST
    Figure CN119767070B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field and provides a video frame packaging method, an electronic device and a computer readable storage medium, the method comprises the following steps: acquiring a frame unit maximum packaging memory and a picture group maximum packaging memory, the frame unit maximum packaging memory and the picture group maximum packaging memory are negatively correlated with resource utilization. In response to receiving a first data packet, determining a first memory required for storing the first data packet. If the first memory is less than or equal to the frame unit maximum packaging memory, the first data packet is packaged to obtain a first frame unit. If the first frame unit satisfies an independent packaging condition, the first frame unit is packaged to obtain a first picture group. The decoding memory is determined according to the frame unit maximum packaging memory. The first picture group is decoded based on the decoding memory to obtain a first video. The resource utilization rate of a network video recorder can be improved, and the situation that a video frame 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 technical field of computer, and particularly relates to a video frame packaging method, an electronic device and a computer readable storage medium. BACKGROUND

[0002] An IPC (Internet Protocol Camera) and an NVR (Network Video Recorder) are important components of a network video monitoring system. The IPC can convert captured video signals into digital signals and transmit the digital signals in the form of data packets to the NVR through a network. The NVR packages the received data packets into video frames and then packages the video frames into a GOP (Group of Pictures) for storage. A user can remotely or locally view the video (one or more decoded picture groups) through the NVR.

[0003] In a conventional technical solution, the memory for packaging the GOP and the memory for decoding the GOP are usually fixed values set in advance. However, when the NVR receives data packets with a larger resolution, such as when the NVR accesses an IPC with a high resolution, the video frames in the GOP become larger. If the size of the video frame exceeds the upper limit of the memory for decoding the GOP, the NVR cannot decode the GOP, resulting in that the video frame cannot be normally played. SUMMARY

[0004] Embodiments of the present application provide a video frame packaging method, device, chip, electronic device and computer readable storage medium, which can improve the resource utilization rate of the NVR and avoid the situation that the video frame cannot be decoded.

[0005] In a first aspect, the present application provides a video frame packaging method, comprising: obtaining a frame unit maximum packaging memory and a GOP (Group of Pictures) maximum packaging memory, wherein the frame unit maximum packaging memory and the GOP maximum packaging memory are negatively correlated with a resource utilization rate. In response to receiving a first data packet, determining a first memory required for storing the first data packet. If the first memory is less than or equal to the frame unit maximum packaging memory, packaging the first data packet to obtain a first frame unit. If the first frame unit satisfies an independent packaging condition, packaging the first frame unit to obtain a first GOP, and a second memory required for the first GOP is less than the GOP maximum packaging memory.

[0006] In some embodiments, the obtaining the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the group of pictures comprises: obtaining an initial maximum encapsulation memory of the frame unit and an initial maximum encapsulation memory of the group of pictures. A resource usage rate is determined according to a bandwidth occupancy rate, a preset bandwidth weight, a memory usage rate and a preset memory weight, wherein the bandwidth occupancy rate, the memory usage rate and the resource usage rate are positively correlated. The initial maximum encapsulation memory of the frame unit is corrected according to the resource usage rate to obtain the maximum encapsulation memory of the frame unit, wherein the maximum encapsulation memory of the frame unit is negatively correlated with the resource usage rate. The initial maximum encapsulation memory of the group of pictures is corrected according to the resource usage rate to obtain the maximum encapsulation memory of the group of pictures, wherein the maximum encapsulation memory of the group of pictures is negatively correlated with the resource usage rate.

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

[0008] In some embodiments, the correcting the initial maximum encapsulation memory of the frame unit according to the resource usage rate to obtain the maximum encapsulation memory of the frame unit comprises: obtaining a minimum encapsulation memory of the frame unit. A difference between the initial maximum encapsulation memory of the frame unit and the minimum encapsulation memory of the frame unit is determined as a frame unit memory difference. A product of a complement of the resource usage rate and the frame unit memory difference is added to the minimum encapsulation memory of the frame unit to obtain the maximum encapsulation memory of the frame unit. The correcting the initial maximum encapsulation memory of the group of pictures according to the resource usage rate to obtain the maximum encapsulation memory of the group of pictures comprises: obtaining a minimum encapsulation memory of the group of pictures. A difference between the initial maximum encapsulation memory of the group of pictures and the minimum encapsulation memory of the group of pictures is determined as a group of pictures memory difference. A product of a complement of the resource usage rate and the group of pictures memory difference is added to the minimum encapsulation memory of the group of pictures to obtain the maximum encapsulation memory of the group of pictures.

[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-coded frame.

[0010] In some embodiments, if the first frame unit does not satisfy the independent encapsulation condition, a difference between the maximum encapsulation memory of the group of pictures and memory occupied by a second group of pictures is determined as remaining memory of the second group of pictures, and an encapsulation state of the second group of pictures 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 group of pictures. If the remaining memory is less than the third memory, a third group of pictures is newly created, the first frame unit is encapsulated into the third group of pictures, the encapsulation state of the second group of pictures is updated to encapsulation end, the encapsulation state of the third group of pictures is set to encapsulation in progress, the third group of pictures is after the second group of pictures, and adjacent to the second group of pictures.

[0011] In some embodiments, if the first frame unit satisfies the independent encapsulation condition, the first frame unit is encapsulated to obtain a first picture group, including: if the first frame unit satisfies the independent encapsulation condition, updating an encapsulation state of a fourth picture group in encapsulation to encapsulation end. 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 adjacent to the fourth picture group. The first picture group contains the first frame unit and does not contain other frame units.

[0012] In some embodiments, the method in the first aspect further includes: determining a decoding memory according to the maximum encapsulation memory of the frame unit, the maximum encapsulation memory of the frame unit being positively correlated with the decoding memory; and 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 a first video, a second video, a third video, or a fourth video. 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.

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

[0014] In a second aspect, the present application provides an encapsulation device, the device including:

[0015] The acquisition module is configured to acquire the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group. 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.

[0016] The processing module is configured to determine a first memory required for storing the first data packet in response to receiving the first data packet.

[0017] The encapsulation module is configured to encapsulate the first data packet to obtain a 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 configured to encapsulate the first frame unit to obtain a first picture group when the first frame unit satisfies an independent encapsulation condition. The second memory required for the first picture group is less than the maximum encapsulation memory of the picture group.

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

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

[0021] In a third aspect, the present application provides a chip. The chip is configured to execute the method in any one of the first aspect.

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

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

[0024] In a fifth aspect, the present application provides a computer readable storage medium storing a computer program, the computer program being configured to implement the method in any one of the first aspect when executed by a processor.

[0025] In the technical solution provided by the present application, the network video recorder can obtain the real-time corrected frame unit maximum encapsulation memory and the picture group maximum encapsulation memory, and when the first memory required for storing the first data packet is less than or equal to the frame unit maximum encapsulation memory, the first data packet is encapsulated to obtain the first frame unit. When the first frame unit satisfies the independent encapsulation condition, the first frame unit is encapsulated to obtain the first picture group, which can improve the resource utilization rate and enable one or more frame units in the encapsulated picture group to be successfully decoded, thereby avoiding the situation that the video frame cannot be decoded. BRIEF DESCRIPTION OF DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

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

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

[0029] Figure 3 is a structure schematic diagram of a video frame encapsulation device provided by the present application;

[0030] Figure 4 is a structure schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION

[0031] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0032] It is to be understood that the terminology "includes", "has", "holds", "contains" or "comprises", "comprising", "including" or "having" when used in this specification and in the following claims, specifies the presence of stated features, integers, steps, operations, elements, or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof.

[0033] It is also to be understood that the terminology "and / or" when used in this specification and in the following claims, refers to at least one of the items, or any combination of one or more of the items, associated with the "and / or" term.

[0034] As used in this specification and in the claims, the terms "if" and "when" can be interpreted to mean "upon" or "in response to a determination" or "in response to a detection" depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon a determination" or "in response to a determination" or "upon detecting [a described condition or event]" or "in response to detecting [a described condition or event]" depending on the context.

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

[0036] Reference in the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, although it can. The terms "including", "containing", "having" and variations thereof are meant to encompass the terms "including but not limited to", unless otherwise indicated.

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

[0038] The NVR can encapsulate and store the received data packets, and provide the data packets for a user to view and manage. In the encapsulation process of the data packets, the NVR can first encapsulate the received data packets into video frames, and then encapsulate the video frames into GOP units. In a conventional technical solution, the NVR is provided with an upper limit of encapsulating GOP units, that is, a GOP unit after encapsulation does not exceed a preset upper limit of encapsulation in memory. In the decoding process of the GOP units, the NVR is usually provided with a fixed decoding memory. If there is no video frame in the multiple video frames in the GOP unit that exceeds the decoding memory of the NVR, the NVR can successfully decode the GOP unit for the user to view. However, when the resolution of the data packets received by the NVR becomes higher, for example, when the NVR accesses a high-resolution IPC, the multiple video frames in the GOP unit after encapsulation by the NVR become larger. In the process of decoding the GOP unit by the NVR, if the size of the video frame in the GOP unit exceeds the decoding memory of the NVR, the NVR cannot decode the GOP unit, and the user cannot view the video collected by the IPC.

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

[0040] The technical solution provided by the embodiment of the present application can be applied to a network video recorder, a mobile phone, a computer, a tablet computer, a smart watch and other devices with a video frame encapsulation and decoding function or an electronic device with an image processing function. The embodiment of the present application does not limit the specific category of the electronic device.

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

[0042] The technical solution of the embodiment of the present application is described below in conjunction with the examples in Figures 1 to 3

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

[0044] ​Step S101: Obtain initial frame unit maximum encapsulation memory and initial picture group maximum encapsulation memory.

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

[0046] The initial frame unit maximum encapsulation memory and the initial picture group maximum encapsulation memory can be values set by a user received by the network video recorder, or values determined by the network video recorder according to total memory and bandwidth, which are not limited in the present application.

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

[0048] A1: Obtain total memory and bandwidth.

[0049] The total memory and the bandwidth of different network video recorders are different. 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 codec memory.

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

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

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

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

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

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

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

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

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

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

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

[0062] In the embodiments of the present application, the preset bandwidth weight can be used to represent the importance of the wide occupancy in the calculation of the resource usage, and the preset memory weight can be used to represent the importance of the memory usage in the calculation of the resource usage. For example, the resource usage can be the sum of the product of the bandwidth occupancy and the bandwidth weight, and the product of the memory usage and the memory weight. Alternatively, the resource usage can also be the bandwidth occupancy or the memory usage. The calculation method of the resource usage is not limited in the embodiments of the present application.

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

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

[0065] In the embodiments of the present application, the network video recorder corrects the initial frame unit maximum encapsulation memory according to the resource usage to obtain the method of the frame unit maximum encapsulation memory, which can be:

[0066] B1: obtaining a frame unit minimum encapsulation memory.

[0067] The frame unit minimum encapsulation memory can be the minimum value of the frame unit maximum encapsulation memory obtained after the initial frame unit maximum encapsulation memory is corrected, that is, the minimum value of the frame unit maximum encapsulation memory is not less than the frame unit minimum encapsulation memory.

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

[0069] The frame unit minimum encapsulation memory can be a value set by the user according to the video stream of the IPC, or other values smaller than the frame unit maximum encapsulation memory, which is not limited in the present application.

[0070] B2: subtracting the difference between the initial frame unit maximum encapsulation memory and the frame unit minimum encapsulation memory to determine the frame unit memory difference.

[0071] In the embodiments of the present application, the frame unit memory difference can be: initial frame unit maximum encapsulation memory - frame unit minimum encapsulation memory.

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

[0073] B3: determining a residual resource usage rate, the residual resource usage rate being 1 minus the difference of the resource usage rate.

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

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

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

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

[0078] In the technical solution provided by the embodiment of the present application, the higher the resource usage rate, the higher the memory usage rate and / or bandwidth occupancy rate of the network video recorder, and the encoding and decoding memory of the network video recorder is insufficient, so that the network video recorder cannot store a frame unit that is too large. It can be understood that when the encoding and decoding memory of the network video recorder is insufficient, the smaller the single frame unit, the more frame units that can be stored by the network video recorder. The technical solution provided by the embodiment of the present application can improve the encapsulation number of frame units by reducing the frame unit maximum encapsulation memory when the encoding and decoding 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 usage rate, the lower the memory usage rate and / or bandwidth occupancy rate of the network video recorder, and the encoding and decoding memory of the network video recorder is in a sufficient state, so that the network video recorder has enough memory to store a larger frame unit. The technical solution provided by the embodiment of the present application can store a larger frame unit by increasing the frame unit maximum encapsulation memory when the encoding and decoding memory of the network video recorder is in a sufficient state, thereby reducing the number of lost frame units and reducing the loss rate of video information, and improving user experience.

[0080] Step S104: correcting the initial picture group maximum encapsulation memory according to the resource usage rate to obtain a picture group maximum encapsulation memory, the picture group maximum encapsulation memory being negatively correlated with the resource usage rate.

[0081] In the embodiments of the present application, the network video recorder corrects the initial picture group maximum encapsulation memory according to the resource usage, and the method for obtaining the picture group maximum encapsulation memory can be as follows:

[0082] C1: Obtain the picture group minimum encapsulation memory.

[0083] The picture group minimum encapsulation memory can be the minimum value of the picture group maximum encapsulation memory obtained after the initial picture group maximum encapsulation memory is corrected, that is, the picture group maximum encapsulation memory minimum is not less than the picture group minimum encapsulation memory.

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

[0085] The picture group minimum encapsulation memory can be a value set by the user according to the video stream of the IPC, or other values less than the picture group maximum encapsulation memory, which is not limited in the present application.

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

[0087] C2: Determine the picture group memory difference by subtracting the picture group minimum encapsulation memory from the initial picture group maximum encapsulation memory.

[0088] In the embodiments of the present application, the picture group memory difference can be: initial picture group maximum encapsulation memory-picture group minimum encapsulation memory.

[0089] For example, if the initial picture group maximum encapsulation memory is 8 MB and the picture group minimum encapsulation memory is 4 MB, the picture group memory difference is: 8-4=4 MB.

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

[0091] In the embodiments of the present application, the picture group maximum encapsulation memory can be: picture group memory difference x (1-resource usage)+picture group minimum encapsulation memory.

[0092] For example, if the picture group memory difference is 4 MB, the resource usage is 64%, and the picture group minimum encapsulation memory is 4 MB, the picture group maximum encapsulation memory is: 4 x (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, and the frame unit minimum encapsulation memory is less than or equal to the picture group minimum encapsulation memory. When the resource usage rate is 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 embodiments of the present application, the picture group maximum encapsulation memory is negatively correlated with the resource usage rate. That is, the higher the resource usage rate is, the smaller the picture group maximum encapsulation memory is, and the lower the resource usage rate is, the larger the picture group maximum encapsulation memory is.

[0095] In the technical solutions provided by the embodiments of the present application, the higher the resource usage rate is, the higher the memory usage rate and / or the bandwidth occupancy rate of the network video recorder is, and the encoding and decoding memory of the network video recorder is insufficient, so that the network video recorder cannot store a picture group that is too large. It can be understood that, when the encoding and decoding memory of the network video recorder is insufficient, the smaller the single picture group is, the more the number of picture groups that can be stored by the network video recorder is. The technical solutions provided by the embodiments of the present application can improve the number of encapsulated picture groups by reducing the picture group maximum encapsulation memory when the encoding and decoding memory of the network video recorder is insufficient, thereby reducing the loss rate of video information and improving the rationality of memory allocation of the network video recorder, and improving the user experience.

[0096] The lower the resource usage rate is, the lower the memory usage rate and / or the bandwidth occupancy rate of the network video recorder is, and the encoding and decoding memory of the network video recorder is in a sufficient state, so that the network video recorder has enough memory to store a picture group that is relatively large. The technical solutions provided by the embodiments of the present application can store a picture group that is relatively large by increasing the picture group maximum encapsulation memory when the encoding and decoding memory of the network video recorder is in a sufficient state, thereby reducing the number of lost picture groups, reducing the loss rate of video information, improving the rationality of memory allocation of the network video recorder, and improving the user experience.

[0097] In the technical solutions provided by the embodiments of the present application, the network video recorder can real-time correct the frame unit maximum encapsulation memory and the picture group maximum encapsulation memory according to the resource usage rate, thereby fully utilizing the device resources and improving the user experience.

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

[0099] It can be understood that when the maximum encapsulation memory of the frame unit is increased, the one or more frame units in the encapsulated picture group will be increased, and the network video recorder can increase the decoding memory so that the one or more frame units in the encapsulated picture group are successfully decoded, thereby avoiding the situation that the video frame cannot be decoded.

[0100] In the technical scheme provided by the embodiments of the present application, the network video recorder can encapsulate and decode the received 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 can include the following steps. Figure 2

[0101] Step S201: Obtain the maximum encapsulation memory of the frame unit and the maximum encapsulation memory of the picture group. 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 embodiments 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 repeated here.

[0103] Step S202: In response to receiving the first data packet, determine a first memory required for storing the first data packet.

[0104] The network video recorder can establish a communication connection with multiple IPCs to receive the 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 embodiments of the present application take one of the IPCs as an example for illustrative description. It can be understood that the network video recorder encapsulates and decodes the data packets sent by other IPCs by the same or similar principle, which will not be repeated 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 embodiments 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. If the first memory is less than or equal to the maximum encapsulation memory of the frame unit, the network video recorder encapsulates the first data packet to obtain a first frame unit. If the first memory is greater than the maximum encapsulation memory of the frame unit, the network video recorder discards the first data packet.

[0107] ​For example, if the first memory is 3MB and the maximum encapsulation memory of the frame unit is 3.44MB, 3MB < 3.44MB, the network video recorder encapsulates the first data packet to obtain the first frame unit. If the first memory is 4MB and the maximum encapsulation memory of the frame unit is 3.44MB, 4MB > 3.44MB, the network video recorder discards the first data packet.

[0108] Step S204: If the first frame unit satisfies the independent encapsulation condition, the first frame unit is encapsulated to obtain the first picture group, and the second memory required by the first picture group is less than the maximum encapsulation memory of the picture group.

[0109] In the embodiments of the present application, the independent encapsulation condition can include:

[0110] Condition 1: The third memory required for storing the first frame unit is greater than or equal to the minimum encapsulation 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 encapsulates 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. In order to ensure that the network video recorder can successfully decode the picture group containing the first frame unit, the network video recorder separately packs the first frame unit into a picture group.

[0113] Specifically, the network video recorder can update the encapsulation state of the fourth picture group in encapsulation to encapsulation end. 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 adjacent to the fourth picture group. The first picture group contains the first frame unit and does not contain other frame units.

[0114] In the embodiments of the present application, if the first frame unit does not satisfy the independent encapsulation condition, that is, the first frame unit cannot satisfy both Condition 1 and Condition 2, the network video recorder determines the remaining memory obtained by subtracting the memory occupied by the second picture group from the maximum encapsulation memory of the 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 in encapsulation. If the remaining memory is less than the third memory, a third picture group is newly created, the first frame unit is encapsulated into the third picture group, the encapsulation state of the second picture group is updated to encapsulation end, the encapsulation state of the third picture group is set to encapsulation, and the third picture group is located after the second picture group and adjacent to the second picture group.

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

[0116] In the embodiments of the present application, after the network video recorder real-time corrects the frame unit maximum encapsulation memory, the network video recorder encapsulates the first data packet according to the corrected frame unit maximum encapsulation memory, obtains a picture group containing the first data packet, and then corrects the decoding memory. Alternatively, the network video recorder can also real-time correct the decoding memory according to the frame unit maximum encapsulation memory. The present application does not limit this.

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

[0118] It can be understood that the network video recorder can also encapsulate and decode a second data packet after the first data packet according to the real-time corrected frame unit maximum encapsulation memory and picture group maximum encapsulation memory. 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 the network video recorder to encapsulate and decode the first data packet, and the present application does not repeat the description.

[0119] In the technical scheme provided by the embodiments of the present application, the network video recorder can obtain the real-time corrected frame unit maximum encapsulation memory and picture group maximum encapsulation memory, and when the first memory required to store the first data packet is less than or equal to the frame unit maximum encapsulation memory, the network video recorder encapsulates the first data packet to obtain a first frame unit. When the first frame unit satisfies the independent encapsulation condition, the network video recorder encapsulates the first frame unit to obtain a first picture group. The decoding memory is corrected according to the real-time corrected frame unit maximum encapsulation memory, and the first picture group is decoded through the corrected decoding memory. This can improve the resource usage rate, enable one or more frame units in the encapsulated picture group to be successfully decoded, and avoid the situation that the video frame cannot be decoded.

[0120] It should be understood that, without logical conflicts, each of the above embodiments can be combined with each other to adapt to actual application requirements. The specific embodiments or implementation schemes obtained by the combination still belong to the protection scope of the present application.

[0121] Corresponding to the video frame packaging method in the above embodiment, an embodiment of the present application provides a video frame packaging device, which can be realized by software, hardware or a combination of both as part or all of a computer device, for executing the steps in the video frame packaging method in the above embodiment.

[0122] Figure 3 A structure diagram of a packaging device 30 provided by an embodiment of the present application is shown, and only parts related to the embodiment of the present application are shown for ease of illustration.

[0123] With reference to 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 configured to acquire a frame unit maximum packaging memory and a picture group maximum packaging memory, and the frame unit maximum packaging memory and the picture group maximum packaging memory are negatively correlated with a resource usage rate.

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

[0126] The packaging module 330 is configured to package the first data packet to obtain a first frame unit when the first memory is less than or equal to the frame unit maximum packaging memory.

[0127] The packaging module 330 is further configured to package the first frame unit to obtain a first picture group when the first frame unit satisfies an independent packaging condition, and a second memory required for the first picture group is less than the picture group maximum packaging memory.

[0128] In some embodiments, the acquisition module 310 is specifically configured to acquire an initial frame unit maximum packaging memory and an initial picture group maximum packaging memory. A resource usage rate is determined according to a bandwidth occupancy rate, a preset bandwidth weight, a memory usage rate and a preset memory weight, and the bandwidth occupancy rate and the memory usage rate are positively correlated with the resource usage rate. The initial frame unit maximum packaging memory is corrected according to the resource usage rate to obtain the frame unit maximum packaging memory, and the frame unit maximum packaging memory is negatively correlated with the resource usage rate. The initial picture group maximum packaging memory is corrected according to the resource usage rate to obtain the picture group maximum packaging memory, and the picture group maximum packaging memory is negatively correlated with the resource usage rate.

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

[0130] In some embodiments, the obtaining module 310 is specifically configured to: obtain a frame unit minimum encapsulation memory. Determine a difference between an initial frame unit maximum encapsulation memory and the frame unit minimum encapsulation memory as a frame unit memory difference. Add a product of a complement of the resource usage rate and the frame unit memory difference to the frame unit minimum encapsulation memory to obtain the frame unit maximum encapsulation memory. Obtain a GOP minimum encapsulation memory. Determine a difference between an initial GOP maximum encapsulation memory and the GOP minimum encapsulation memory as a GOP memory difference. Add a product of a complement of the resource usage rate and the GOP memory difference to the GOP minimum encapsulation memory to obtain the GOP maximum encapsulation memory.

[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 frame unit minimum encapsulation memory, and the first frame unit is an intra-coded frame.

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

[0133] In some embodiments, the encapsulating module 330 is specifically configured to: when the first frame unit satisfies the independent encapsulation condition, update an encapsulation state of a fourth GOP in encapsulation to encapsulation end. Encapsulate the first frame unit to obtain a first GOP, and set the encapsation state of the first GOP to encapsation end, the first GOP is after the fourth GOP and adjacent to the fourth GOP, the first GOP contains the first frame unit and does not contain other frame units.

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

[0135] In some embodiments, the decoding memory is equal to the frame unit maximum encapsulation memory.

[0136] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0137] It should be understood that the sequence number of each step in the above embodiments does not imply 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 this application.

[0138] Based on the same inventive concept, embodiments of this application also provide an electronic device.

[0139] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. For example... Figure 4 As shown, the electronic device 4 of this embodiment includes: at least one processor 410 ( Figure 4 Only one is shown in the diagram), memory 420, and communication module 440. Memory 420 stores a computer program 430 that may run on processor 410. When processor 410 executes computer program 430, it implements the steps in the above-described video frame encapsulation method embodiment, for example... Figure 2 Steps 201 to 204 are shown. Alternatively, when the processor 410 executes the computer program 430, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 3 The functions of modules 310 to 340 are shown. The communication module 440 can be a separate communication unit used to communicate with external servers or terminal devices.

[0140] Electronic device 4 may include, but is not limited to, a processor 410 and a memory 420. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 4 may also include input transmitting devices, network access devices, buses, etc.

[0141] The processor 410 can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0142] The memory 420 can be an internal storage unit of the electronic device 4 in some embodiments, for example, a hard disk or a memory of the electronic device 4. The memory 420 can also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 420 can also include both the internal storage unit and the external storage device of the electronic device 4. The memory 420 is used to store an operating system, an application program, a boot loader, data, and other programs, etc., for example, program codes of the computer program 430, etc. The memory 420 can also be used to temporarily store data that has been transmitted or will be transmitted.

[0143] In addition, it can be clearly understood by those skilled in the art that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example for description, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is 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 in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0144] The embodiments of the present application provide 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 each method embodiment described above.

[0145] The embodiment of the present application provides a chip, the chip includes a processor and a memory, the computer program is stored in the memory, and the computer program is executed by the processor to realize the steps in each method embodiment.

[0146] The embodiment of the present application provides a computer program product, when the computer program product runs on an electronic device, the electronic device executes the steps in each method embodiment.

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

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

[0149] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit, and the integrated unit can be realized in the form of hardware or software. In addition, the specific name of each functional unit and module is only for easy distinction, and does not limit the protection scope of the present application. The specific working process of the unit and module in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0150] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0151] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0152] In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. For example, the above-described system embodiments are merely illustrative. For example, the division of the modules or units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0153] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0154] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically independently, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0155] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application can implement all or part of the processes in the above-mentioned embodiment methods through a computer program to instruct related hardware to complete, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the large screen device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.

[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 to this, any change or replacement within the technical scope disclosed in the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of video frame packing, characterized by, The method comprises: acquiring a frame unit maximum encapsulation memory and a picture group maximum encapsulation memory, the frame unit maximum encapsulation memory and the picture group maximum encapsulation memory are negatively correlated with resource usage rate; in response to receiving a first data packet, determining a first memory required for storing the first data packet; if the first memory is less than or equal to the frame unit maximum encapsulation memory, encapsulating the first data packet to obtain a first frame unit; if the first frame unit satisfies an independent encapsulation condition, encapsulating the first frame unit to obtain a first picture group, a second memory required for the first picture group is less than the picture group maximum encapsulation memory.

2. The video frame packing method of claim 1, wherein, The acquiring of the frame unit maximum encapsulation memory and the picture group maximum encapsulation memory comprises: acquiring an initial frame unit maximum encapsulation memory and an initial picture group maximum encapsulation memory; determining a resource usage rate according to a bandwidth occupation rate, a preset bandwidth weight, a memory usage rate and a preset memory weight, the resource usage rate is positively correlated with the bandwidth occupation rate and the memory usage rate; correcting the initial frame unit maximum encapsulation memory according to the resource usage rate to obtain the frame unit maximum encapsulation memory, the frame unit maximum encapsulation memory is negatively correlated with the resource usage rate; correcting the initial picture group maximum encapsulation memory according to the resource usage rate to obtain the picture group maximum encapsulation memory, the picture group maximum encapsulation memory is negatively correlated with the resource usage rate.

3. The video frame packing method of claim 2, wherein, The resource usage rate is a sum of a product of the bandwidth occupation rate and the bandwidth weight and a product of the memory usage rate and the memory weight.

4. The video frame packing method of claim 2, wherein, The correcting of the initial frame unit maximum encapsulation memory according to the resource usage rate to obtain the frame unit maximum encapsulation memory comprises: acquiring a frame unit minimum encapsulation memory; determining a frame unit memory difference by subtracting the frame unit minimum encapsulation memory from the initial frame unit maximum encapsulation memory; determining a residual resource usage rate, the residual resource usage rate is a difference of 1 minus the resource usage rate; adding a product of the residual resource usage rate and the frame unit memory difference to the frame unit minimum encapsulation memory to obtain the frame unit maximum encapsulation memory. The correcting of the initial picture group maximum encapsulation memory according to the resource usage rate to obtain the picture group maximum encapsulation memory comprises: acquiring a picture group minimum encapsulation memory; determining a picture group memory difference by subtracting the picture group minimum encapsulation memory from the initial picture group maximum encapsulation memory; adding a product of the residual resource usage rate and the picture group memory difference to the picture group minimum encapsulation memory to obtain the picture group maximum encapsulation memory.

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

6. The video frame packing method of claim 5, wherein, The method further comprises: if the first frame unit does not satisfy the independent encapsulation condition, determining a difference of the picture group maximum encapsulation memory minus a memory occupied by a second picture group as residual memory of the second picture group, and an encapsulation state of the second picture group is encapsulating. if the remaining memory is greater than or equal to the third memory, then the first frame unit is encapsulated into the second picture group; if the remaining memory is less than the third memory, then a third picture group is newly created, the first frame unit is encapsulated into the third picture group, an encapsulation state of the second picture group is updated to encapsulation end, an encapsulation state of the third picture group is set to encapsulation in progress, the third picture group is after the second picture group and adjacent to the second picture group.

7. The video frame packing method of claim 6, wherein, The method further comprises: if the first frame unit satisfies the independent encapsulation condition, then an encapsulation state of a fourth picture group in encapsulation is updated to encapsulation end; The first frame unit is encapsulated to obtain the first picture group, and an encapsulation state of the first picture group is set to encapsulation end, the first picture group is after the fourth picture group and adjacent to the fourth picture group, the first picture group contains the first frame unit and does not contain other frame units.

8. The video frame packing method of claim 7, wherein, The method further comprises: The frame unit maximum encapsulation memory is positively correlated with the decoding memory; The decoding memory is used to decode the first picture group, the second picture group, the third picture group or the fourth picture group to obtain a first video, a second video, a third video or a fourth video, 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 packing method of claim 8, wherein, The decoding memory is equal to the frame unit maximum encapsulation memory.

10. An electronic device, comprising: The computer program is executed by the processor to realize the method as claimed in any one of claims 1-9.

11. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: The computer program is executed by the processor to realize the method as claimed in any one of claims 1-9.

Citation Information

Patent Citations

  • Video recording data packaging method and device

    CN110248205A

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

    CN118488023A