Method, apparatus and storage medium for maintaining recording continuity at recording mode switching
By performing video frame continuity verification and candidate start frame search during recording mode switching in the image acquisition device, the continuity problem during recording mode switching is solved, ensuring the continuity of recording files and optimizing power consumption, thus achieving effective switching of low-power recording modes.
Patent Information
- Application Number
- CN202611140111.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-11-27
AI Technical Summary
In image acquisition devices, the relevant information of video frames is prone to abnormalities when switching recording modes, resulting in a lack of continuity in the recording file, with missing images or gaps in the recording. Furthermore, switching to low-power modes may consume device power, increasing power consumption.
By acquiring video frames before and after the recording mode switch for continuity verification, searching for candidate starting frames that meet preset conditions, generating transition recording segments or recalibrating recording file time metadata, the continuity of recording files is ensured, and mode switching commands are rejected when the power is low to reduce power consumption.
It achieves continuity of recording files before and after switching recording modes, reduces power consumption, avoids recording gaps and missing images, and improves the power utilization efficiency of the device.
Smart Images

Figure CN123185451A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video recording control technology, and in particular to a method, device, and storage medium for maintaining video recording continuity during video recording mode switching. Background Technology
[0002] In recent years, thanks to continuous technological innovation and increasing societal awareness of safety, the demand for intelligent image acquisition equipment has been significantly increasing. To meet various application scenarios, ultra-high definition, low power consumption, intelligence, and scenario-based applications have become the main development directions for image acquisition equipment.
[0003] Currently, some image acquisition devices support multiple recording modes (such as low-power mode and normal recording mode). The image acquisition device can dynamically switch between normal recording mode and low-power mode based on external events (such as object detection) or timing strategies.
[0004] However, when switching modes, information related to video frames (such as index information, time information, etc.) is prone to abnormalities, which may cause problems such as missing images in the subsequently generated video files, resulting in a lack of continuity with the previously generated historical video files. Summary of the Invention
[0005] This application provides at least one method, apparatus, device, and computer-readable storage medium for maintaining recording continuity during recording mode switching.
[0006] This application provides a method for maintaining recording continuity during recording mode switching, wherein the recording modes include a first recording mode and a second recording mode. The method includes: in response to receiving a mode switching instruction to switch from the first recording mode to the second recording mode, acquiring an end video frame captured in the first recording mode and acquiring a first candidate start frame captured in the second recording mode; performing a continuity check on the end video frame and the first candidate start frame to obtain a continuity check result; if the continuity check result indicates a continuity anomaly, searching for a second candidate start frame that meets preset candidate conditions to obtain a valid start frame; and generating a recording file based on the end video frame and the valid start frame to obtain a target recording file.
[0007] In one embodiment, the step of performing continuity verification on the end video frame and the first candidate start frame to obtain a continuity verification result includes: performing index continuity detection based on the end frame index of the end video frame and the first start frame index of the first candidate start frame to obtain an index detection result; performing time continuity detection based on the end frame time of the end video frame and the first start frame time of the first candidate start frame to obtain a time detection result; and determining the continuity verification result based on the index detection result and the time detection result.
[0008] In one embodiment, determining the continuity verification result based on the index detection result and the time detection result includes: determining whether the index detection result indicates that the end frame index is less than the first start frame index and whether the time detection result indicates that the end frame time is less than the first start frame time; if yes, a continuity verification result indicating normal continuity is obtained; if no, a continuity verification result indicating abnormal continuity is obtained.
[0009] In one embodiment, finding a second candidate start frame that satisfies preset candidate conditions to obtain a valid start frame includes: determining at least one second candidate start frame based on at least one of the pre-recording queue, frame buffer, and currently captured frame corresponding to the second recording mode; and determining the valid start frame from the at least one second candidate start frame based on the preset candidate conditions; the preset candidate conditions include: the end frame index is less than the target frame index of the valid start frame, and the end frame time of the end video frame is less than the target frame time of the valid start frame.
[0010] In one embodiment, after finding a second candidate starting frame that meets preset candidate conditions and obtaining a valid starting frame if the continuity verification result indicates a continuity anomaly, the method further includes: obtaining a time difference threshold; determining a time difference value based on the end frame time of the end video frame and the obtained current system time of the device; determining whether there is a recording hole based on the time difference value and the time difference threshold; and if so, performing compensation processing on the recording hole.
[0011] In one embodiment, obtaining the time difference threshold includes: obtaining the current battery level information of the device; determining a corresponding target time difference threshold based on the current battery level information of the device within a preset time difference threshold, wherein the target time difference threshold is negatively correlated with the current battery level information of the device.
[0012] In one embodiment, the compensation process for the video recording hole includes: generating a transition video segment based on the end video frame and the valid start frame; compensating for the video recording hole based on the transition video segment; or, recalibrating the time metadata of the target video file based on the current system time of the device.
[0013] In one embodiment, the first recording mode is a normal mode, and the second recording mode is a low-power mode. The step of responding to receiving a mode switching instruction to switch from the first recording mode to the second recording mode, and acquiring the end video frame captured in the first recording mode, and acquiring the first candidate start frame captured in the second recording mode, includes: acquiring the device's current battery information; determining a corresponding target countdown timer within a preset countdown timer based on the device's current battery information, wherein the target countdown timer is positively correlated with the device's current battery information; and performing mode switching processing and image acquisition processing based on the target countdown timer and the mode switching instruction to obtain the end video frame and the first candidate start frame.
[0014] In one embodiment, the mode switching process includes: reducing the frequency of the device hardware to obtain a low-power hardware environment; and reducing the cache of the pre-recording queue corresponding to the normal mode to obtain the pre-recording queue corresponding to the low-power mode.
[0015] In one embodiment, the first recording mode is a low-power mode, and the second recording mode is a normal mode. After receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the method further includes: obtaining the current battery level information of the device; if the current battery level information of the device is less than a preset mode switching battery level threshold, then the mode switching instruction is rejected.
[0016] A second aspect of this application provides a recording continuity maintenance device during recording mode switching. The recording modes include a first recording mode and a second recording mode. The device includes: an acquisition module, configured to acquire an end video frame captured in the first recording mode and a first candidate start frame captured in the second recording mode in response to receiving a mode switching command from the first recording mode to the second recording mode; a continuity verification module, configured to perform continuity verification on the end video frame and the first candidate start frame to obtain a continuity verification result; a valid frame search module, configured to search for a second candidate start frame that meets preset candidate conditions if the continuity verification result indicates a continuity anomaly, to obtain a valid start frame; and a recording generation module, configured to generate a recording file based on the end video frame and the valid start frame to obtain a target recording file.
[0017] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute program instructions stored in the memory to implement the above-described method for maintaining recording continuity during recording mode switching.
[0018] The fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the above-described method for maintaining recording continuity during recording mode switching.
[0019] In the technical solution of this application, the recording mode may include at least a first recording mode and a second recording mode. Upon receiving a mode switching command to switch from the first recording mode to the second recording mode, the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode can be acquired. By performing a continuity check on the end video frame and the first candidate start frame, a continuity check result is obtained. Based on the continuity check result, it can be determined whether the end video frame before and after the mode switch has continuity with the first candidate start frame. If the continuity check result indicates an abnormal continuity, a second candidate start frame that meets preset candidate conditions is searched from the candidate video frames captured in the second recording mode to obtain a valid start frame. A recording file is generated based on the end video frame and the valid start frame to obtain a continuous target recording file, maintaining the continuity of the recording file before and after the recording mode switch.
[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0022] Figure 1 This is a flowchart illustrating an exemplary embodiment of the recording continuity maintenance method during recording mode switching according to this application; Figure 2 This is a block diagram illustrating a recording continuity maintenance device during recording mode switching, as shown in an exemplary embodiment of this application. Figure 3 This is a schematic diagram of the structure of an embodiment of the electronic device of this application; Figure 4 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0023] The solution of this embodiment will now be described in detail with reference to the accompanying drawings.
[0024] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0025] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0026] For ease of understanding, one of the applicable scenarios of this application is illustrated by example.
[0027] In recent years, thanks to continuous technological innovation and increasing societal awareness of safety, the demand for intelligent image acquisition equipment has been significantly increasing. To meet various application scenarios, ultra-high definition, low power consumption, intelligence, and scenario-based applications have become the main development directions for image acquisition equipment.
[0028] Currently, some image acquisition devices support multiple recording modes (such as AlwaysOn Video (AOV) and normal recording mode). The image acquisition device can dynamically switch between normal recording mode and low-power mode based on external events (such as object detection) or timing strategies.
[0029] In normal recording mode, to capture content prior to the event, a pre-recording queue is typically maintained, buffering video frames from the most recent N seconds (e.g., 5 seconds). When entering a normal recording segment, candidate frames are retrieved from the pre-recording queue in frame index order as the starting frame of that segment. Alternatively, in AOV mode, a corresponding pre-recording queue or buffering mechanism can be configured as needed, but the frame interval is usually larger (e.g., one frame every several seconds to tens of seconds), which will not be elaborated upon here.
[0030] However, each recording mode maintains its own corresponding recording segment. When the system determines that a recording mode needs to be switched, it usually first calls Record_Stop to end the recording segment in the current mode, and then the recording module of the new mode calls Record_Start to start the next recording segment.
[0031] Therefore, if the relevant information of the video frame (such as index information, time information, etc.) is abnormal when switching modes, it may cause problems such as missing images in the subsequently generated video files, resulting in a lack of continuity with the previously generated historical video files.
[0032] Therefore, the inventors discovered at least the following problems during the mode switching process of the image acquisition device: when waking up from AOV mode to normal recording mode, the candidate frame index in the pre-recording queue may be smaller than the frame index at the end of the previous AOV segment, or there may be a large jump between the UTC time of the candidate frame and the UTC time at the end of the previous segment, causing Record_Start to fail or be passively cut off, resulting in a period of blank recording; when entering AOV mode from normal recording mode, there may be a period of recording gaps on the timeline between the end of the normal recording segment and the first frame of the AOV recording segment due to scheduling delays, mismatched pre-recording strategies, etc.
[0033] Moreover, for low-power devices, the existing recording mode switching method may consume already limited power, accelerating the device into a low power protection state, resulting in unnecessary power consumption.
[0034] Please see Figure 1 , Figure 1 This is a flowchart illustrating an exemplary embodiment of the recording continuity maintenance method during recording mode switching according to this application.
[0035] The recording modes of this application may include at least a first recording mode and a second recording mode, wherein the first recording mode and the second recording mode are different.
[0036] For example, if the first recording mode is a low-power recording mode (referred to as low-power mode or AOV mode), then the second recording mode can be a normal recording mode (referred to as normal mode). If the first recording mode is normal mode, then the second recording mode can be AOV mode.
[0037] Specifically, this may include the following steps: Step S110: In response to receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the end video frame captured in the first recording mode is acquired, and the first candidate start frame captured in the second recording mode is acquired.
[0038] The mode switching command can be received through external communication between the image acquisition device and other smart devices (such as mobile phones, computers, radar detection devices, infrared detection devices, thermal imaging detection devices, etc.), or it can be generated internally by the image acquisition device; no limitation is made here.
[0039] For example, when an image acquisition device is running in AOV mode, it can receive a mode switching command issued by the user through the terminal device, and then switch from AOV mode to normal mode.
[0040] For example, when an image acquisition device is running in AOV mode, it can perform target detection on the acquired video images; when a target object or target event is detected, it can generate a mode switching command, thereby switching from AOV mode to normal mode.
[0041] For example, when an image acquisition device is running in normal mode, it can record the duration for which no target object or event has been detected. When the preset duration is reached, it can generate a mode switching command, thereby switching from normal mode to AOV mode. This can be achieved by setting technical means such as countdown strategies, which will not be elaborated here.
[0042] It should also be noted that in this step, the end video frame can be obtained before or after the mode switch; there is no limitation here.
[0043] For example, after executing the mode switching command, the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode can be obtained.
[0044] Alternatively, the end video frame captured in the first recording mode can be obtained before the mode switching instruction is executed; and the first candidate start frame captured in the second recording mode can be obtained after the mode switching instruction is executed.
[0045] The end video frame (or end frame for short) refers to the video frame in a recording segment corresponding to a certain recording mode that is at the end of the recording time node, usually the last frame of the recording segment.
[0046] The corresponding start frame refers to the video frame at the start time of recording in a recording segment corresponding to a certain recording mode, which is usually the first frame of that recording segment.
[0047] It should be noted that in traditional methods, the first frame captured in a certain recording mode is usually directly determined as the starting frame of the recording segment, but this is prone to problems such as continuity anomalies mentioned in the previous embodiments.
[0048] Therefore, this application proposes that the video frames captured in the second recording mode be determined as candidate start frames first, and then it is determined whether the candidate start frames can be used as valid start frames for the recording segment.
[0049] The number of candidate start frames can be one or more, and there is no limit here.
[0050] For example, in some possible implementations, the method of obtaining the candidate start frame may include, but is not limited to: 1. obtaining it from the pre-recording queue corresponding to the second recording mode; 2. obtaining it from the real-time output of the image sensor; 3. obtaining it from the frame buffer.
[0051] The frame buffer is used to temporarily store the captured video frames to prevent data loss or processing interruption.
[0052] For example, during the countdown to switch from normal mode to AOV mode, the current normal recording segment can continue to be written without interrupting the normal acquisition and encoding of video frames in normal recording mode. At the same time, each video frame during the countdown period can be synchronously output to the pre-compensation buffer (i.e., the frame buffer) or the current pre-recording queue in AOV mode can be kept clear to preserve complete image information.
[0053] When the countdown ends, the end frame information of the current end frame can be locked as the precise end information of the normal mode recording segment that is about to end. This information can include at least: the end frame index and the end frame time of the video frame.
[0054] For ease of understanding and explanation, in this embodiment, the first video frame captured after switching to the second recording mode can be used as the first candidate starting frame.
[0055] Step S120: Perform continuity verification on the end video frame and the first candidate start frame to obtain the continuity verification result.
[0056] Based on the aforementioned steps, after obtaining the end video frame of the first recording mode and the first candidate start frame of the second recording mode, a continuity check can be performed on both to obtain the continuity check result. The continuity check result can be used to determine whether there are any recording gaps or other issues before and after the recording mode switch.
[0057] There are multiple continuity verification methods in this application, and the specific method can be set as needed according to the actual application scenario.
[0058] For example, some efficient methods of judgment may include: performing continuity verification through frame index, or performing continuity verification through frame timestamp, or performing continuity verification through both frame index and frame timestamp, etc.
[0059] For example, some complex judgment methods may include: performing continuity verification by analyzing the image content (image features) of the end video frame and the first candidate start frame, etc., which will not be elaborated here.
[0060] It is understandable that, among the various continuity verification methods that can be implemented, one or more can be selected for implementation, and no limitation is made here.
[0061] Step S130: If the continuity check result indicates a continuity anomaly, then find a second candidate starting frame that meets the preset candidate conditions to obtain a valid starting frame.
[0062] In conjunction with the steps described above, if the continuity check result indicates an abnormality in continuity, it means that there is a lack of continuity between the first candidate start frame and the end video frame, which may be due to issues such as index rollback, time rollback, or recording gaps.
[0063] Therefore, the first candidate start frame cannot be used as a valid start frame, and other candidate start frames need to be searched for before making a judgment. That is, a second candidate start frame can be searched among the candidate frames captured in the second recording mode; if the found second candidate start frame meets the preset candidate conditions, it can be used as a valid start frame; if the found second candidate start frame does not meet the preset candidate conditions, other candidate start frames are searched, which will not be elaborated here.
[0064] For example, the preset candidate conditions can be set similarly to the verification conditions used for continuity verification (e.g., the frame index and / or frame timestamp meet the conditions), or they can be set according to the principles of video encoding and decoding (e.g., I-frames, i.e., intra-coded frames, can be preferentially selected as valid start frames. Because I-frames can be decoded independently, they are suitable as the beginning of a recording segment).
[0065] Step S140: Generate a recording file based on the end video frame and the valid start frame to obtain the target recording file.
[0066] Based on the steps described above, after determining the valid start frame corresponding to the second recording mode, the recording file can be generated based on the end video frame and the valid start frame to obtain the target recording file corresponding to the second recording mode.
[0067] For example, a transitional video segment is generated based on the end video frame and the valid start frame, and video compensation is implemented by inserting it before the valid start frame.
[0068] For example, the start time of the second recording mode can be recalibrated at a time point near the end time point of the last video frame, so that the two recording segments are continuous on the timeline.
[0069] Therefore, the video content of the target video file can continue from the video content of the historical video file in the first recording mode, making the recording segments before and after the recording mode switch continuous.
[0070] As can be seen, the recording mode in this application can include at least a first recording mode and a second recording mode. Upon receiving a mode switching command to switch from the first recording mode to the second recording mode, the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode can be acquired. By performing a continuity check on the end video frame and the first candidate start frame, a continuity check result is obtained. Based on this result, it can be determined whether the end video frame before and after the mode switch has continuity with the first candidate start frame. If the continuity check result indicates an abnormal continuity, a second candidate start frame that meets preset candidate conditions is searched from the candidate video frames captured in the second recording mode to obtain a valid start frame. A recording file is generated based on the end video frame and the valid start frame, resulting in a continuous target recording file, thus maintaining the continuity of the recording file before and after the recording mode switch.
[0071] Based on the above embodiments, this embodiment describes the method in step S120.
[0072] Specifically, the method for performing continuity verification on the end video frame and the first candidate start frame to obtain the continuity verification result in this embodiment includes at least the following steps S210 to S230: Step S210: Perform index continuity detection based on the end frame index of the end video frame and the first start frame index of the first candidate start frame to obtain the index detection result.
[0073] Step S220: Perform time continuity detection based on the end frame time of the end video frame and the first start frame time of the first candidate start frame to obtain the time detection result.
[0074] Step S230: Determine the continuity verification result based on the index detection result and the time detection result.
[0075] In conjunction with the foregoing embodiments, this embodiment provides an implementable continuity verification method. By performing a two-dimensional verification based on index and timestamp on the end video frame and the first candidate start frame, it is determined whether there is continuity between the two frames before and after the recording mode switch.
[0076] For example, when acquiring the end video frame, the end frame index `lastSegmentIndex` and end frame time `lastSegmentUtc` corresponding to the end video frame can be acquired simultaneously. When acquiring the first candidate start frame, the first start frame index `newIndex` and first start frame time `newUtc` corresponding to the first candidate start frame can be acquired simultaneously.
[0077] On the one hand, during the index continuity detection process, newIndex and lastSegmentIndex are compared; if newIndex>lastSegmentIndex, the index detection result is obtained, which can indicate that there is index continuity between the end video frame and the first candidate start frame; if newIndex≤lastSegmentIndex, the index detection result is obtained, which can indicate that there is no index continuity between the end video frame and the first candidate start frame.
[0078] On the other hand, during the time continuity detection process, newUtc and lastSegmentUtc are compared; if newUtc>lastSegmentUtc, the time detection result is obtained, which can indicate that there is time continuity between the end video frame and the first candidate start frame; if newUtc≤lastSegmentUtc, the time detection result is obtained, which can indicate that there is no time continuity between the end video frame and the first candidate start frame.
[0079] Furthermore, the continuity verification result can be determined based on the index detection result and / or the time detection result.
[0080] Based on the above embodiments, this embodiment describes the method in step S230.
[0081] Specifically, the method for determining the continuity verification result based on the index detection result and the time detection result in this embodiment includes at least the following steps S310 to S330: Step S310: Determine whether the index detection result indicates that the end frame index is less than the first start frame index, and whether the time detection result indicates that the end frame time is less than the first start frame time.
[0082] Step S320: If yes, then the continuity check result representing normal continuity is obtained.
[0083] Step S330: If not, then the continuity check result representing the continuity anomaly is obtained.
[0084] In conjunction with the foregoing embodiments, in one possible implementation of determining the continuity verification result, the continuity verification result can be determined based on the index detection result and the time detection result.
[0085] For example, when the index detection result indicates that the end frame index is less than the first start frame index, and the time detection result indicates that the end frame time is less than the first start frame time, it means that the first candidate start frame can continue the end video frame of the previous recording segment in both the frame sequence and the time axis. A continuity verification result indicating normal continuity can be obtained, and this frame (the first candidate start frame) can be selected as the valid start frame of the recording segment after switching to the second recording mode.
[0086] If either condition is not met, a continuity check result representing a continuity anomaly is obtained, and subsequent anomaly correction is required.
[0087] Based on the above embodiments, this embodiment describes the method in step S130.
[0088] Specifically, in this embodiment, the method for finding a second candidate start frame that meets preset candidate conditions and obtaining a valid start frame includes at least the following steps S410 to S420: Step S410: Determine at least one second candidate start frame based on at least one of the pre-recording queue, frame buffer, and currently acquired frame corresponding to the second recording mode.
[0089] In conjunction with the foregoing embodiments, one or more of the following can be used as data sources for obtaining candidate start frames: pre-recording queue, frame buffer, and video frames acquired in real time by sensors.
[0090] When the first candidate start frame and the end video frame do not have recording continuity, other candidate start frames can be obtained from at least one of the channels in the above examples to obtain at least one second candidate start frame.
[0091] For example, when a continuity anomaly is detected, the system does not choose to refuse to start recording or force recording to be cut into segments. Instead, it can find a second candidate starting frame and perform verification again by executing the following method, for example: A backward (increasing time direction) search is performed from the pre-recorded queue or frame buffer to find at least one second candidate start frame that is sequentially located after the first candidate start frame. Then, step S420 is executed to determine whether it meets the preset candidate conditions.
[0092] Step S420: Determine a valid start frame from at least one second candidate start frame according to preset candidate conditions; the preset candidate conditions include: the end frame index is less than the target frame index of the valid start frame, and the end frame time is less than the target frame time of the valid start frame.
[0093] Specifically, the first second candidate starting frame that simultaneously meets the preset candidate conditions can be used as a new valid starting frame.
[0094] The preset candidate conditions may include, but are not limited to: similarly comparing the second start frame index with the end frame index of each found second candidate start frame, and / or comparing the second start frame time with the end frame time, until the first second candidate start frame with a second start frame index greater than the end frame index and a second start frame time greater than the end frame time is found, and it is determined as a valid start frame.
[0095] That is, the target frame index frameIndex of the valid start frame must satisfy frameIndex>lastSegmentIndex, and the target frame time frameUtc of the valid start frame must satisfy frameUtc>lastSegmentUtc.
[0096] Frame types can also be filtered. For example, in a scenario where the frame type is switched from AOV mode to normal mode, the effective starting frame is a video frame captured in normal mode (referred to as a normal frame, or non-AOV frame).
[0097] In addition, because I-frames can be decoded independently, they are suitable as the beginning of a video segment, and I-frames (intra-coded frames) can be selected as the starting frame.
[0098] It should also be noted that during the search for the second candidate starting frame that meets the preset candidate conditions, if no second candidate starting frame that meets the preset candidate conditions is found within the preset waiting time (e.g., 100-300ms), the system can wait for the next new valid I-frame acquired by the sensor in real time, and perform a video recording continuity check on the new I-frame until a valid starting frame is obtained. This will not be elaborated here.
[0099] With the correction in this embodiment, even if there are abnormal frames with index rollback or time rollback in the pre-recording queue after the recording mode switch, the system can adaptively jump to the subsequent valid frames instead of passively creating blank recording segments before and after the recording mode switch.
[0100] Based on the above embodiments, this embodiment describes the method after step S130.
[0101] Specifically, in this embodiment, the method after finding a second candidate starting frame that meets the preset candidate conditions and obtaining a valid starting frame if the continuity check result indicates a continuity anomaly includes at least the following steps S510 to S540: Step S510: Obtain the time difference threshold.
[0102] Among them, the time difference threshold T_threshold is a threshold used to determine whether there are recording holes before and after the recording mode switch. There can be one or more time difference thresholds, which are not limited here.
[0103] Step S520: Determine the time difference based on the end frame time of the ending video frame and the current system time of the device.
[0104] After obtaining a valid start frame, the frame time corresponding to the valid start frame can be determined as the device's current system time currUtc, or the device's system UTC (Coordinated Universal Time) time can be obtained again in real time to get the device's current system time. No limitation is made here.
[0105] Therefore, the time difference ΔT between the end frame time and the device's current system time can be determined, and its mathematical expression can be: ΔT = currUtc - lastSegmentUtc Step S530: Determine whether there is a recording hole based on the time difference value and the time difference threshold.
[0106] Furthermore, the time difference ΔT is compared with the time difference threshold T_threshold; if ΔT is greater than the threshold T_threshold, it can be determined that there is a recording hole; if ΔT is less than or equal to the threshold T_threshold, it can be determined that there is no recording hole.
[0107] Step S540: If yes, then compensate for the video hole.
[0108] Furthermore, if video gaps exist, compensation measures need to be implemented to correct them. One or more compensation measures can be implemented as needed, and these measures can be used individually or in combination; no limitation is made here.
[0109] If there are no recording gaps, the recording file corresponding to the second recording mode can be generated and video frames can be written according to the normal recording writing method. For details, please refer to the relevant technology in this field, which will not be elaborated here.
[0110] It should be noted that, in this embodiment, video hole detection and compensation can be performed after finding a second candidate starting frame that meets the preset candidate conditions and obtaining a valid starting frame. Optionally, in another embodiment, video hole detection and compensation can also be performed when the continuity check result corresponding to the first candidate starting frame indicates that the continuity is normal; this is not limited here.
[0111] Based on the above embodiments, this embodiment describes the method in step S510.
[0112] Specifically, the method for obtaining the time difference threshold in this embodiment includes at least the following steps S610 to S620: Step S610: Obtain the current battery level information of the device.
[0113] Step S620: Based on the current power information of the device, determine the corresponding target time difference threshold within the preset time difference threshold. The target time difference threshold is negatively correlated with the current power information of the device.
[0114] In conjunction with the foregoing embodiments, this application may set one or more time difference thresholds (device power thresholds), which are not limited here.
[0115] This allows for the setting of multiple time difference thresholds, each corresponding to a different device power range (device power threshold). In practice, the device's current power information is used to determine its power range, thereby identifying the corresponding time difference threshold.
[0116] For example, 1. When the current battery level of the device is higher than the first device battery level threshold (e.g., 50%), T_threshold can use the first time difference threshold (e.g., 2 seconds).
[0117] 2. When the current power information of the device is between the first device power threshold and the second device power threshold (e.g., 20% to 50%), T_threshold adopts the second time difference threshold (e.g., 3 seconds), and the second time difference threshold is greater than the first time difference threshold.
[0118] 3. When the current battery level of the device is lower than the second device battery level threshold (e.g., 20%), T_threshold uses a third threshold time (e.g., 5 seconds), and the third time difference threshold is greater than the second time difference threshold.
[0119] For example, the target time difference threshold is negatively correlated with the device's current battery level. Alternatively, a preset function can be used to calculate the corresponding time difference threshold in real time based on the device's current battery level. The specific function can be set as needed according to the actual application scenario, and will not be elaborated here.
[0120] Therefore, when the battery is sufficiently charged, using a smaller time difference threshold can more sensitively detect and compensate for recording holes, resulting in better recording continuity. When the battery is low, appropriately widening the time difference threshold can reduce the additional encoding and writing operations triggered by frequent compensation, thereby reducing the device's power consumption.
[0121] Based on the above embodiments, this embodiment describes the method in step S540.
[0122] Specifically, the method for compensating for video holes in this embodiment includes at least the following steps S710 to S730: Step S710: Generate a transition recording segment based on the end video frame and the valid start frame.
[0123] Step S720: Compensate for video holes based on transition video segments.
[0124] Step S730, or, recalibrate the time metadata of the target video file according to the current system time of the device.
[0125] In conjunction with the foregoing embodiments, the method for compensating for video holes in this application may include: 1. compensation based on the transition segment of the video segment ending frame before mode switching; 2. recalibration of the start time of the video segment file after mode switching.
[0126] For example, during the transition compensation process before and after mode switching, the end video frame of the recording segment before mode switching (i.e., the frame corresponding to lastSegmentUtc) can be used as a reference frame to generate a transition recording segment with an extremely low frame rate, and then inserted between the end video frame and the currently determined valid start frame.
[0127] Specifically, starting from lastSegmentUtc, within the time gap between the end video frame and the valid start frame, several I-frames generated by the reference frame encoding are inserted (e.g., one every 2-3 seconds). The timestamps of these I-frames can be sequentially assigned as lastSegmentUtc + compensation interval (which can be set as needed and is not limited here), until the timestamp of the transition recording segment covers the vicinity of the timestamp of the valid start frame, but does not exceed the timestamp of the valid start frame. Specific limitations can be set as needed; for example, until the timestamp of the next inserted frame exceeds the timestamp of the valid start frame, which is not limited here.
[0128] This transitional recording segment typically contains a very small number of video frames with extremely low bitrate overhead, but it fills in the recording gaps on the playback timeline without causing playback jumps. After writing the transitional recording segment, subsequently acquired video frames can be written normally into the recording segment of the second recording mode.
[0129] Optionally, during the generation of the transition video segment, the video frame inserted into the transition video segment can be a static video frame generated based on the end video frame of the previous video segment; or, it can be a dynamic video frame generated by video frame interpolation based on the end video frame of the previous video segment and the valid start frame of the current video segment.
[0130] For example, a linear fade-in method can be used in some concise approaches to fade in the last video frame. With valid start frame The inserted frames of the transition video segment are obtained by performing a weighted summation based on the obtained weight t. Its mathematical expression can be:
[0131] The weight t can be set as needed according to the actual application scenario, and there is no limitation here.
[0132] For example, some lightweight methods can use methods such as optical flow estimation (calculating which direction and how far each pixel in the image moves from the previous frame to the next frame) and bidirectional deformation interpolation (mapping the pixels of the previous and next frames to the corresponding positions of the intermediate time nodes based on optical flow to compensate for missing areas and generate transitional images) to obtain transitional video segments.
[0133] For example, some high-quality methods can use pre-trained video generation models (such as diffusion models) to infer the motion trajectory between the ending video frame and the effective starting frame and fill in the inserted frames to obtain a transitional recording segment. The video generation mode can be deployed in the image acquisition device or other devices with data processing capabilities that have a communication connection with the image acquisition device (such as cloud, terminal devices, etc.), and there is no limitation here.
[0134] In another example, during the recalibration of the start time of the video segment file after mode switching, no extra frames may be inserted, keeping the actual content of the first frame of the second mode video segment unchanged. However, the time metadata of the video segment file may be recalibrated. For example, the startTime of the video segment file may be recalibrated from the actual UTC time of the first frame to a reasonable time close to lastSegmentUtc (such as lastSegmentUtc + preset time unit), so that in the video file system, the video segment covers the entire time period from the end of the previous video segment to the actual first frame of the current video segment.
[0135] Therefore, when the second mode recording segment is played back by the player, the progress bar will extend continuously from lastSegmentUtc without any jumps or interruptions on the timeline.
[0136] This example method is particularly suitable for scenarios where the AOV frame interval is much larger than the pre-recording queue in normal recording mode (e.g., AOV capture interval of 15 seconds, pre-recording queue of only 5 seconds). In traditional scenarios, there may still be a gap of several seconds between the first frame in the pre-recording queue and the end frame of the previous recording segment. Therefore, by using recalibration, continuous recording on the timeline can be achieved without discarding any high frame rate footage captured in normal recording mode.
[0137] Optionally, when the power consumption is low and a larger time difference threshold is used, the aforementioned embodiments have already reduced the frequency of triggering compensation. If subsequent processes still trigger compensation, the method of recalibrating the frame timestamp in this embodiment can be preferred. Because this example method does not require additional coding, its power consumption is lower than that of the example method for inserting transition video segments for AOV devices.
[0138] Furthermore, this application may also add a custom field (such as gapDuration or actualStartTime) to the metadata of the video file to record the actual gap duration or the actual first frame UTC time of the video file.
[0139] Therefore, players that support this extended field can achieve more precise playback control; for standard players that do not support it, the timeline remains continuous (without jumps), and users will not perceive time breaks or video corruption, thus improving the user experience.
[0140] As can be seen from the above, in some application scenarios, the process of generating video files and writing data may include: The first candidate starting frame can be directly determined as the valid starting frame, or the valid starting frame can be determined by correcting the second candidate starting frame that meets the preset candidate conditions, or the valid starting frame can be determined after the hole compensation process in the aforementioned embodiments.
[0141] Based on the end information of the extracted end video frame, the second mode recording segment file is generated and written to obtain the target recording file.
[0142] The start time (startTime) of the video file can be determined by the recalibration value (if compensation is triggered) or by the actual UTC of the first frame. The end time (endTime) of the video file can be determined by the UTC of the last frame when writing to this segment stops. The summary information of the video file is based on these recalibrated or corrected times, and no longer mechanically relies on data such as the event trigger time during mode switching, thus avoiding discontinuous recording caused by discontinuous time information.
[0143] Optionally, if a write failure occurs during the writing of the second mode video segment (such as storage medium being busy, SD card malfunction, etc.), you can choose to roll back to the nearest I-frame position in this video segment and start writing again.
[0144] This mechanism allows newly written content to overlap with previously written content to avoid long gaps in recording due to write failures. This fallback mechanism prioritizes ensuring the continuity of recording.
[0145] Based on the above embodiments, this embodiment describes the method in step S110.
[0146] This embodiment mainly uses the first recording mode as the normal mode and the second recording mode as the low-power mode as an example to illustrate the application scenario of switching from the normal mode to the low-power mode.
[0147] When the recording system decides to switch from normal recording mode to AOV low-power recording mode based on preset mode switching rules (such as the continuous no-event timer is about to expire, power consumption strategy triggering, etc.), the system does not immediately terminate the normal recording mode. Instead, it first obtains the current power information of the device and dynamically determines the switching strategy parameters based on the power level.
[0148] Specifically, in this embodiment, the method for obtaining the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode in response to receiving a mode switching instruction from the first recording mode to the second recording mode includes at least the following steps S810 to S830: Step S810: Obtain the current battery level information of the device.
[0149] Step S820: Based on the current battery level information of the device, determine the corresponding target countdown time from the preset countdown time. The target countdown time is positively correlated with the current battery level information of the device.
[0150] The preset countdown duration refers to the time it takes for the device to switch from normal mode to AOV mode. For example, after no target object or target event is detected in normal mode (or after a period of time has elapsed since no target object or target event was detected in normal mode), a countdown timer can be started. After the preset countdown duration has elapsed, the mode switching command can be executed.
[0151] One or more preset countdown durations can be set as needed; there is no limit here.
[0152] For example, multiple countdown durations can be set to correspond to multiple device battery ranges (device battery thresholds). In actual implementation, the device battery range can be determined based on the actual obtained current battery information of the device, and then the corresponding target countdown duration can be determined.
[0153] It should be noted that the power threshold used to determine the countdown duration in this embodiment and the power threshold used to determine the hole compensation threshold in the previous embodiment may be the same or different, and no limitation is made here.
[0154] For example, obtain the device's current battery level information and dynamically determine the corresponding target countdown duration based on that information: 1. When the device's current battery level is higher than the first battery threshold (e.g., 50%), the corresponding countdown duration can be the first duration (e.g., 3-5 seconds). 2. When the device's current battery level is between the first battery threshold and the second battery threshold (e.g., 20% to 50%), the corresponding countdown duration can be the second duration (e.g., 1 to 2 seconds), which is shorter than the first duration; 3. When the device's current battery level is below the second threshold, the countdown phase can be skipped, the current frame information can be locked, and a mode switching command can be executed to enter AOV mode as quickly as possible to save power.
[0155] Optionally, the target countdown duration is positively correlated with the device's current battery level. Alternatively, a preset function can be used to calculate the target countdown duration in real time based on the device's current battery level. The specific function can be set as needed according to the actual application scenario, and will not be elaborated here.
[0156] Therefore, when the battery is sufficiently charged, extending the countdown timer can make the transition between the end of normal recording and the start of AOV more smooth, resulting in better recording continuity. When the battery is low, compressing or skipping the countdown phase can quickly enter the low-power AOV mode, reducing the sustained high power consumption caused by high frame rate acquisition and encoding in normal recording mode.
[0157] Step S830: Based on the target countdown duration and mode switching instruction, perform mode switching processing and image acquisition processing to obtain the end video frame and the first candidate start frame.
[0158] Therefore, when the timer reaches the target countdown duration, or when the countdown based on the target countdown duration ends, a mode switching instruction can be executed to perform mode switching processing and image acquisition processing, thereby obtaining the end video frame and the first candidate start frame before and after the mode switch.
[0159] Optionally, after the end video frame of a normal recording, a custom SEI frame (Supplemental Enhancement Information) carrying a mode switching identifier is inserted as the anchor point for splicing subsequent AOV mode recording segments.
[0160] It should be noted that during the countdown and after entering AOV mode, the pre-recording queue can remain cleared, and each frame in the pre-recording queue can carry a frame type marker (normal frame or AOV frame) so that the frame source can be distinguished during subsequent switching, and the appropriate frame type can be selected as the starting point of the recording segment.
[0161] Once the countdown ends, the system immediately triggers a mode switch, entering AOV low-power mode. During the switch, or after confirming entry into AOV mode, a deep hardware frequency reduction operation can be performed.
[0162] Based on the above embodiments, this embodiment describes the method in step S830.
[0163] Specifically, the mode switching processing method in this embodiment includes at least the following steps S910 to S920: Step S910: Reduce the frequency of the device hardware to obtain a low-power hardware environment.
[0164] Referring to the foregoing embodiments, when switching from normal mode to AOV mode, or after switching to AOV mode, a hardware frequency reduction operation can be performed simultaneously. The frequency reduction targets include, but are not limited to, those in the image acquisition device: 1. The CPU (Central Processing Unit) clock speed is reduced from the normal mode frequency (e.g., 800MHz) to the AOV mode frequency (e.g., 400MHz or lower). 2. DDR (Double Data Rate SDRAM) memory frequency is reduced from the normal mode frequency (e.g., 933MHz) to the AOV mode frequency (e.g., 400MHz); 3. Reduce or disable the Image Signal Processor (ISP). Because the frame rate is extremely low in AOV mode, the ISP does not need to run at full speed.
[0165] It should be noted that the frequency reduction range can be configured as needed based on the multiple frequency levels supported by the device hardware in the actual application scenario, in order to achieve a balance between power consumption and AOV recording performance, which will not be elaborated here.
[0166] Step S920: Perform buffer reduction processing on the pre-recording queue corresponding to the normal mode to obtain the pre-recording queue corresponding to the low-power mode.
[0167] It should be noted that because the frame interval of the video frames captured in AOV mode is relatively large (several seconds to tens of seconds per frame), there is no need to buffer several seconds of video frames as in normal mode. Therefore, AOV mode can set a static buffer, which simplifies the access mode and can adapt to the reduced read / write bandwidth and increased memory latency of DDR after frequency reduction. This avoids problems such as frame loss due to excessive cache management overhead and further adapts to the refresh power consumption and cache space usage after the DDR frequency is reduced.
[0168] Therefore, after the hardware downclocking is completed, the management of the pre-recording queue can also be adapted and adjusted accordingly. For example, the pre-recording queue in the downclocked DDR can use a static buffer (frame buffer) of fixed size. Compared with the pre-recording queue before downclocking, it can retain less buffer space (e.g., temporarily store 2 to 3 I-frames), reducing the cache usage and eliminating the need to maintain a complex pre-recording queue based on a ring cache.
[0169] Based on the above embodiments, this embodiment should also explain that if switching from AOV mode to normal recording mode, hardware upsampling can be performed to restore the operating frequency during normal operation.
[0170] For example, after extracting the end information of the last video frame in the previous recording segment, a hardware frequency recovery operation can be performed first: the hardware that underwent frequency reduction processing in the aforementioned embodiment (such as CPU, DDR, ISP, etc.) is restored from the AOV mode frequency to the normal mode frequency to ensure sufficient hardware resources for subsequent high frame rate recording in normal mode. After the hardware frequency recovery is completed, the first candidate start frame is then obtained.
[0171] This solves the problem that the downclocked DDR in AOV mode may not be able to handle the full read / write bandwidth requirements of the pre-recording queue in normal mode, and the downclocked CPU cannot meet the real-time requirements of high frame rate encoding. Therefore, restoring the hardware frequency before starting recording in normal mode can avoid problems such as frame loss or encoding delays caused by insufficient hardware resources.
[0172] Based on the above embodiments, this embodiment describes the method in step S110.
[0173] This embodiment mainly uses the example of a low-power recording mode as the first recording mode and a normal recording mode as the second recording mode, that is, the application scenario of switching from low-power mode to normal mode.
[0174] Specifically, in this embodiment, the method after receiving a mode switching instruction to switch from a first recording mode to a second recording mode includes at least the following steps S1010 to S1020: Step S1010: Obtain the current battery level information of the device.
[0175] Step S1020: If the current battery level of the device is less than the preset mode switching battery threshold, the mode switching command will be refused.
[0176] It should be noted that in application scenarios where the AOV mode is switched to the normal recording mode, a power protection check can be added before executing the mode switching command.
[0177] Illustratively, the current power information of the device is obtained and compared with a preset mode switching power threshold (e.g., 5%). When the current power information of the device is lower than the mode switching power threshold, the mode switching instruction is rejected, so that the device maintains the AOV low-power mode, only performs image acquisition at the minimum power consumption level, and is prohibited from switching to the high-power normal recording mode. When the current power information of the device is not lower than the mode switching power threshold, the mode switching instruction can be allowed to be executed.
[0178] This protection mechanism can ensure that when the device is in an extremely tight power state, the continuous operation of the basic AOV mode is prioritized, instead of causing the device to shut down quickly due to switching to the high-frame-rate recording mode.
[0179] For ease of understanding, some applicable scenarios in this application are specifically described below.
[0180] Embodiment 1: A scenario of index rollback when switching from the AOV mode to the normal recording mode.
[0181] A battery camera is in the AOV low-power mode, and the AOV writes video frames at 15-second intervals. At this time, the device power is 65%. The UTC corresponding to the end video frame of the AOV recording segment A is 2026-05-14 08:46:58 (corresponding to frame index 1427244).
[0182] Subsequently, a motion event in the current scene is detected around 08:47:00, the camera system is woken up and needs to switch from the AOV mode to the normal recording mode.
[0183] Therefore, step S1: complete the writing of recording segment A in the AOV mode, record lastSegmentIndex=1427244, lastSegmentUtc=08:46:58. Then perform hardware frequency recovery: the CPU recovers from 400MHz to 800MHz, the DDR recovers from 400MHz to 933MHz, and the ISP resumes normal operation.
[0184] Step S2: The normal recording module executes Record_Start, obtains the earliest candidate frame (the first candidate start frame) from its corresponding pre-recording queue, with its index newIndex=1427143 and UTC newUtc=08:46:59. After continuity verification, it is found that newIndex < lastSegmentIndex, and an index dimension abnormality is determined.
[0185] Step S3: Enter Index Correction. Search backwards in the pre-recording queue for the second candidate start frame, and find the second candidate start frame that meets the preset candidate conditions (frameIndex>1427244 and frameUtc>08:46:58). For example, the I-frame with index 1427248 has a UTC of 08:47:02. Determine it as the current valid start frame in normal recording mode.
[0186] Step S4: The current battery level is 65%, which is higher than the first threshold of 50%. T_threshold uses the first threshold time of 2 seconds. The current UTC is identified as 08:47:07 in real time, ΔT = 9 seconds > 2 seconds, indicating a recording hole. Compensation based on frame insertion is initiated. For example, a transition recording segment is generated using the end video frame of the AOV recording segment, inserting two I-frames with timestamps of 08:46:59 and 08:47:01. A valid start frame in normal recording mode (08:47:02) is then appended after the transition recording segment.
[0187] Step S5: Write a complete video file containing the transition video segment and the normal video segment. During playback, the user can observe the transition from 08:46:58 to 08:47:02, after which the high frame rate recording in normal mode resumes, resolving the time discontinuity issue.
[0188] Example 2: A scenario where the battery is fully charged when switching from normal recording mode to AOV mode.
[0189] The device is currently in normal recording mode with a normal frame rate of 15fps and a current battery level of 72%. The no-event timer has been running for 27 seconds. When the mode switching time threshold is reached (e.g., 30 seconds), the continuous no-event switching strategy will be triggered, and the device will enter AOV mode.
[0190] At this point, the system can obtain the device's current battery level information as 72%, which is higher than the first battery threshold of 50%. Therefore, the target countdown duration is determined to be the first duration (4 seconds). The countdown timer is started and begins to count down for 4 seconds. During the countdown, normal recording continues based on the normal recording mode, and each captured frame is sent to the frame buffer.
[0191] When the countdown ends, the last video frame's lastSegmentIndex is precisely locked at 2000100, and lastSegmentUtc at 12:00:05. After confirming entry into AOV mode, a deep hardware downclock is performed: CPU downclocked to 400MHz, DDR downclocked to 400MHz, and ISP downclocked. The pre-recording queue is adapted to retain only a lightweight buffer of 2-3 I-frames.
[0192] After the system switches to AOV mode, the new acquisition frame of the image sensor can be determined as the valid start frame, newUtc=12:00:05+100ms, which meets the preset candidate conditions.
[0193] Furthermore, with the battery at 72%, the corresponding T_threshold is 2 seconds. ΔT ≈ 0.1 seconds, which is much smaller than the time difference threshold, so no video hole compensation is needed.
[0194] Therefore, the AOV recording segment can continue directly from 12:00:05 onwards, seamlessly connecting with the regular recording segment. Furthermore, the device can continue AOV recording in a low-power state after frequency reduction.
[0195] Example 3: Compensation scenario where the AOV interval is greater than the pre-recorded queue duration.
[0196] If the AOV frame interval is 15 seconds, the pre-recording queue duration for normal recording is 5 seconds. The UTC of the last video frame of the AOV segment is 08:00:00. When a target event is detected, the current UTC is 08:00:12, and the first candidate start frame in the pre-recording queue is 08:00:07. Current battery level is 55%.
[0197] 1. Record lastSegmentUtc=08:00:00. Perform hardware frequency recovery.
[0198] 2. The frame timestamp of the first candidate starting frame is 08:00:07, which satisfies the time increment condition and passes the continuity check.
[0199] 3. Battery level 55% > 50%, time difference T_threshold is 2 seconds. ΔT = 12 seconds > 2 seconds, indicating a recording gap. Compensation can be achieved by recalibrating the time metadata of the recording file. For example, retain the 08:00:07 frame as the valid start frame, and recalibrate the startTime of the ordinary recording segment file to 08:00:00. During playback, the time bar can continuously advance from 08:00:00, displaying the first 7 seconds of the valid start frame. Thus, all high frame rate pre-recorded frames can be completely preserved.
[0200] Example 4: Race condition retry scenario when switching from AOV mode to normal recording mode.
[0201] When the device switches from AOV mode to normal recording mode, there is a certain probability that there are no new normal frames in the pre-recording queue (for example, the encoder has not yet recovered from the low frequency state to the high frequency state).
[0202] At this point, the system will not immediately abandon the handover operation, but can choose to enter a waiting state: waiting for a preset waiting time (e.g., 100ms) each time, and checking whether a normal I-frame that meets the conditions has appeared in the pre-recorded queue. A retry threshold can be limited (e.g., a maximum of 30 retries, with a total waiting time of approximately 3 seconds).
[0203] If the first normal I-frame is successfully acquired within the retry count, this frame is used as the valid start frame of the normal recording segment, and subsequent steps continue. If a valid start frame is not acquired after the maximum number of retries, the mode switching instruction is not executed, i.e., the recording mode is not switched to, and the AOV low-power mode is maintained. An exception log is recorded for subsequent analysis.
[0204] This mechanism effectively solves the race condition problem caused by encoder delay when switching from AOV mode to normal mode, and avoids the direct generation of recording holes due to a brief period of no frames available.
[0205] It should be further noted that the execution entity of the recording continuity maintenance method during recording mode switching can be a recording continuity maintenance device during recording mode switching. For example, the recording continuity maintenance method during recording mode switching can be executed by a terminal device, a server, or other processing devices. The terminal device can be a user equipment (UE), computer, mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, this recording continuity maintenance method during recording mode switching can be implemented by the processor calling computer-readable instructions stored in memory.
[0206] Figure 2 This is a block diagram illustrating a recording continuity maintenance device during recording mode switching, as shown in an exemplary embodiment of this application. Figure 2 As shown, the exemplary recording continuity maintenance device 200 during recording mode switching includes: an acquisition module 210, a continuity verification module 220, a valid frame search module 230, and a recording generation module 240. Specifically: The acquisition module 210 is used to acquire the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode in response to receiving a mode switching instruction from the first recording mode to the second recording mode.
[0207] The continuity verification module 220 is used to perform continuity verification on the end video frame and the first candidate start frame to obtain the continuity verification result.
[0208] The valid frame search module 230 is used to search for a second candidate starting frame that meets the preset candidate conditions if the continuity check result indicates a continuity anomaly, and obtain a valid starting frame.
[0209] The video recording generation module 240 is used to generate a video recording file based on the end video frame and the valid start frame, thereby obtaining the target video recording file.
[0210] In this exemplary recording continuity maintenance device during recording mode switching, the recording modes may include at least a first recording mode and a second recording mode. Upon receiving a mode switching command from the first recording mode to the second recording mode, the device can acquire the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode. By performing a continuity check on the end video frame and the first candidate start frame, a continuity check result is obtained. Based on the continuity check result, it can be determined whether the end video frame before and after the mode switch has continuity with the first candidate start frame. If the continuity check result indicates a continuity anomaly, a second candidate start frame that meets preset candidate conditions is searched from the candidate video frames captured in the second recording mode to obtain a valid start frame. A recording file is generated based on the end video frame and the valid start frame to obtain a continuous target recording file, thus maintaining the continuity of the recording file before and after the recording mode switch.
[0211] It should be noted that the apparatus and method provided in the above embodiments belong to the same concept, and the specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here. In practical applications, the apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above, and this is not a limitation.
[0212] The functions of each module can be found in the implementation example of the recording continuity maintenance method during recording mode switching, and will not be repeated here.
[0213] Please see Figure 3 , Figure 3 This is a schematic diagram of an embodiment of the electronic device of this application. The electronic device 100 includes a memory 101 and a processor 102. The processor 102 is used to execute program instructions stored in the memory 101 to implement the steps in the above-described method embodiment for maintaining recording continuity during any recording mode switching. In a specific implementation scenario, the electronic device 100 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 100 may also include mobile devices such as laptops and tablets, which are not limited here.
[0214] Specifically, processor 102 controls itself and memory 101 to implement the steps in the recording continuity maintenance method embodiment during any of the above-described recording mode switching. Processor 102 can also be referred to as a CPU (Central Processing Unit). Processor 102 may be an integrated circuit chip with signal processing capabilities. Processor 102 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 102 can be implemented using integrated circuit chips.
[0215] In this exemplary electronic device, the recording modes may include at least a first recording mode and a second recording mode. Upon receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the device can acquire the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode. By performing a continuity check on the end video frame and the first candidate start frame, a continuity check result is obtained. Based on this result, it can be determined whether the end video frame before and after the mode switch has continuity with the first candidate start frame. If the continuity check result indicates an abnormal continuity, a second candidate start frame that meets preset candidate conditions is searched from the candidate video frames captured in the second recording mode to obtain a valid start frame. A recording file is generated based on the end video frame and the valid start frame to obtain a continuous target recording file, maintaining the continuity of the recording file before and after the recording mode switch.
[0216] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. The computer-readable storage medium 110 stores program instructions 111 that can be executed by a processor. The program instructions 111 are used to implement the steps in the embodiment of the recording continuity maintenance method when switching any of the above recording modes.
[0217] In this exemplary storage medium, the recording modes may include at least a first recording mode and a second recording mode. By running program instructions in the storage medium, upon receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the system can acquire the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode. A continuity check is performed on the end video frame and the first candidate start frame to obtain a continuity check result. Based on this result, it can be determined whether the end video frame and the first candidate start frame before and after the mode switch are continuous. If the continuity check result indicates an abnormal continuity, a second candidate start frame that meets preset candidate conditions is searched from the candidate video frames captured in the second recording mode to obtain a valid start frame. A recording file is generated based on the end video frame and the valid start frame to obtain a continuous target recording file, maintaining the continuity of the recording file before and after the recording mode switch.
[0218] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0219] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0220] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0221] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for maintaining recording continuity during recording mode switching, characterized in that, The recording modes include a first recording mode and a second recording mode, and the method includes: In response to receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the system acquires the end video frame captured in the first recording mode and the first candidate start frame captured in the second recording mode. A continuity check is performed on the end video frame and the first candidate start frame to obtain a continuity check result; If the continuity check result indicates a continuity anomaly, then a second candidate starting frame that meets the preset candidate conditions is searched to obtain a valid starting frame; The target video file is generated based on the ending video frame and the valid starting frame.
2. The method according to claim 1, characterized in that, The step of performing a continuity check on the end video frame and the first candidate start frame to obtain a continuity check result includes: Index continuity detection is performed based on the end frame index of the ended video frame and the first start frame index of the first candidate start frame to obtain the index detection result; A time continuity detection is performed based on the end frame time of the ended video frame and the first start frame time of the first candidate start frame to obtain a time detection result; The continuity verification result is determined based on the index detection result and the time detection result.
3. The method according to claim 2, characterized in that, Determining the continuity verification result based on the index detection result and the time detection result includes: Determine whether the index detection result indicates that the end frame index is less than the first start frame index, and whether the time detection result indicates that the end frame time is less than the first start frame time; If so, then a continuity check result representing normal continuity is obtained; If not, then the continuity check result representing the continuity anomaly is obtained.
4. The method according to claim 1, characterized in that, The process of finding a second candidate starting frame that meets preset candidate conditions to obtain a valid starting frame includes: Based on at least one of the pre-recording queue, frame buffer, and currently captured frame corresponding to the second recording mode, at least one second candidate start frame is determined; The effective start frame is determined from the at least one second candidate start frame according to the preset candidate conditions; the preset candidate conditions include: the end frame index is less than the target frame index of the effective start frame, and the end frame time of the end video frame is less than the target frame time of the effective start frame.
5. The method according to claim 1, characterized in that, After finding a second candidate starting frame that meets preset candidate conditions and obtains a valid starting frame if the continuity check result indicates a continuity anomaly, the method further includes: Obtain the time difference threshold; The time difference is determined based on the end frame time of the ended video frame and the current system time of the device. Based on the time difference value and the time difference threshold, determine whether there is a recording hole; If so, the video hole is compensated.
6. The method according to claim 5, characterized in that, The acquisition of the time difference threshold includes: Get the device's current battery level information; Based on the current battery level information of the device, a corresponding target time difference threshold is determined within a preset time difference threshold. The target time difference threshold is negatively correlated with the current battery level information of the device.
7. The method according to claim 5, characterized in that, The compensation process for the video recording holes includes: A transition video segment is generated based on the ending video frame and the valid starting frame; The video holes are compensated based on the transition video segments; Alternatively, the time metadata of the target video file can be recalibrated based on the current system time of the device.
8. The method according to claim 1, characterized in that, The first recording mode is a normal mode, and the second recording mode is a low-power mode. The step of responding to receiving a mode switching instruction to switch from the first recording mode to the second recording mode, acquiring the end video frame captured in the first recording mode, and acquiring the first candidate start frame captured in the second recording mode, includes: Get the device's current battery level information; Based on the current battery level of the device, a target countdown timer is determined within a preset countdown timer, and the target countdown timer is positively correlated with the current battery level of the device. Based on the target countdown duration and the mode switching instruction, mode switching processing and image acquisition processing are performed to obtain the end video frame and the first candidate start frame.
9. The method according to claim 8, characterized in that, The mode switching process includes: By reducing the frequency of the device hardware, a low-power hardware environment can be obtained. The pre-recording queue corresponding to the normal mode is buffered and reduced to obtain the pre-recording queue corresponding to the low-power mode.
10. The method according to claim 1, characterized in that, The first recording mode is a low-power mode, the second recording mode is a normal mode, and after receiving a mode switching instruction to switch from the first recording mode to the second recording mode, the method further includes: Get the device's current battery level information; If the current battery level of the device is less than the preset mode switching battery threshold, the mode switching command will not be executed.
11. An electronic device, characterized in that, The method includes a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 10.
12. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, they implement the method described in any one of claims 1 to 10.
