A video data storage method, an electronic device, and a storage medium
Patent Information
- Application Number
- CN202611342050.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-10-27
AI Technical Summary
[0015]区别于当前技术,本申请的技术方案,通过获取视频数据的事件信息和对应的目标存储通道的状态类型,进而进行预调整编码信息,得到预调整所对应的第二编码能力,再将预调整之后所有存储通道的编码能力之和与总编码能力比较,以确保不超过总编码能力;即降低部分存储通道非关键时段的帧率、码率,提升I帧间隔,节省编码资源,同时对部分存储通道关键时刻提升编码帧率,确保实时性和画面流畅性,降低同等条件下的视频数据的存储空间,最大化使用了设备编码能力,满足了所有存储通道满帧率编码的能力,提高了硬盘的使用效率,延长了视频数据的保存时长。
Smart Images

Figure CN122994444A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of hard disk storage, and in particular to a video data storage method, electronic device, and storage medium. Background Technology
[0002] In video data storage, hard disk recording storage devices need to support real-time video data storage across multiple channels. Users have high requirements for the smoothness and image quality of video data and want to extend the storage time of video data files under the same storage conditions. This is especially true when critical events occur, such as the appearance of people or vehicles, where the smoothness and real-time performance of video data files are even more critical.
[0003] However, existing hard disk video recording storage devices have limited encoding capabilities, making it impossible for all channels of video acquisition devices to achieve the highest smoothness and real-time performance. It is also difficult to achieve full frame rate storage at the same resolution. Furthermore, they fail to effectively solve the problem of how to balance the storage needs of each channel when the total encoding capability of the device is limited, and they occupy a large amount of storage space, which limits the performance of video data storage. Summary of the Invention
[0004] The technical solution that this application mainly addresses is to provide a video data storage method, electronic device, and storage medium that dynamically adjusts the encoding capability of the storage channel to ensure the smoothness and real-time performance of video data files while reducing the storage space required for video data, thereby improving the performance of video data storage.
[0005] To solve the above-mentioned technical problems, this application adopts the following technical solution: A video data storage method is provided, applied to a storage device. The storage device has multiple storage channels, each storage channel corresponding to video data from a video acquisition device. Each storage channel has a first encoding capability, and the storage device has a total encoding capability. The method includes: acquiring event information of the video data to be stored and the state type of the target storage channel corresponding to the event information; pre-adjusting the first encoding information of the target storage channel according to the state type to obtain a second encoding capability of the target storage channel, wherein the first encoding information includes at least one of a first bitrate, a first frame rate, and a first I-frame interval; and storing the video data according to the pre-adjusted first encoding information in response to the total encoding capability being not less than the sum of all other first encoding capabilities and the second encoding capability, wherein all other first encoding capabilities are the encoding capabilities of storage channels other than the target storage channel.
[0006] In some embodiments, the state type includes an excited state, a fallen state, and a static state; the event information includes a first identification event, a second identification event, and a third identification event; the step of acquiring the event information of the video data to be stored and the state type of the target storage channel corresponding to the event information includes: acquiring the degree of image change in the video data; in response to the degree of image change being greater than a first threshold, setting the event information corresponding to the video data as the first identification event and setting the state type of the target storage channel corresponding to the first identification event as the excited state; or in response to the degree of image change being less than the first threshold and greater than a second threshold, setting the event information corresponding to the video data as the second identification event and setting the state type of the target storage channel corresponding to the second identification event as the fallen state; or in response to the degree of image change being in a static state, setting the event information corresponding to the video data as the third identification event and setting the state type of the target storage channel corresponding to the third identification event as the static state.
[0007] In some embodiments, the step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: in response to the state type of the target storage channel being an excited state, increasing the first I-frame interval supported by the target storage channel; and determining the second encoding capability of the target storage channel with the increased first I-frame interval, the first frame rate, and the first bit rate.
[0008] In some embodiments, the step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: in response to the state type of the target storage channel being a fallback state, reducing the first bit rate and the first frame rate by a first value; and determining the second encoding capability of the target storage channel by using the first I-frame interval, reducing the first bit rate and the first frame rate by the first value.
[0009] In some embodiments, the step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: in response to the state type of the target storage channel being a static state, reducing the first bit rate and the first frame rate by a second value, wherein the second value is greater than the first value corresponding to the state type being a fallback state; and determining the second encoding capability of the target storage channel by using the first I-frame interval, reducing the first bit rate and the first frame rate by the second value.
[0010] In some embodiments, storing the video data according to the pre-adjusted first encoding information in response to the total encoding capability being not less than the sum of all other first encoding capabilities and second encoding capabilities includes: modifying the first encoding information of the target storage channel in response to the total encoding capability being not less than the sum of all other first encoding capabilities and second encoding capabilities; and storing the video data with the modified first encoding information.
[0011] In some embodiments, the method further includes: in response to the total coding capability being less than the sum of all other first coding capabilities and second coding capabilities, setting the state type of the target storage channel to a fallback state; increasing the first I-frame interval and / or decreasing the first frame rate and / or decreasing the first bit rate; and determining the second coding capability of the target storage channel using the increased first I-frame interval, and / or decreased first frame rate, and / or decreased first bit rate.
[0012] In some embodiments, the first frame rate and the first bit rate are reduced by using a first value and / or a second value, wherein the first value and the second value are proportional.
[0013] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide an electronic device, which includes a memory and a processor coupled to the memory. The memory stores at least one computer program, which, when loaded and executed by the processor, is used to implement the method described above.
[0014] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium having at least one program, which, when loaded and executed by a processor, is used to implement the method described above.
[0015] Unlike current technologies, the technical solution of this application obtains event information of video data and the status type of the corresponding target storage channel, and then performs pre-adjustment encoding information to obtain the second encoding capability corresponding to the pre-adjustment. Then, the sum of the encoding capabilities of all storage channels after pre-adjustment is compared with the total encoding capability to ensure that it does not exceed the total encoding capability. That is, the frame rate and bit rate of some storage channels during non-critical periods are reduced, the I-frame interval is increased, and encoding resources are saved. At the same time, the encoding frame rate of some storage channels during critical periods is increased to ensure real-time performance and smooth picture, reduce the storage space of video data under the same conditions, maximize the use of device encoding capabilities, meet the full frame rate encoding capability of all storage channels, improve hard disk utilization efficiency, and extend the storage time of video data. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart illustrating an embodiment of the video data storage method in this application; Figure 2 This is a schematic diagram of the structure of an embodiment of the electronic device in this application; Figure 3 This is a schematic diagram of an embodiment of a computer-readable storage medium in this application. Detailed Implementation
[0017] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be particularly noted that the following embodiments are for illustrative purposes only and do not limit the scope of the invention. Similarly, the following embodiments are only some, not all, embodiments of the present invention, and all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0019] In existing hard disk video recording (HDD) storage devices, multiple storage channels are typically configured, each corresponding to the video data from a video acquisition device (such as a network camera). Each channel is assigned a fixed set of encoding parameters at the factory or during initialization, including frame rate, bit rate, and I-frame interval (i.e., image group length). These parameters collectively determine the encoding capability of that channel. Simultaneously, the device as a whole has a total encoding capability, determined by hardware resources, such as the processing power of the codec chip, and allocated as needed among the channels. In traditional implementations, the encoding parameters of each channel are usually statically configured, meaning that regardless of changes in the scene content, the channel always records and encodes at a fixed frame rate, bit rate, and I-frame interval. While this static configuration method is simple to implement, it cannot adapt to the dynamic changes in the video content of actual monitoring scenarios. For example, during static periods with no people or vehicles, the channel still encodes at a high frame rate and high bit rate, resulting in a significant waste of storage space; while at critical moments when people or vehicles appear, if the channel's encoding capability is insufficient, the smoothness and real-time performance of the recording may not be guaranteed.
[0020] The drawback of the aforementioned static configuration method is that it fails to fully utilize the device's total encoding capacity. Because the encoding parameters for each channel are fixed, the device cannot dynamically adjust the resource allocation for each channel according to the actual scenario. This results in some channels consuming excessive encoding resources during static periods, while other channels are unable to improve encoding quality due to insufficient resources at critical moments. Furthermore, traditional event-triggered recording strategies typically only reduce the frame rate while maintaining the bitrate and I-frame interval. While this method can reduce storage space to some extent, its effect is limited and may affect the smoothness of recording and the preservation of critical details. In actual processing chains, this static or single-dimensional adjustment method leads to low storage space utilization and shortens the retention time of the corresponding video files, failing to meet users' dual needs for long-term recording and high-quality playback under limited storage conditions.
[0021] Existing hard disk video recording storage devices have limited encoding capabilities, making it impossible for all channels of video acquisition devices to achieve the highest smoothness and real-time performance, and making it difficult to achieve full frame rate storage at the same resolution.
[0022] Therefore, a video data storage method is provided that reduces the storage space of video data under the same conditions, maximizes the use of device encoding capabilities, satisfies the full frame rate encoding capability of all storage channels, improves hard disk utilization efficiency, and extends the storage time of video data.
[0023] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the video data storage method in this application; it should be noted that, if there are substantial results, the method of this application does not necessarily reflect the actual situation. Figure 1 The sequence of processes shown is limited.
[0024] like Figure 1 As shown, the video data storage method in this application is applied to a storage device. The storage device has multiple storage channels, each storage channel corresponds to video data of a video acquisition device, each storage channel has a first encoding capability, and the storage device has a total encoding capability. The video data storage method in this application may include the following operations.
[0025] S110. Obtain the event information of the video data to be stored and the status type of the target storage channel corresponding to the event information.
[0026] Among them, event information is used to characterize whether specific activity content appears in video data. For example, when the degree of change in the picture exceeds a certain threshold, it is determined as the first recognition event that a person or vehicle has appeared. The state type is a qualitative description of the encoding strategy that should be adopted by the target storage channel, such as excited state, fallback state or static state. The target storage channel refers to the storage channel corresponding to the current video data.
[0027] Specifically, the system acquires the video data to be stored in real time, with each storage channel corresponding to only one video acquisition device's video data; and acquires the event information in each video data, as well as the status type of the target storage channel corresponding to the event information.
[0028] S120. The first encoding information of the target storage channel is pre-adjusted according to the state type to obtain the second encoding capability of the target storage channel, wherein the first encoding information includes at least one of a first bit rate, a first frame rate and a first I-frame interval.
[0029] The pre-adjustment process does not directly modify the encoding parameters used in actual storage. Instead, it first calculates an adjusted encoding capability value, namely the second encoding capability, based on the state type. This capability value serves as an estimate of the encoding resources that the target storage channel may occupy after adjustment. The first encoding information includes at least one of the first bit rate, the first frame rate, and the first I-frame interval. The second encoding capability is the actual encoding resource requirement determined based on the adjusted bit rate, frame rate, and I-frame interval.
[0030] Specifically, after obtaining the state type of the target storage channel, the first encoding information of the target storage channel is pre-adjusted differently depending on the state type. For example, when the state type is static, the first bit rate and first frame rate can be reduced in advance, and the first I-frame interval can be increased, thereby obtaining a lower second encoding capability; while when the state type is active, the first I-frame interval may be increased or a high bit rate may be maintained to obtain a higher second encoding capability. That is, using the state type as input, and after passing through preset parameter adjustment rules, the second encoding capability is output, which will be used for subsequent encoding resource allocation decisions.
[0031] S130, in response to the total coding capability being not less than the sum of all other first coding capabilities and second coding capabilities, the video data is stored according to the pre-adjusted first coding information, wherein all other first coding capabilities are the coding capabilities of storage channels other than the target storage channel.
[0032] The total coding capability refers to the total coding capability of the storage device; the first coding capability refers to the preset coding capability of the storage channel, that is, the preset first bit rate, first frame rate and first I-frame interval for each storage channel, and the coding capability determined by the first bit rate, first frame rate and first I-frame interval is the first coding capability.
[0033] Specifically, the first encoding capability of all storage channels other than the current target storage channel is obtained, the first encoding capability of all other storage channels is added to the second encoding capability of the current target storage channel, and then compared with the total encoding capability of the storage device; if the total encoding capability is not less than the sum of the first and second encoding capabilities of all other channels, it indicates that the pre-adjustment scheme is feasible, and at this time, the video data is stored directly according to the adjusted first encoding information.
[0034] This judgment condition ensures that after adjusting the encoding capacity of the target storage channel, the total encoding demand of all channels will not exceed the total encoding capacity of the device, thereby avoiding resource overload. If this condition is met, the pre-adjustment scheme is feasible, and the video data storage is performed directly according to the adjusted first encoding information; if it is not met, the pre-adjustment scheme needs to be further downgraded.
[0035] In other words, before performing storage, it is necessary to determine whether the current total encoding capacity is sufficient to simultaneously handle the regular encoding needs of all other channels and the adjusted encoding needs of the target channel. If the capacity is sufficient, pre-adjustment is allowed, that is, the video data is stored according to the adjusted first encoding information; if the capacity is insufficient, no adjustment is implemented or a degradation scheme is adopted; by dynamically adjusting the encoding parameters of the target channel, within the range allowed by the total encoding capacity, the recording quality of the target channel at critical moments is guaranteed, while the storage space is saved by adjusting the encoding resource usage during non-critical periods, and the system abnormality caused by exceeding the total capacity of the equipment is avoided.
[0036] For example, in one specific embodiment, the storage device is a hard disk recorder with eight storage channels, each channel connected to a 1080p resolution video acquisition device, such as a network camera. Each channel has the same first encoding capability: a frame rate of 25fps, a bitrate of 4Mbps, and an I-frame interval of 25 frames. The total encoding capability of the device is 120Mbps. When the target channel detects an intruder, the state type is set to the active state, and the pre-adjusted second encoding capability is a frame rate of 25fps, a bitrate of 4Mbps, and an I-frame interval of 50 frames. At this time, the sum of the first encoding capabilities of the other seven channels is 7 × 4Mbps = 28Mbps, and the second encoding capability is 4Mbps, resulting in a total requirement of 32Mbps, which is less than 120Mbps. Therefore, storage is performed according to the adjusted first encoding information, preserving key details while reducing storage space due to the increased I-frame interval.
[0037] For example, in another specific embodiment, the storage device is an embedded recording device with four storage channels, each channel connected to a 4K resolution camera. The first encoding capability of each channel is a frame rate of 30fps, a bit rate of 8Mbps, and an I-frame interval of 30 frames, for a total device encoding capability of 40Mbps. When the target channel's image is static, the state type is set to static, and the pre-adjusted second encoding capability is a frame rate of 10fps, a bit rate of 2Mbps, and an I-frame interval of 60 frames. The sum of the first encoding capabilities of the other three channels is 3 × 8Mbps = 24Mbps, and the second encoding capability is 2Mbps, for a total requirement of 26Mbps, which is less than 40Mbps. Therefore, storage is performed according to the adjusted first encoding information, significantly reducing storage space when the image is static without affecting the user's viewing experience of the static image.
[0038] In this embodiment, the frame rate and bit rate are reduced during non-critical periods in some storage channels, the I-frame interval is increased, and encoding resources are saved. Simultaneously, the encoding frame rate is increased during critical periods in some storage channels to ensure real-time performance and smooth video playback. This reduces the storage space required for video data under the same conditions, maximizes the use of the device's encoding capabilities, satisfies the full frame rate encoding capability of all storage channels, improves hard drive efficiency, and extends the storage duration of video data. In other words, this technical solution achieves dynamic allocation of encoding resources, ensuring image quality and smoothness during critical periods while reducing storage space usage during non-critical periods.
[0039] In some embodiments, the state types include excited state, falling state, and quiescent state; the event information includes a first identification event, a second identification event, and a third identification event.
[0040] Among them, the excited state refers to the state set by the current storage channel for the triggered event when the screen corresponding to the storage channel becomes dynamic, such as triggering a recognition event; the fallen state refers to the state set by the current storage channel for a period of time after the triggered event when the screen corresponding to the storage channel becomes dynamic and no new event is triggered; the static state refers to the state set by the current storage channel for the frozen screen when no event is triggered.
[0041] The first recognition event refers to identifying a specific object or behavior based on target recognition and semantic understanding, using deep learning algorithms; for example, identifying pedestrians, vehicles, animals, or behaviors such as crossing boundaries, loitering, or leaving items behind through target detection and behavior analysis. The second recognition event refers to pixel-level image change analysis, such as comparing pixel differences in brightness and color between consecutive frames. The third recognition event refers to video data where the image remains unchanged.
[0042] Then, the event information for the video data to be stored and the status type of the target storage channel corresponding to the event information can be obtained, which may include the following:
[0043] To obtain the degree of change in the video data.
[0044] In response to a change in the image exceeding a first threshold, the event information corresponding to the video data is set as the first recognition event, and the state type of the target storage channel corresponding to the first recognition event is set to the excited state.
[0045] Alternatively, in response to a change in the image that is less than a first threshold but greater than a second threshold, the event information corresponding to the video data is set as a second recognition event, and the state type of the target storage channel corresponding to the second recognition event is set to fallback state.
[0046] Alternatively, in response to a static state where the degree of change in the image is static, the event information corresponding to the video data is set as the third recognition event, and the state type of the target storage channel corresponding to the third recognition event is set to static.
[0047] The degree of image change refers to the magnitude of pixel changes in the video data. The first threshold is determined by deep learning algorithms, such as object detection and behavior analysis, to identify specific objects or behaviors, such as people, vehicles, animals crossing boundaries, wandering, leaving behind objects, etc., and is used to filter out invalid movements, such as ignoring the swaying of leaves. The second threshold is less than the first threshold and is determined based on pixel-level image change analysis. It can be the area of change or sensitivity, and is used to filter out other movements that are not determined by the first threshold.
[0048] Specifically, by using the objective quantitative indicator of the degree of image change, video content is divided into three states with different encoding requirements, thus providing a basis for subsequent adjustments to differentiated encoding parameters. First, the degree of image change in the video data is obtained based on pixels. Then, the degree of image change is compared and analyzed against a first threshold and a second threshold. Event information corresponding to video data with an image change degree greater than the first threshold is set as the first recognition event, and the state type of the target storage channel corresponding to the first recognition event is set to the excited state. Event information corresponding to video data with an image change degree less than the first threshold but greater than the second threshold is set as the second recognition event, and the state type of the target storage channel corresponding to the second recognition event is set to the fallen state. Event information corresponding to video data with a static image change state is set as the third recognition event, and the state type of the target storage channel corresponding to the third recognition event is set to the static state.
[0049] For example: when the degree of image change exceeds a first threshold, it indicates rapid motion or significant change in the image. In this case, a high frame rate and high bit rate are needed to preserve details, so the state is set to the excited state. When the degree of image change is between the first and second thresholds, it indicates moderate change in the image, requiring moderate encoding parameters, so it is set to the fallen-down state. When the degree of image change is zero or extremely low, it indicates that the image is basically still, and a low frame rate and low bit rate can be used to save storage space, so it is set to the still state. In specific implementations, the first and second thresholds can be set according to the actual scene. The first threshold can be set to 30% of the moving pixels in the image, and the second threshold can be set to 5%, with the first threshold being greater than the second threshold. In addition, the degree of image change can be calculated using methods such as inter-frame differencing, background modeling, or optical flow. For another example, the excited state is only triggered when the degree of image change continuously exceeds the first threshold for a preset time (e.g., 0.5 seconds) to avoid instantaneous noise interference. Through the above state classification, the encoding parameters can be dynamically matched with the video content, ensuring the quality of critical images while reducing the storage overhead of non-critical images.
[0050] In some embodiments, storage channels in the excited state can be designated as critical moments, at which time the encoding capability of the corresponding storage channel can be increased to ensure real-time performance and smooth video playback. Storage channels in the fallen-down and static states can be designated as non-critical moments, at which time the encoding capability of the corresponding storage channels can be reduced to save encoding resources. Therefore, by increasing the encoding capability of some channels and decreasing the encoding capability of others, the encoding capability can be dynamically adjusted to meet the full frame rate encoding capability of all channels, thereby improving hard disk utilization efficiency and extending the storage time of video data.
[0051] In some embodiments, the second encoding capability of the target storage channel is obtained by pre-adjusting the first encoding information of the target storage channel according to the state type, which may include the following.
[0052] In response to the target storage channel being in an excited state, the first I-frame interval supported by the target storage channel is increased.
[0053] The second coding capability of the target storage channel is determined by the improved first I-frame interval, first frame rate, and first bit rate.
[0054] When the channel is in the excited state, the picture changes drastically. At this time, appropriately increasing the I-frame interval can reduce the encoding overhead of I-frames while maintaining a high frame rate and high bit rate. This is because the amount of I-frame data is much larger than that of P-frames and B-frames. Increasing the I-frame interval can significantly reduce bit rate consumption, thereby reducing storage space while ensuring smooth picture and detail preservation.
[0055] Specifically, when the state type of the target storage channel is determined to be excited, it is a critical moment that requires maintaining a high frame rate and a high bit rate. Therefore, the first I-frame interval supported by the target storage channel can be appropriately increased to reduce the coding overhead of the I-frame interval. Then, the second coding capability of the target storage channel is determined based on the increased first I-frame interval, first frame rate, and first bit rate.
[0056] For example, assuming the first I-frame interval is 30 frames, it can be increased to 60 frames or higher in the excited state, while keeping the first frame rate (e.g., 30 fps) and first bitrate (e.g., 4 Mbps) unchanged. The second encoding capability is then determined by the increased I-frame interval, the first frame rate, and the first bitrate. In one embodiment, when increasing the first I-frame interval, it can be gradually increased according to a preset step size, for example, increasing by 10 frames each time until reaching the upper limit (e.g., 120 frames) to avoid sudden changes in the image. In another embodiment, the increase can be dynamically adjusted according to the duration of the excited state; for example, the longer the excited state lasts, the greater the increase in the I-frame interval, but not exceeding the maximum limit. Furthermore, after increasing the I-frame interval, the real-time performance of video search must be considered, as an excessively large I-frame interval may lead to keyframe positioning delays. Therefore, a balance must be struck between saving storage space and search efficiency. Thus, in the excited state, high image quality can be maintained while reducing storage usage, and there is no significant impact on the user's viewing experience.
[0057] In some embodiments, the second encoding capability of the target storage channel is obtained by pre-adjusting the first encoding information of the target storage channel according to the state type, which may include the following.
[0058] In response to the target storage channel being in fallback state, the first bitrate and first framerate are reduced by a first value.
[0059] The second coding capability of the target storage channel is determined by the first I-frame interval, the first bit rate reduced by the first value, and the first frame rate.
[0060] When the channel falls back from the excited state to the fallen state, the degree of image change decreases, but there is still some dynamic content. At this time, appropriately reducing the bit rate and frame rate can further save storage space while maintaining the basic clarity and smoothness of the image.
[0061] Specifically, when the state type of the target storage channel is determined to be fallback state, it is a non-critical moment and there is no need to maintain a high frame rate and high bit rate. Therefore, the first frame rate and first bit rate supported by the target storage channel can be appropriately reduced to reduce the encoding overhead of frame rate and bit rate. Then, the second encoding capability of the target storage channel is determined by the first frame rate and first bit rate after the first value is reduced and the original first I-frame interval.
[0062] For example, assuming a first bitrate of 4Mbps and a first frame rate of 30fps, the first value can be 20%-50%. For example, setting it to 20% would result in a reduced bitrate of 3.2Mbps and a frame rate of 24fps, while maintaining the first I-frame interval (e.g., 30 frames) unchanged, thus determining the second encoding capability. In one embodiment, the first value can be dynamically adjusted based on the duration of the fallback state or the degree of image change. For example, the initial reduction in the fallback state is small (e.g., 10%), followed by a gradual increase to a preset value (e.g., 30%) to achieve a smooth transition. In another embodiment, the first value can be set to a fixed percentage, such as 25%, and adjusted in steps to reduce the frame rate, for example, reducing the frame rate by 5fps each time until the target value is reached. Furthermore, when reducing the bitrate and frame rate, care must be taken to avoid noticeable stuttering or blurring. Therefore, adaptive adjustments can be made based on image complexity. For example, when there are many moving areas in the image, the reduction can be appropriately reduced. Thus, a balance can be achieved between saving storage space and image quality in the fallback state, ensuring that critical details are not lost.
[0063] In some embodiments, the second encoding capability of the target storage channel is obtained by pre-adjusting the first encoding information of the target storage channel according to the state type, which may include the following.
[0064] In response to the target storage channel being in a static state, the first bit rate and the first frame rate are reduced by a second value, wherein the second value is greater than the first value corresponding to the fallback state.
[0065] The second coding capability of the target storage channel is determined by the first I-frame interval, the first bit rate and the first frame rate with the second value reduced.
[0066] When the channel is stationary, the image content remains essentially unchanged. At this time, the bit rate and frame rate can be significantly reduced to maximize storage space savings. Meanwhile, since the image is stationary, users are not sensitive to image quality and smoothness, so it will not affect the viewing experience.
[0067] Specifically, when the target storage channel's state type is determined to be static, this can also be considered a non-critical moment, where maintaining a high frame rate and high bit rate is unnecessary. Therefore, the first frame rate and first bit rate supported by the target storage channel can be appropriately reduced to decrease the encoding overhead of frame rate and bit rate. Then, the second encoding capability of the target storage channel is determined by comparing the reduced first frame rate and first bit rate with the original first I-frame interval. Furthermore, the second value is greater than the first value.
[0068] For example, assuming a first bitrate of 4 Mbps and a first frame rate of 30 fps, the second value can range from 50% to 75%. For instance, setting it to 50% would reduce the bitrate to 2 Mbps and the frame rate to 15 fps, while maintaining the first I-frame interval (e.g., 30 frames) unchanged, thus determining the second encoding capability. In one embodiment, the second value could be set to 60%, reducing the frame rate to 12 fps and the bitrate to 1.6 Mbps to further compress storage space. In another embodiment, for completely still footage, the frame rate could even be reduced to 1 fps and the bitrate to 0.5 Mbps, but this must ensure normal playback. Furthermore, the I-frame interval can be appropriately increased in a still state, for example, from 30 frames to 60 frames, to further reduce I-frame overhead, but coordination with the first I-frame interval is crucial. Therefore, extreme storage space savings can be achieved in a still state, significantly extending video recording retention time without affecting the recording quality of critical events.
[0069] In some embodiments, in response to the total coding capability being not less than the sum of all other first coding capabilities and second coding capabilities, storing video data according to pre-adjusted first coding information may include the following.
[0070] In response to the total coding capacity being no less than the sum of all other first and second coding capacities, the modification of the first coding information of the pre-adjusted target storage channel is performed.
[0071] The video data is stored using the modified first encoding information.
[0072] In this process, after obtaining the status type of the target storage channel, the storage device pre-adjusts the first encoding information of the target storage channel according to the status type to obtain the second encoding capability. Then, it determines whether the total encoding capability can meet the adjusted encoding requirements. If the total encoding capability is sufficient, the pre-adjustment scheme is confirmed to be feasible, and the modification operation of the first encoding information is actually executed. For example, the first frame rate is adjusted from 30fps to 15fps, the first bitrate is adjusted from 4Mbps to 2Mbps, or the first I-frame interval is adjusted from 30 frames to 60 frames. After the modification is completed, the video data is encoded and stored using the adjusted encoding parameters.
[0073] Specifically, by pre-judging whether the encoding capability is sufficient, the system avoids overloading the device or interrupting recording due to adjustments, ensuring that storage space optimization is achieved within the limits of the encoding capability. In one specific implementation, when the target storage channel's state type is active, the pre-adjustment scheme is to increase the first I-frame interval. If the total encoding capability meets the requirements, the operation of increasing the I-frame interval is actually performed, for example, increasing the I-frame interval from 15 frames to 30 frames, while keeping the frame rate and bitrate unchanged. This reduces the number of I-frames and lowers storage space usage while ensuring smooth playback. In another specific implementation, when the target storage channel's state type is static, the pre-adjustment scheme is to decrease the first bitrate and first frame rate. If the total encoding capability meets the requirements, the operation of decreasing the bitrate and frame rate is actually performed.
[0074] For example, reducing the bitrate from 4Mbps to 1Mbps and the frame rate from 30fps to 10fps significantly reduces the amount of data in still images, thus reducing storage space requirements. Therefore, this embodiment can flexibly adjust encoding parameters within the limits of encoding capabilities, ensuring both the integrity and smoothness of video data while effectively reducing storage space requirements.
[0075] In some embodiments, the following may also be included.
[0076] In response to the total coding capacity being less than the sum of all other first and second coding capacities, the state type of the target storage channel is set to fallback state.
[0077] Increase the first I-frame interval, and / or decrease the first frame rate, and / or decrease the first bit rate.
[0078] The second coding capability of the target storage channel is determined by the increased first I-frame interval, and / or the decreased first frame rate, and / or the decreased first bit rate.
[0079] Specifically, when the target storage channel is originally in an excited or quiescent state, and the pre-adjusted encoding capacity exceeds the total encoding capacity of the device, in order to avoid device overload, the storage device will forcibly switch the state type of the target storage channel to a fallback state and encode it according to the parameter adjustment strategy corresponding to the fallback state.
[0080] Specifically, if the target storage channel was originally in an active state, and the pre-adjustment scheme was to increase the I-frame interval, but the total encoding capacity was insufficient, the storage device would set its state type to fallback state and reduce the first frame rate and first bitrate, for example, reducing the frame rate from 30fps to 20fps and the bitrate from 4Mbps to 3Mbps, while maintaining or appropriately adjusting the I-frame interval. This would reduce the encoding load while preserving as much image detail as possible. In other words, by dynamically degrading the encoding parameters, the device's total encoding capacity is ensured to always remain within a controllable range, avoiding recording stutters or data loss due to insufficient encoding capacity.
[0081] Understandably, the three options—increasing the first I-frame interval, decreasing the first frame rate, and decreasing the first bitrate—can be combined in any way. For example, one of them can be selected for processing; two of them can be selected for processing; or all three can be selected for processing simultaneously. Furthermore, either the first or second value can be arbitrarily chosen for processing.
[0082] In some embodiments, if the above conditions are not met after one adjustment, further adjustments can be made, that is, the state type of the target storage channel can be set to fallback state multiple times, and the corresponding parameters can be adjusted until the total coding capability is not less than the sum of all other first coding capabilities and second coding capabilities.
[0083] In one specific implementation, when the target storage channel is in an active state and the total encoding capacity is insufficient, the storage device sets its state type to fallback and only reduces the first frame rate, for example, from 30fps to 15fps, while keeping the bitrate and I-frame interval unchanged. This reduces the encoding load while maintaining image clarity. In another specific implementation, when the target storage channel is in a static state and the total encoding capacity is insufficient, the storage device sets its state type to fallback and simultaneously reduces the first bitrate and the first frame rate, for example, reducing the bitrate from 1Mbps to 0.5Mbps and the frame rate from 10fps to 5fps. This further reduces storage space while ensuring basic image recognizability. Therefore, this embodiment can adaptively adjust encoding parameters when encoding capacity is limited, ensuring the continuity and stability of video recording storage.
[0084] In some embodiments, a first value and / or a second value are used to reduce the first frame rate and the first bit rate, wherein the first value and the second value are proportional.
[0085] The first and second values represent the proportions by which the frame rate and bitrate are reduced, respectively. For example, a first value of 0.5 means the frame rate is reduced to 50% of its original value, and a second value of 0.5 means the bitrate is reduced to 50% of its original value. The two values can be the same or different, and there is a proportional relationship between them. That is, the first and second values are set proportionally.
[0086] Specifically, when the target storage channel is in a fallback state, a first value is used to reduce the first frame rate, for example, reducing the frame rate from 30fps to 15fps (i.e., the first value is 0.5), while a second value is used to reduce the first bitrate, for example, reducing the bitrate from 4Mbps to 2Mbps (i.e., the second value is 0.5). This reduces the encoding load while maintaining a consistent aspect ratio. In another implementation, when the target storage channel is in a static state, a first value is used to reduce the first frame rate, for example, reducing the frame rate from 10fps to 5fps (i.e., the first value is 0.5), while a second value is used to reduce the first bitrate, for example, reducing the bitrate from 1Mbps to 0.25Mbps (i.e., the second value is 0.25). The ratio of the first and second values is 2:1, thereby maximizing the reduction in storage space while maintaining basic image quality. The mechanism is that by setting a proportional relationship, the reduction in frame rate and bitrate is matched, avoiding a severe decrease in image quality or encoding efficiency due to excessive reduction of one parameter. In another specific implementation, the first and second values can be dynamically adjusted, for example, by adjusting the ratio in real time according to the remaining encoding capacity of the device or the degree of change in the image, thereby achieving a dynamic balance between storage space and image quality within the range allowed by the encoding capacity. Through the above method, this embodiment can flexibly adjust the encoding parameters, ensuring the continuity of recording while effectively reducing storage space usage when encoding capacity is limited.
[0087] This embodiment breaks through the limitations of traditional static encoding parameter configuration and creatively proposes an event-driven three-parameter linkage dynamic adjustment mechanism. In existing technologies, frame rate, bit rate, and I-frame interval are usually treated as independent parameters and configured separately, resulting in unreasonable allocation of encoding resources and an inability to adapt to dynamic changes in video content. This application integrates frame rate, bit rate, and I-frame interval into the encoding capability adjustment framework and performs coordinated adjustment based on the state type (excited state, fallback state, and static state) corresponding to event information, achieving joint optimization of the three parameters in the time and spatial dimensions. This holistic adjustment method can match encoding resources in real time according to the picture content, ensuring high frame rate and high bit rate at critical moments (such as when people intrude or vehicles pass by) to preserve key details, and significantly reducing frame rate and bit rate during static periods to save storage space, thereby significantly improving storage efficiency while keeping the total encoding capability fixed.
[0088] Secondly, this application proposes a pre-adjustment decision mechanism based on total coding capacity constraints. Before adjusting the coding parameters, the second coding capacity of the target storage channel after adjustment is calculated and compared with the sum of the first coding capacities of all other storage channels. Adjustment is only performed when the total coding capacity is sufficient; otherwise, it automatically degrades to a fallback state. This mechanism ensures that the coding parameter adjustment does not exceed the device's hardware capabilities, avoiding recording interruptions or system crashes due to overload, and improving system stability and reliability. Simultaneously, this mechanism also enables dynamic reuse of coding resources. When the coding capacity of some channels is reduced, the released resources can be utilized by other channels, thereby maximizing the utilization rate of the device's coding capacity and solving the problem in existing technologies where limited device coding capacity prevents all channels from operating at full frame rate.
[0089] Third, this application proposes a state- and stage-based adaptive parameter adjustment strategy. Different parameter adjustment rules are set for the excited state, the fallback state, and the static state: in the excited state, the I-frame interval is increased to reduce I-frame overhead; in the fallback state, the bitrate and frame rate are moderately reduced to achieve a smooth transition; and in the static state, the bitrate and frame rate are significantly reduced to achieve extreme compression. This hierarchical adjustment strategy avoids image flickering or quality fluctuations caused by sudden parameter changes, ensuring the continuity and recognizability of the recorded footage. In particular, the fallback state design gradually adjusts the encoding parameters after the event ends, achieving a smooth transition from high to low quality, preserving key details at the end of the event while avoiding wasted storage space.
[0090] Fourth, this application achieves flexible yet lossless encoding by linking frame rate (temporal dimension), bit rate (spatial dimension), and I-frame interval (reference dimension) for dimensionality reduction. Frame rate controls the number of frames stored per second, bit rate controls the average data volume per frame, and I-frame interval controls the distribution density of keyframes. These three factors together determine the storage space and image quality. Through the coordinated adjustment of these three factors, this application can maintain image clarity, preserve key details, and ensure smooth playback while reducing storage space, achieving the technical effect of reducing storage space without losing important information. Experimental data shows that in typical monitoring scenarios, the method of this application can reduce storage space by 30%-70% while maintaining the integrity and smoothness of key event footage.
[0091] Furthermore, this application also possesses excellent scalability and adaptability. The specific values of parameter adjustments, such as the first value and the second value, can be flexibly configured according to the actual device capabilities and scenario requirements, supporting multiple combinations. For example, in the static state, a combination of low frame rate, low bit rate, and long I-frame interval can be used; in the active state, a combination of high frame rate, high bit rate, and medium I-frame interval can be used; and in the fallback state, a combination of medium frame rate, medium bit rate, and medium I-frame interval can be used, etc., which can adapt to the needs of different resolutions, different bitstream types, and different monitoring scenarios.
[0092] In summary, this application, by dynamically adjusting encoding parameters and optimizing encoding resource allocation, significantly reduces the storage space of video files, extends the video recording time, and improves hard disk utilization while ensuring the recording quality at critical moments. Moreover, it is simple to implement, has significant effects, and has extremely high practical value and broad application prospects.
[0093] This application also provides an electronic device.
[0094] See Figure 2 , Figure 2 This is a schematic diagram of an embodiment of the electronic device described in this application. The electronic device can perform the steps of the method described above.
[0095] The electronic device 200 includes a memory 220, a processor 210 coupled to the memory, and at least one computer program stored in the memory 220 and executable on the processor 210. When the processor 210 loads and executes the at least one computer program, it implements the steps of the video data storage method described above. For related details, please refer to the detailed description in the above method; further elaboration will not be repeated here.
[0096] This application also includes a computer-readable storage medium.
[0097] Please see Figure 3 , Figure 3 This is a schematic diagram of an embodiment of a computer-readable storage medium in this application.
[0098] The computer-readable storage medium 300 stores at least one program 310, which, when loaded and executed by a processor, is used to implement the steps of the video data storage method described above. For related details, please refer to the detailed description in the above method; it will not be repeated here.
[0099] The above solution, by dynamically adjusting encoding parameters and optimizing encoding resource allocation, significantly reduces the storage space of video files, extends the video retention time, and improves hard disk utilization while ensuring the recording quality at critical moments. It is also simple to implement, has remarkable effects, and has extremely high practical value and broad application prospects.
[0100] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A video data storage method, characterized in that, Applied to a storage device having multiple storage channels, each storage channel corresponding to video data from a video acquisition device, each storage channel having a first encoding capability, and the storage device having a total encoding capability, the method includes: Obtain the event information of the video data to be stored and the status type of the target storage channel corresponding to the event information; The first encoding information of the target storage channel is pre-adjusted according to the state type to obtain the second encoding capability of the target storage channel, wherein the first encoding information includes at least one of a first bit rate, a first frame rate and a first I-frame interval; In response to the total coding capability being no less than the sum of all other first coding capabilities and second coding capabilities, the video data is stored according to the pre-adjusted first coding information, wherein all other first coding capabilities are the coding capabilities of storage channels other than the target storage channel.
2. The method according to claim 1, characterized in that, The state types include excited state, falling state, and stationary state; the event information includes a first identification event, a second identification event, and a third identification event; The event information for acquiring the video data to be stored and the status type of the target storage channel corresponding to the event information include: Obtain the degree of image change in the video data; In response to the change in the image exceeding a first threshold, the event information corresponding to the video data is set as the first recognized event, and the state type of the target storage channel corresponding to the first recognized event is set to the excited state; or In response to the image change being less than a first threshold and greater than a second threshold, the event information corresponding to the video data is set as the second recognition event, and the state type of the target storage channel corresponding to the second recognition event is set to fallback state; or In response to the static state of the image change, the event information corresponding to the video data is set as a third recognition event, and the state type of the target storage channel corresponding to the third recognition event is set to static state.
3. The method according to claim 2, characterized in that, The step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: In response to the target storage channel being in an excited state, the first I-frame interval supported by the target storage channel is increased; The second encoding capability of the target storage channel is determined using the improved first I-frame interval, the first frame rate, and the first bit rate.
4. The method according to claim 2, characterized in that, The step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: In response to the target storage channel being in a fallback state, the first bitrate and the first framerate are reduced by a first value. The second encoding capability of the target storage channel is determined by the first I-frame interval, the first bit rate reduced by the first value, and the first frame rate.
5. The method according to claim 2, characterized in that, The step of pre-adjusting the first encoding information of the target storage channel according to the state type to obtain the second encoding capability of the target storage channel includes: In response to the target storage channel being in a static state, the first bitrate and the first framerate are reduced by a second value, wherein the second value is greater than the first value corresponding to the state being in a fallback state; The second encoding capability of the target storage channel is determined by using the first I-frame interval, the first bit rate reduced by the second value, and the first frame rate.
6. The method according to any one of claims 3-5, characterized in that, In response to the total coding capability being no less than the sum of all other first coding capabilities and second coding capabilities, the video data is stored according to the pre-adjusted first coding information, including: In response to the total encoding capability being not less than the sum of all other first encoding capabilities and second encoding capabilities, a modification of the first encoding information of the target storage channel is performed to pre-adjust it; The video data is stored using the modified first encoding information.
7. The method according to claim 1, characterized in that, Also includes: In response to the total coding capacity being less than the sum of all other first coding capacities and second coding capacities, the state type of the target storage channel is set to fallback state; Increase the first I-frame interval, and / or decrease the first frame rate, and / or decrease the first bit rate; The second coding capability of the target storage channel is determined by the increased first I-frame interval, and / or the decreased first frame rate, and / or the decreased first bit rate.
8. The method according to claim 7, characterized in that, The first frame rate and the first bit rate are reduced by using a first value and / or a second value, wherein the first value and the second value are proportional.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor coupled to the memory, the memory storing at least one computer program, which, when loaded and executed by the processor, is used to implement the method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium has at least one program that, when loaded and executed by a processor, is used to implement the method as described in any one of claims 1-8.