Video generation method and photographic device
By saving and updating time stamps in the recording device, the problem of video files not being able to be merged after the recording device is unexpectedly stopped is solved, enabling seamless continuation of video content recording and improving the automation level of the recording device and user experience.
Patent Information
- Application Number
- CN202510644272.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2026-11-20
AI Technical Summary
When the recording device is interrupted unexpectedly during recording, the video-related information before the recording was stopped is not written to the end of the file, making it impossible to read the recorded video file normally and thus preventing the video recording from resuming.
When the recording device encounters an abnormal stop command, the first video file is saved, and when the user issues a re-recording command, the second video file is captured. The target video file is generated based on these two video files, and the video files are seamlessly connected on the timeline through time stamp updates and connection processing.
It enables seamless continuation of video recording, allowing users to merge video content before and after a power outage into a single complete file without the need for professional video processing software, thus improving the efficiency and quality of video recording continuation.
Smart Images

Figure CN123145377A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, and in particular to a video generation method and shooting device. Background Technology
[0002] During the recording process, the recording may be unexpectedly interrupted due to some external factors, such as the recording device having low battery power or other system problems.
[0003] Shooting equipment typically stores recorded video files in formats such as MP4. After recording is complete, relevant information is written to the end of the video file and packaged into the target video file format, allowing the video file to be read successfully. However, if recording is interrupted, the video information from before recording stopped is not written to the end of the file, making the recorded video file unreadable. This prevents the merging of the resumed video with the previous video into a single file, making it difficult to resume recording when the equipment unexpectedly loses power. Summary of the Invention
[0004] Therefore, it is necessary to provide a video generation method and a shooting device that can support video recording continuation function when the shooting device unexpectedly loses power, in order to address the above-mentioned technical problems.
[0005] Firstly, this application provides a video generation method applied to a shooting device. The method includes:
[0006] In response to an abnormal termination command, a first video file is saved; the first video file includes the video file recorded by the shooting device before the abnormal termination of recording;
[0007] In response to the re-recording command, the second video file corresponding to the first video file is acquired;
[0008] A target video file is generated based on the first video file and the second video file.
[0009] Secondly, this application also provides a shooting device. The shooting device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0010] In response to an abnormal termination command, a first video file is saved; the first video file includes the video file recorded by the shooting device before the abnormal termination of recording;
[0011] In response to the re-recording command, the second video file corresponding to the first video file is acquired;
[0012] A target video file is generated based on the first video file and the second video file.
[0013] The aforementioned video generation method and shooting device, in response to an abnormal stop command, save a first video file; the first video file includes video files recorded by the shooting device before the abnormal stop recording; in response to a re-recording command, acquire a second video file corresponding to the first video file; and generate a target video file based on the first video file and the second video file. This solution saves the first video file when the shooting device encounters an abnormal stop command, acquires the second video file when the user issues a re-recording command, and finally automatically generates a complete target video file based on these two video files. This allows users to seamlessly resume video recording without the need for professional video processing software, thereby improving the efficiency of video continuation recording. Compared with existing technologies, this solution solves the problem that traditional recording devices fail to write the end of the video file after unexpected recording stop, making it impossible to successfully read the recorded video file. It enables the successful reading of recorded video files after unexpected recording stop and supports video continuation recording functionality when the shooting device unexpectedly stops recording. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying 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.
[0015] Figure 1 This is a flowchart illustrating a video generation method in one embodiment;
[0016] Figure 2 This is a flowchart illustrating the steps for generating a target video file in one embodiment;
[0017] Figure 3 This is a schematic diagram of the file continuation process in one embodiment;
[0018] Figure 4 This is an internal structural diagram of the imaging device in one embodiment. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0020] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0021] In one exemplary embodiment, such as Figure 1 As shown, a video generation method is provided. This embodiment illustrates the application of this method to a shooting device. It is understood that this method can also be applied to a terminal or server, and further to a system including both a terminal and a server, implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, etc.; the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. In this embodiment, the method includes the following steps:
[0022] Step S101: In response to the abnormal termination command, save the first video file; the first video file includes the video file recorded by the shooting device before the abnormal termination of recording.
[0023] Step S102: In response to the re-recording command, acquire the second video file corresponding to the first video file.
[0024] Step S103: Generate the target video file based on the first video file and the second video file.
[0025] The shooting device can be an electronic device used to record video, such as a video recorder, camera, or other device capable of video capture.
[0026] Among them, the abnormal stop instruction can be a signal or command that causes the current recording to be unexpectedly stopped. For example, the abnormal stop instruction can be a signal that causes the recording process to be unexpectedly stopped due to the low battery power of the handheld recording device, other system problems, or accidental touches by the user during the recording process.
[0027] The first video file can be video content recorded by the shooting device before the recording was abnormally stopped. For example, the first video file can be video content recorded before the power outage or the accidental stop.
[0028] The re-recording instruction can be a signal or command from the user to resume recording. For example, the re-recording instruction can be an operation signal for the user to resume recording based on the video that was unexpectedly stopped after the video was unexpectedly stopped.
[0029] The second video file can be video content captured by the shooting device after responding to the re-recording command. For example, the second video file can be new video content captured from the camera and microphone when the user chooses to continue recording after a power outage or accidental interruption.
[0030] The target video file can be a complete video file generated by merging the first video file and the second video file. For example, the target video file can be a complete MP4 file generated by automatically merging the video content taken before and after the power outage. Users can seamlessly preview and play the content before and after the power outage without having to manually extract and transcode it.
[0031] Optionally, during recording, when an abnormal stop command is detected, the recording device saves the currently recorded first video file, which contains all video content recorded by the recording device before the abnormal stop. Then, when the recording device resumes normal operation, it responds to a user's re-recording command. At this time, the recording device acquires new video data through the camera and microphone as a second video file, which is continuous in content with the first video file. Subsequently, the recording device concatenates the first video file and the target second video file to obtain the target video file. For example, the concatenation process can refer to merging the first video file and the target second video file in chronological order.
[0032] For example, the recording device could be a handheld video recorder. When the recorder unexpectedly loses power due to low battery during recording, it automatically triggers an abnormal stop command and saves the previously recorded video as a first MP4 video file. When the user replaces the battery or reconnects the power, the recorder prompts the user to resume recording. If the user chooses to continue, a re-recording command is triggered. At this point, the recorder uses its camera and microphone to capture new video data as a second video file. Then, the recorder reads the first video file using a file reading module, decapsulates it using a decapsulation module, and then... The video file extraction module and audio file extraction module extract the video and audio content from the first video file, respectively. At the same time, the video acquisition module and audio acquisition module acquire the content of the second video file. The second video file is then encoded by the video encoding module and audio encoding module. Then, the second video file is sorted by timeline by the video timestamp processing module and audio timestamp processing module, and stored in the video data queue and audio data queue, respectively. Finally, the audio and video encapsulation module merges the first video file and the second video file into a complete MP4 format target video file, and saves it to the storage through the file writing module, so that users can seamlessly preview and play the complete video content before and after the power outage.
[0033] In the aforementioned video generation method, in response to an abnormal stop command, a first video file is saved; the first video file includes video files recorded by the shooting device before the abnormal stop recording; in response to a re-recording command, a second video file corresponding to the first video file is acquired; and a target video file is generated based on the first and second video files. This solution saves the first video file when the shooting device encounters an abnormal stop command, acquires the second video file when the user issues a re-recording command, and finally automatically generates a complete target video file based on these two video files. This allows users to seamlessly resume video recording without the need for professional video processing software, thereby improving the efficiency of video continuation recording. Compared with existing technologies, this solution solves the problem of traditional recording devices generating two independent video files after unexpected stoppage. Users do not need to manually extract and transcode videos, ensuring that the content recorded before and after the power outage is presented continuously, simplifying the user's operation process.
[0034] In one exemplary embodiment, reference is made to Figure 2 Based on the first video file and the second video file, a target video file is generated, which specifically includes the following:
[0035] Step S201: Update the timestamp of the second video file according to the timestamp of the first video file to obtain the target second video file;
[0036] Step S202: The first video file and the target second video file are concatenated to obtain the target video file.
[0037] Among them, time stamps can refer to the marking information used in video files to mark the position of audio and video data on the timeline. For example, a time stamp can be a timestamp (PTS).
[0038] The update process can refer to the operation of adjusting the time stamp of the second video file. For example, the update process can be to modify the time stamp of the second video file so that it is aligned with the end time of the first video file on the timeline.
[0039] The target second video file can refer to the second video file after the time stamp update process. For example, the target second video file can be the second video file after the time stamp is adjusted, and its start time point is continuous with the end time point of the first video file on the time axis.
[0040] The connection process can refer to the process of merging the first video file and the target second video file in chronological order. For example, the connection process can be to merge and encapsulate the first video file and the target second video file to generate a continuous and complete video file on the timeline.
[0041] Optionally, when generating the target video file based on the first video file and the second video file, the shooting device first reads the first video file saved before the abnormal termination through the file reading module and extracts the time stamp information from the first video file; then, the shooting device analyzes the time stamp corresponding to the last frame of video and audio in the first video file and uses this time stamp as the reference time point; next, the shooting device updates the time stamp of each frame of video and audio data in the newly acquired second video file to ensure that the second video file is seamlessly connected with the first video file on the timeline, and uses the second video file with the updated time stamp as the target second video file; finally, the shooting device connects the first video file and the target second video file in chronological order, merges the contents of the two video files onto the same timeline, and encapsulates the merged content into a complete target video file.
[0042] The technical solution provided in this embodiment updates the time stamp of the second video file based on the time stamp of the first video file and concatenates the two video files. This ensures seamless connection between the two video files on the timeline, thereby facilitating the generation of a single, chronologically continuous target video file. This solution solves the problem of discontinuous playback caused by storing video content before and after a power outage as two separate files, as in traditional methods. It achieves reasonable connection of time stamps, enabling the two video segments to be organized in the correct chronological order, ensuring a smooth and continuous video experience for the user, and improving the efficiency and quality of video recording continuation.
[0043] In an exemplary embodiment, the time identifier of the second video file is updated according to the time identifier of the first video file to obtain the target second video file. Specifically, this includes: updating the time identifier of the second video file according to the end time identifier of the first video file to obtain the target second video file; the start time identifier of the target second video file is the next consecutive time identifier after the end time identifier of the first video file.
[0044] The end time identifier can be the time identifier corresponding to the last frame of video and audio data in the first video file. For example, the end time identifier can be the timestamp of the last frame of video extracted from the first video file.
[0045] The next consecutive time marker can be a time marker value that immediately follows the end time marker of the first video file. For example, the next consecutive time marker can be the end time marker of the first video file plus a time marker value of one time unit (such as the duration of one frame), ensuring that the first frame of the second video file is exactly after the last frame of the first video file on the timeline.
[0046] The start time identifier can be the time identifier corresponding to the first frame of the updated second video file. For example, the start time identifier can be the timestamp of the first frame of the target second video file, which is continuous with the end timestamp of the first video file on the timeline.
[0047] Optionally, when updating the timestamps of the second video file, the shooting device first reads the first video file and decapsulates it. Then, it extracts the video and audio content from the first video file to obtain the end timestamp of the first video file. Next, the shooting device calculates the timestamp value of the last frame of the first video file. At this point, the shooting device updates the original timestamp sequence of the second video file by adding the timestamp value of each frame in the second video file to the end timestamp value of the first video file, so that the start timestamp value of the second video file is exactly equal to the end timestamp value of the first video file plus a minimum time unit (such as the duration of a frame). This ensures that the start timestamp of the target second video file and the end timestamp of the first video file are seamlessly connected on the timeline. In this way, the shooting device converts the original second video file into a target second video file with updated timestamps.
[0048] The technical solution provided in this embodiment, by obtaining the end time identifier of the first video file and setting the start time identifier of the target second video file as the next consecutive time identifier after the end time identifier of the first video file, helps to establish a continuous relationship between the two video files on the timeline. This helps to avoid problems such as time jumps, overlaps, or gaps at the video splicing points, ensuring the accurate connection of video content in time sequence. This allows users to obtain a completely coherent video playback experience when watching the merged target video file, thereby improving the quality of video recording after power failure.
[0049] In an exemplary embodiment, the first video file and the target second video file are concatenated to obtain the target video file. Specifically, this includes: storing the first video file in a video file queue and storing the target second video file in the video file queue; and concatenating the first video file and the target second video file in the video file queue to obtain the target video file.
[0050] Among them, the video file queue can be a data structure that stores and manages video files in chronological order. For example, the video file queue can be a storage area used to temporarily store the first video file and the target second video file so that these video files can be processed uniformly in the first-in-first-out order.
[0051] Optionally, when the shooting device performs the connection processing of the first video file and the target second video file, it first reads the first video file into the system memory, decapsulates the first video file, and then extracts the video and audio content. Next, it stores the extracted content of the first video file into a video file queue, which manages video data in chronological order. Simultaneously, the shooting device processes the target second video file through the same process and stores the extracted content into the same video file queue in chronological order. At this point, the video file queue contains all the content of the first video file and the target second video file in chronological order. Subsequently, the shooting device performs connection processing on all the content in the video file queue to ensure the continuity of the video and audio content on the timeline and encapsulates all the content into a complete target video file.
[0052] The technical solution provided in this embodiment, by storing the first video file and the target second video file sequentially into the same video file queue and performing unified concatenation processing on the files in the queue, facilitates the establishment of an orderly data processing flow, thereby simplifying the complexity of video file merging. This solution uses a queue structure as an intermediate processing step. Through this processing method, video content recorded before and after a power outage can be organized in an orderly manner and seamlessly connected, ultimately forming a complete video file with a continuous timeline, improving the automation level and processing efficiency of video recording continuation.
[0053] In one exemplary embodiment, the target video file includes target video data and target audio data; it also includes the following: encapsulating the target audio data and target video data to obtain the target video file.
[0054] The target video data can be a complete video data stream after processing. For example, the target video data can be a continuous video data stream formed by concatenating the video content of a first video file and a target second video file.
[0055] The target audio data can be a complete audio data stream after processing. For example, the target audio data can be a continuous audio data stream formed by concatenating the audio content of the first video file and the target second video file.
[0056] The encapsulation process can be the process of merging video data streams and audio data streams into a standard container format. For example, the encapsulation process can be the process of organizing the target video data and target audio data according to a specific format (such as MP4 format) through an audio and video encapsulation module to make it conform to a specific video file standard, so that the final target video file can be played normally by the player.
[0057] Optionally, during the process of connecting the first and second video files, the shooting device first processes and connects the video data of the two video files to form a complete target video data stream. Simultaneously, the shooting device processes and connects the audio data of the two video files to form a complete target audio data stream. Subsequently, the shooting device encapsulates the target video and audio data, organizing and integrating these two different types of data streams according to the specifications of a standard multimedia container format (such as MP4). Through this encapsulation process, the shooting device ultimately generates a standard format target video file containing complete video and audio content, which can be normally recognized and played by a conventional video player.
[0058] The technical solution provided in this embodiment processes the target video data and target audio data as independent data streams before performing unified encapsulation processing. This facilitates efficient synchronization and integration of video and audio data, thereby ensuring the audio-visual synchronization of the final generated target video file. This processing method enables seamless connection of the content recorded before and after a power outage at both the audio and video levels.
[0059] In an exemplary embodiment, prior to responding to a re-recording instruction, the method further includes: displaying an operation prompt interface upon detecting an abnormal recording interruption event; the operation prompt interface includes a re-recording option; and receiving a re-recording instruction upon detecting a trigger instruction for the re-recording option.
[0060] Among them, abnormal recording termination events can be system or user operation events that cause video recording to terminate unexpectedly. For example, abnormal recording termination events can be events such as low battery power of the shooting device, other system problems, or accidental touches by the user during the recording process that cause the recording process to terminate unexpectedly.
[0061] The operation prompt interface can be an interactive interface displayed to the user after an abnormal recording interruption event is detected. For example, the operation prompt interface can be an interface displayed on the screen of the shooting device that allows the user to choose whether to continue recording based on the video that was unexpectedly interrupted.
[0062] The re-recording option can be a function option provided to the user in the operation prompt interface. For example, the re-recording option can be a button or icon in the operation prompt interface, which the user can click to resume recording based on the video that was unexpectedly stopped.
[0063] The trigger command can be a command generated by the user's operation on the re-recording option. For example, the trigger command can be a command generated by the user clicking, swiping or touching the re-recording option button in the prompt interface.
[0064] Optionally, during video recording, the camera monitors the system status in real time, including key parameters such as battery level, storage space, and system operating status. When the camera detects an abnormal recording interruption event, such as low battery, system crash, or accidental interruption due to user touch, it immediately saves the first recorded video file. After the system returns to normal, it automatically displays an operation prompt interface on the screen. This interface informs the user that recording has been abnormally interrupted and provides several options, including a re-recording option. This re-recording option is usually displayed as a prominent button with text descriptions, allowing the user to intuitively understand that the option's function is to continue recording based on the previously interrupted video. The camera continuously monitors the user's actions on the operation prompt interface. When it detects that the user has triggered a re-recording command through clicking, touching, or other interactive methods, the camera immediately receives and processes the command, converting it into an internal re-recording command to prepare for subsequent video continuation.
[0065] The technical solution provided in this embodiment displays an operation prompt interface when an abnormal recording interruption event is detected, and receives a re-recording command after the user triggers the re-recording option, allowing the user to actively choose whether to resume video recording. This solution provides users with an intuitive and simple decision-making mechanism, enabling them to decide whether to continue recording based on the previous video according to actual needs. Through this interactive processing method, the user's control over the video recording process is preserved, the operation process for resuming video recording is simplified, and the intelligence level of the shooting equipment is improved.
[0066] In one exemplary embodiment, the operation prompt interface further includes a video file generation option; it also includes the following: upon detecting a trigger command for the video file generation option, the first video file is encapsulated.
[0067] The video file generation option can be a function button or option provided in the operation prompt interface. For example, the video file generation option can be a "Generate Video Directly" or "Save Recorded Content" button displayed on the operation prompt interface when the user does not want to continue recording but wants to save the recorded content. The user can click the button to choose to process the first video file independently without continuing the recording operation.
[0068] Optionally, when displaying the operation prompt interface, the shooting device not only provides a re-recording option but also a video file generation option on the same operation prompt interface. This video file generation option can be presented on the interface as "directly generate video" or "save recorded content," allowing users to choose whether to save only the recorded content according to their actual needs. This option can be selected when the user does not want to continue recording but only wants to retain the video content before the abnormal termination. The shooting device will continuously monitor the user's operation behavior on the operation prompt interface. When the shooting device detects that the user has triggered a trigger command for the video file generation option through clicking, touching, or other interactive methods, the shooting device will respond to the trigger command, encapsulate the first video file, and generate an independent and complete playable video file.
[0069] The technical solution provided in this embodiment offers a video file generation option in the operation prompt interface, and encapsulates the first video file after detecting that the user has triggered the option. This provides users with a more flexible way to process recorded content and improves the intelligence level of the shooting device.
[0070] In an exemplary embodiment, the method further includes: obtaining the user's setting instruction for the video continuation recording function; and displaying an operation prompt interface when an abnormal recording interruption event is detected, specifically including: displaying an operation prompt interface when the setting instruction indicates that the video continuation recording function is enabled and an abnormal recording interruption event is detected.
[0071] Among them, the user's setting command for the video continuation recording function can be the operation command for the user to enable or disable the video continuation recording function through the shooting device interface.
[0072] Among them, the video continuation recording function can be a function provided by the shooting device that can continue recording based on the already recorded video and automatically merge it into a single file after the video recording is unexpectedly interrupted.
[0073] Optionally, the shooting device provides a system settings interface upon startup or before entering the recording function, allowing users to personalize the video continuation recording function. The shooting device obtains the user's settings instructions for the video continuation recording function through this interface and stores these instructions in the system configuration file. Users can enable or disable the video continuation recording function. When a user chooses to enable the video continuation recording function, the shooting device records this setting in the system configuration file. During subsequent recording, if the shooting device detects an abnormal recording interruption event such as low battery power, system crash, or accidental user touch, the shooting device first checks the video continuation recording function settings in the system configuration file. Only when both conditions are met—confirming that the user has previously enabled the video continuation recording function through settings and confirming that an abnormal recording interruption event has occurred—will the shooting device display an operation prompt interface containing a re-recording option. If the user has not enabled the video continuation recording function, the shooting device will not display an operation prompt interface even if an abnormal recording interruption event occurs.
[0074] The technical solution provided in this embodiment obtains the user's setting instructions for the video continuation recording function and only displays the operation prompt interface when the user enables this function and an abnormal recording interruption event is detected. This facilitates the personalized customization of the video continuation recording function, thereby improving the intelligence level of the shooting equipment and reducing unnecessary resource consumption and user operation burden.
[0075] In one exemplary embodiment, the method further includes: obtaining a user's setting instruction for the video continuation recording function; and responding to a re-recording instruction when the setting instruction indicates that the video continuation recording function is enabled and the shooting device is detected to be connected to power and / or powered on.
[0076] Connecting the shooting device to a power source can refer to the act of connecting the shooting device to an external power source via a power adapter or charging cable.
[0077] Optionally, the shooting device first obtains the user's setting command for the video continuation recording function through the system settings interface. This setting command indicates whether the user wants to enable the video continuation recording function. The shooting device saves the user's setting command in the system configuration file. When the recording is unexpectedly interrupted due to low battery power, system problems, or user accidental touch, the shooting device will automatically save the recorded content as the first video file. Subsequently, when the shooting device is connected to power by the user (such as connected to a power outlet or power bank) and / or restarted after being turned off, the shooting device will automatically detect two conditions: first, whether the user has previously enabled the video continuation recording function through the setting command; and second, whether the shooting device is connected to power and / or powered on. Only when both conditions are met will the shooting device respond to the re-recording command and start the video continuation recording process.
[0078] The technical solution provided in this embodiment obtains the user's setting command for the video continuation recording function and responds to the re-recording command when the user enables the function and the shooting device is connected to power and / or turned on. This helps to intelligently control the activation timing of the video continuation recording function according to user preferences and device status, thereby improving the intelligence level of the shooting device and reducing unnecessary resource consumption and user operation burden.
[0079] In one exemplary embodiment, prior to responding to the re-recording instruction, the method further includes: receiving user interaction input; and responding to the re-recording instruction when the user interaction input indicates that the video continuation recording function is enabled.
[0080] User interaction input can be actions performed by the user through interface elements of the shooting device. For example, user interaction input can be actions such as clicking buttons, sliding switches, or selecting specific options on the operation prompt interface of the shooting device, or interactive operations performed by the user through touch screen, buttons, or other input devices in the system settings interface.
[0081] Optionally, if the recording device encounters an abnormal recording interruption event during video recording, it will first save the recorded content as a first video file. Subsequently, when the recording device resumes normal operation and displays the operation prompt interface, the recording device will wait for and receive user interaction input. This interaction input can be operations performed by the user on the operation prompt interface, such as clicking a specific button, sliding a specific switch, or selecting a specific option. The recording device will analyze the user's interaction input to determine whether the interaction input indicates that the video continuation recording function is enabled. Only when the user's interaction input indicates that the video continuation recording function is enabled, such as when the user clicks the continue recording button on the operation prompt interface, will the recording device respond to the re-recording instruction.
[0082] The technical solution provided in this embodiment, by receiving and judging whether the user's interactive input indicates the activation of the video continuation recording function before responding to the re-recording instruction, helps to incorporate the user's real-time intention into the continuation recording decision process, thereby improving the intelligence level of the shooting equipment and the human-computer interaction experience, and making the video continuation recording function more in line with the user's actual usage needs.
[0083] In an exemplary embodiment, the method further includes the following: if the format of the first video file is a preset format, the first video file is decapsulated to obtain the target first video file.
[0084] The preset format can be a specific video file storage format supported by the shooting device, such as MP4 format.
[0085] Decapsulation processing can be the process of extracting audio and video data from a video file with a specific encapsulation format.
[0086] The target first video file can be a file containing audio and video data obtained after decompression processing. For example, the target first video file can be video data and audio data extracted from a first video file in MP4 format.
[0087] Optionally, when the shooting device responds to the user's re-recording command to resume video recording, it first checks the format of the first video file that was automatically saved due to an abnormal interruption. The shooting device checks whether the format of the first video file is a preset format supported by the system, such as MP4. If the detection confirms that the format of the first video file is a preset format, the shooting device calls the video file decapsulation module to decapsulate the first video file, that is, to extract the audio and video data from the first video file with the encapsulated format. Then, the shooting device further extracts the video data and audio data from the first video file through the video content extraction module and the audio content extraction module, respectively. After the extraction is completed, the shooting device sends the target first video file containing video data and audio data to the subsequent processing flow so as to merge it with the newly recorded content.
[0088] The technical solution provided in this embodiment obtains the target first video file by decapsulating the first video file when the first video file format is a preset format. This is beneficial for converting the encapsulated video file into a media stream containing the original audio and video data, thereby improving the efficiency and compatibility of subsequent audio and video processing.
[0089] In an exemplary embodiment, the method further includes: extracting a target first video file from the first video file if the format of the first video file is not a preset format.
[0090] Optionally, when the shooting device performs a video continuation operation in response to the user's re-recording command, it will first check the format of the first video file that was automatically saved due to abnormal termination. The shooting device will check whether the format of the first video file is a preset format supported by the system, such as MP4 format. When it is found that the format of the first video file is not a preset format supported by the system, the shooting device will use a different method than decapsulation to directly extract the target first video file from the first video file, and obtain the video data and audio data of the target first video file. After extraction, the shooting device will send the obtained target first video file containing video data and audio data into the subsequent processing flow so as to merge it with the newly recorded content.
[0091] The technical solution provided in this embodiment simplifies the processing flow for non-preset format files by directly extracting the target first video file when the first video file format is not a preset format, thereby improving the efficiency of video recording continuation.
[0092] The following application example illustrates the video generation method provided in this application. This application example demonstrates how the method is applied to a shooting device.
[0093] Because handheld video recording devices may unexpectedly stop recording due to external factors, such as low battery, other system problems, or accidental user actions, users may want to resume recording from the interrupted video. However, since most cameras use the MP4 video format, the video before and after the recording is resumed are two separate video files. It is very difficult for users to merge the resumed video with the video before the resumption into a single video file, requiring manual processing with professional video editing software.
[0094] This application example addresses the issue of inconsistent MP4 file quality when the recording device loses power. The method automatically merges video content recorded before and after a power outage into a single file, allowing users to preview and play the footage from both ends without manually extracting and transcoding the two MP4 files. In other words, it automatically saves previously recorded content when the device loses power and automatically packages it into a readable video file upon power-on. Resuming recording is optional.
[0095] In this application example, when the user selects to resume recording, the audio and video file content before the resume recording is extracted by the decapsulation module and then sent to the encapsulation module for recapsulation. The data collected in real time from the camera and microphone after the resume recording is then appended to the new encapsulation module for further encapsulation.
[0096] Specifically, refer to the file continuation process. Figure 3Step 1: The shooting device reads the recorded content (video before recording resumes) through the file reading module, decapsulates the recorded content to obtain the decapsulated recorded content, extracts video data (first video data) from the decapsulated recorded content through the video content extraction module, and extracts audio data (first audio data) from the decapsulated recorded content through the audio content extraction module. The first video data is stored in the video data queue, and the first audio data is stored in the audio data queue. Step 2: The shooting device captures the resumed video through the video acquisition module, processes it through the video processing module, video encoding module, and video content extraction module to obtain the second video data, and simultaneously captures the resumed audio through the audio acquisition module, processes it through the audio encoder and audio content extraction module to obtain the second audio data. The second video data is processed by the video timestamp processing module and stored in the video data queue, and the second audio data is processed by the audio timestamp processing module and stored in the audio data queue. The shooting device processes the video data in the video data queue through the video content extraction module to obtain the target video data, and processes the audio data in the audio data queue through the audio content extraction module to obtain the target audio data. After processing the target video data and target audio data through the audio and video encapsulation module and the file writing module, an MP4 video file is obtained.
[0097] The technical solution provided in this application example solves the problem of traditional recording equipment generating two independent video files after an unexpected interruption. Users do not need to manually extract and transcode the video, so that the content recorded before and after the power outage can be presented continuously. Users can achieve seamless continuation of video content recording without any additional operation.
[0098] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0099] Based on the same inventive concept, this application also provides a video generation apparatus for implementing the video generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more video generation apparatus embodiments provided below can be found in the limitations of the video generation method described above, and will not be repeated here.
[0100] In one exemplary embodiment, a shooting device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the imaging device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a video generation method. The display unit of the imaging device is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the shooting device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the shooting device, or external keyboards, touchpads, or mice, etc.
[0101] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the shooting device to which the present application is applied. The specific shooting device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0102] In one exemplary embodiment, an imaging device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0103] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0104] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A video generation method, characterized in that, Applied to a shooting device, the method includes: In response to an abnormal termination command, a first video file is saved; the first video file includes the video file recorded by the shooting device before the abnormal termination of recording; In response to the re-recording command, the second video file corresponding to the first video file is acquired; A target video file is generated based on the first video file and the second video file.
2. The method according to claim 1, characterized in that, The step of generating a target video file based on the first video file and the second video file includes: Based on the timestamp of the first video file, the timestamp of the second video file is updated to obtain the target second video file; The first video file and the target second video file are concatenated to obtain the target video file.
3. The method according to claim 2, characterized in that, The step of updating the timestamp of the second video file based on the timestamp of the first video file to obtain the target second video file includes: Based on the end time identifier of the first video file, the time identifier of the second video file is updated to obtain the target second video file; the start time identifier of the target second video file is the next consecutive time identifier after the end time identifier of the first video file.
4. The method according to claim 2, characterized in that, The step of concatenating the first video file and the target second video file to obtain the target video file includes: The first video file is stored in the video file queue, and the target second video file is stored in the video file queue; The first video file and the target second video file in the video file queue are concatenated to obtain the target video file.
5. The method according to claim 1, characterized in that, The target video file includes target video data and target audio data; The method further includes: The target audio data and the target video data are encapsulated to obtain the target video file.
6. The method according to claim 1, characterized in that, Prior to responding to a re-recording instruction, the method further includes: If an abnormal recording interruption event is detected, an operation prompt interface is displayed; the operation prompt interface includes a re-recording option; If a trigger command for the re-recording option is detected, the re-recording command is received.
7. The method according to claim 6, characterized in that, The operation prompt interface also includes a video file generation option; The method further includes: Upon detecting a trigger command for the video file generation option, the first video file is encapsulated.
8. The method according to claim 6, characterized in that, The method further includes: Obtain user settings instructions for the video continuation recording function; The operation prompt interface is displayed when an abnormal recording interruption event is detected, including: When the setting instruction indicates that the video recording continuation function is enabled, and the abnormal recording interruption event is detected, the operation prompt interface is displayed.
9. The method according to claim 1, characterized in that, The method further includes: Obtain user settings instructions for the video continuation recording function; When the setting instruction indicates that the video recording continuation function is enabled, and the shooting device is detected to be connected to power and / or powered on, the recording device responds to the re-recording instruction.
10. The method according to claim 1, characterized in that, Prior to responding to a re-recording instruction, the method further includes: Receive user interaction input; When the user's interactive input indicates that the video recording continuation function is enabled, the system responds to the re-recording instruction.
11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: If the first video file is in a preset format, the first video file is decapsulated to obtain the target first video file.
12. The method according to any one of claims 1 to 10, characterized in that, The method further includes: If the format of the first video file is not a preset format, extract the target first video file from the first video file.
13. A shooting device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 12.
