Multimedia data processing method and device, equipment, storage medium and program product

By restoring the buffers and buffers of the built-in memory and migrating data between external memory, data loss caused by system failure or memory fragmentation in vehicle multimedia recording is solved, and data storage and system performance are improved.

CN120491886APending Publication Date: 2025-08-15AUTOCHIPS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510337940.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

During the on-board multimedia recording process, data loss problems caused by system failure or excessive memory fragmentation, especially when external memory performance is unstable, data cannot be saved in time, resulting in incomplete or loss of recorded data.

Method used

The multimedia data processing method is adopted to store data in the user buffer and kernel buffer of the built-in memory by calling functions, and store it when the data volume reaches the threshold. The data is written to the external memory during interval preset periods, and data migration is carried out in combination with the performance differences of multiple external memories to ensure data integrity and system performance.

Benefits of technology

Reduce the risk of data loss due to degraded write performance, avoid excessive data loss, improve the integrity of data storage and system performance, especially in the case of unstable external memory performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120491886A_ABST
    Figure CN120491886A_ABST
Patent Text Reader

Abstract

The invention provides a multimedia data processing method and device, equipment, a storage medium and a program product. The processing method comprises the following steps: calling a first function to store multimedia data into a user buffer area in a built-in memory; when the data volume of the multimedia data in the user buffer area exceeds a first data volume threshold value, automatically storing the multimedia data in the user buffer area into a kernel buffer area in the built-in memory; and calling the second function according to a preset period, and storing the multimedia data in the kernel buffer area into the external memory. By means of the mode, the multimedia data are stored in the buffer area of the built-in memory, the risk of data loss caused by reduction of writing performance is reduced, the second function is called at the interval of the preset period so that it can be guaranteed that the amount of lost data is within the limited range when the system is abnormal, and excessive data loss is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application mainly relates to the field of computer technology, and in particular to multimedia data processing methods, devices, equipment, storage media and program products. Background Art

[0002] The in-vehicle multimedia recording function records audio and video data captured by the vehicle's internal and external cameras and microphones in real time. This information is saved to an external storage device during driving. The external storage device can be removed for playback on a computer for later review. During the recording process, the file writing strategy can lead to memory fragmentation. Excessive memory fragmentation or unstable external storage performance can prevent data from being saved to the external storage device in real time. A system power outage can prevent buffered data from being written to the external storage device in a timely manner, resulting in the loss of a significant amount of recorded data. Summary of the Invention

[0003] The main purpose of this application is to provide a multimedia data processing method, device, equipment, storage medium and program product to solve the problem of data loss caused by system failure or excessive memory fragmentation when multimedia data is synchronously saved during the recording process, so as to reduce the risk of data loss.

[0004] To solve the above problems, the present application provides a method for processing multimedia data, which includes: calling a first function to store the multimedia data in a user buffer in a built-in memory; when the amount of multimedia data in the user buffer exceeds a first data amount threshold, automatically storing the multimedia data in the user buffer in a kernel buffer in the built-in memory; calling a second function according to a preset period to store the multimedia data in the kernel buffer in an external memory.

[0005] In one embodiment, in the process of storing the multimedia data in the kernel buffer to the external memory, the processing method also includes: in response to all the multimedia data in the kernel buffer being stored in the external memory, calling the second function and the third function to store the multimedia data in the user buffer and the kernel buffer to the external memory.

[0006] Through the above-mentioned embodiment, when it is detected that all the multimedia data in the kernel buffer are stored in the external memory, the multimedia data in the user buffer and the kernel buffer are stored for the second time by calling the second function and the third function to avoid the situation where the user cache area is still storing data after the data storage in the kernel buffer is completed, and therefore part of the data will continue to be saved to avoid incomplete data storage.

[0007] In one embodiment, the external memory includes at least a first external memory and a second external memory, wherein the data writing performance of the first external memory is less than the data writing performance of the second external memory, and storing the multimedia data in the kernel buffer into the external memory further includes: storing the multimedia data in the kernel buffer into the first external memory; in response to the data volume of the multimedia data stored in the user buffer exceeding a second data volume threshold, storing the multimedia data in the kernel buffer into the second external memory; and migrating the multimedia data in the second external memory to the first external memory.

[0008] Through the above-mentioned embodiment, when it is detected that all the multimedia data in the kernel buffer are stored in the external memory, the multimedia data in the user buffer and the kernel buffer are stored for the second time by calling the second function and the third function to avoid the situation where the user cache area is still storing data after the data storage in the kernel buffer is completed, and therefore part of the data will continue to be saved to avoid incomplete data storage.

[0009] In one embodiment, migrating multimedia data in a second external memory to a first external memory includes: detecting the number and file size of the multimedia data in the second external memory; and migrating the multimedia data files in the second external memory to the first external memory based on the number and / or file size of each file.

[0010] Through the above embodiment, the multimedia data files are gradually moved to the first external memory according to the number of files and / or the file size of each file, completing the data migration and avoiding the slow writing situation that occurs again after the second external memory is full of data.

[0011] In one embodiment, multimedia data files in the second external memory are migrated to the first external memory based on the number of files and / or the file size of each file, including: in response to the number of files being greater than a preset number, the multimedia data files corresponding to the second external memory are migrated to the first external memory in ascending order of file timestamps until only one multimedia data file exists in the second external memory.

[0012] Through the above embodiment, data migration to the external memory is completed, thereby avoiding the situation where slow writing occurs again after the second external memory is full of data.

[0013] In one embodiment, multimedia data files in the second external memory are migrated to the first external memory based on the number of files and / or the file size of each file, including: in response to the number of files being equal to 1 and the file size of the multimedia data file not changing after a preset time threshold, migrating the multimedia data file to the first external memory.

[0014] Through the above embodiment, the number and size of files are detected to determine whether the current data recording and storage have stopped, so as to end the migration process and save device energy consumption.

[0015] In one embodiment, the method further includes: when a multimedia data file is completely migrated from the second external memory to the first external memory, deleting the corresponding multimedia data file in the second external memory.

[0016] Through the above-mentioned embodiment, data migration is completed, data duplication is avoided, and device storage utilization is improved.

[0017] In one embodiment, before automatically storing the multimedia data in the user buffer into the kernel buffer in the built-in memory, the method further includes: detecting whether there is a multimedia data file in the second external memory; if so, moving the multimedia data file to the first external memory.

[0018] Through the above embodiment, before the system starts storing data, the data detection of the second external memory is completed, and the data is moved in advance, which is beneficial to improving the storage performance of the device.

[0019] To solve the above problems, the present application also provides a recording device, which includes: a processing module, the processing module is used to call a first function to store multimedia data in a user buffer in a built-in memory; and when the amount of multimedia data in the user buffer exceeds a first data amount threshold, the multimedia data in the user buffer is automatically stored in a kernel buffer in the built-in memory; and, according to a preset period, a second function is called to store the multimedia data in the kernel buffer in an external memory; a storage module, the storage module is coupled to the processing module, and the storage module includes a built-in memory and an external memory.

[0020] To solve the above problems, the present application also provides an electronic device, which includes: a memory, the memory including a target storage medium; a processor, connected to the memory, the processor is configured to execute the multimedia data processing method described in any of the above embodiments.

[0021] To solve the above problems, the present application also provides a computer-readable storage medium / computer program product, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement the method for processing multimedia data as described in any of the above embodiments; the computer program product includes a computer program, which, when executed by a processor, implements the method for processing multimedia data as described in any of the above embodiments.

[0022] The present application provides a multimedia data processing method, apparatus, device, storage medium, and program product, which stores multimedia data in a buffer of a built-in memory, reducing the risk of data loss due to decreased write performance. A second function is called at preset intervals to ensure that the amount of data lost in the event of a system anomaly is within a limit, thereby avoiding excessive data loss. Furthermore, for multiple external memories, when the speed of the currently stored external memory is detected to be too slow, a separate program is started to save the data to a faster external memory, and the data is gradually moved to the slower memory through data relocation, thereby avoiding storage anomalies caused by the different speeds of multiple external memories and improving storage efficiency and system performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without inventive efforts. Among them:

[0024] Figure 1 This is a flowchart of the steps of an embodiment of a method for processing multimedia data provided by the present application;

[0025] Figure 2 yes Figure 1 A schematic flow chart of sub-steps of an embodiment of step S30;

[0026] Figure 3 yes Figure 2 A schematic flow chart of sub-steps of an embodiment of step S33;

[0027] Figure 4 It is a structural diagram of an embodiment of a recording device provided by the present application;

[0028] Figure 5 This is a structural diagram of an embodiment of an electronic device provided by the present application;

[0029] Figure 6a This is a schematic structural diagram of an embodiment of a computer-readable storage medium provided by the present application;

[0030] Figure 6b It is a structural diagram of an embodiment of a computer program product provided by this application.

[0031] Figure Number:

[0032] 100. Recording device; 110. Processing module; 120. Storage module; 121. Built-in memory; 122. External memory; 200. Electronic device; 210. Memory; 220. Processor; 300. Computer-readable storage medium; 310. Computer-executable instructions; 400. Computer program product; 410. Computer program. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some, rather than all, structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] The terms "first," "second," and the like in this application are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0035] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0036] During the use of vehicle-mounted equipment or other mobile electronic recording devices, the video information captured by the camera and the audio information collected by the microphone need to be stored during the recording process. During the above-mentioned storage process, the recorded and collected information is usually saved directly in an external storage device. However, during this process, memory fragmentation may occur due to the file writing strategy. In addition, due to excessive memory fragmentation or unstable performance of the external storage, the data cannot be saved to the external storage in real time. In addition, there may be system power outages or other failures, resulting in the recorded data not being written to the external storage device in a timely manner, thereby causing the recorded data to be lost. Therefore, the present application provides a multimedia data processing method, apparatus, device, storage medium and program product to solve the above-mentioned problems.

[0037] See Figure 1 As shown, Figure 1 1 is a flowchart of an embodiment of a method for processing multimedia data provided by the present application; wherein the processing method includes the following steps:

[0038] Step S10: calling a first function to store multimedia data into a user buffer in the built-in memory.

[0039] As you can understand, in the multimedia recording process, raw audio and video data is obtained from the capture end and sent to the corresponding encoder for encoding. The encoded data is then encapsulated in a container format and written to external storage using the fwrite function. The fwrite function is used to write data from memory to a file. It is a high-level file operation function, typically used for file input and output operations. Due to its caching nature, fwrite does not immediately write data to external storage or other physical devices. Instead, it writes data to the user buffer allocated by the Linux system for each stream.

[0040] Step S20: When the amount of multimedia data in the user buffer exceeds a first data amount threshold, the multimedia data in the user buffer is automatically stored in the kernel buffer in the built-in memory.

[0041] Data is written to the Linux kernel buffer only when the amount of data cached in the user buffer exceeds a certain threshold (i.e., the first data volume threshold) or when the user calls fflush (i.e., the second function). fflush is used to flush the file stream buffer, forcing the data in the file stream buffer to be written to the file. It is often used to ensure that data is written to disk immediately rather than remaining in the buffer.

[0042] The data is actually written to the physical device only when the amount of data cached in the kernel buffer exceeds a certain threshold, or when the user calls fsync (the third function). fsync is a system call in Unix-like systems that ensures file contents are synchronized to disk, forcing the operating system to flush all file contents (including metadata) from memory to disk to ensure data persistence. It operates at a lower level than fflush and directly operates on file descriptors.

[0043] Step S30: calling the second function according to a preset period to store the multimedia data in the kernel buffer into the external memory.

[0044] Among them, the second function is automatically called after the preset period is met to store the multimedia data in the kernel buffer into the external memory. In the above process, it is possible that the user buffer is also storing data while the kernel buffer is storing data into the external memory. Therefore, the following solution is used to further implement it:

[0045] In one embodiment, in the process of storing the multimedia data in the kernel buffer to the external memory, the processing method also includes: in response to all the multimedia data in the kernel buffer being stored in the external memory, calling the second function and the third function to store the multimedia data in the user buffer and the kernel buffer to the external memory.

[0046] Through the above-mentioned embodiment, when it is detected that all the multimedia data in the kernel buffer are stored in the external memory, the multimedia data in the user buffer and the kernel buffer are stored for the second time by calling the second function and the third function to avoid the situation where the user cache area is still storing data after the data storage in the kernel buffer is completed, and therefore part of the data will continue to be saved to avoid incomplete data storage.

[0047] It can be understood that during the data writing process, the multimedia data in the user buffer will only be automatically stored in the kernel buffer in the built-in memory when the amount of multimedia data in the user buffer exceeds the first data amount threshold. Therefore, in the process of storing all the multimedia data in the kernel buffer to the external memory, part of the data may continue to be written in the user buffer at this time, so it is necessary to store the multimedia data in the user buffer and the kernel buffer in the external memory.

[0048] For example, the system determines whether a multimedia data file has been written. If not, it continues to call fwrite to write data to the buffer. If it is written, it calls fflush and fsync to synchronize the data in the two buffers to the physical device.

[0049] To prevent the system from losing power or being disconnected from the external storage, which may cause large sections of cached data to not be written to the external storage, for example, it is necessary to call fflush and fsync at least once every 500ms to force the cached data to be written to the external storage (physical device). Generally, cached data loss within 1s is acceptable.

[0050] Through the above method, multimedia data is stored in the buffer of the built-in memory, reducing the risk of data loss due to decreased write performance, and the second function is called at preset intervals to ensure that the amount of data lost in the event of a system abnormality is within a limited range, avoiding excessive data loss.

[0051] In the above solution, the fwrite buffer may be full at 400ms, at which point the system automatically writes the data in the buffer to the kernel buffer. At 500ms, the fflush call forces the user to write the data in the buffer to the kernel buffer. Therefore, while this solution ensures that data is not lost, the number of fflush calls is significantly high, affecting the performance of the entire system. Therefore, based on the above embodiment, this application provides another embodiment to address the above problem.

[0052] First, use fopen to open the specified file. Once the file is successfully opened, a file pointer pointing to the stream will be returned. In this way, a stream is associated with a file in the memory, and the contents of the file can be changed through the stream. As you can understand, a stream is an abstract concept that represents the flow of data between a program and an external device (such as a file, keyboard, screen, etc.). A stream can be an input stream (reading data from a device) or an output stream (writing data to a device). When fopen successfully opens a file, the file pointer will be associated with a stream. This stream represents the data channel between the program and the file, and the file can be read or written through the stream.

[0053] According to the bit rate of the recorded video and audio, calculate an appropriate value, set the value to the stream buffer, and configure the stream properties to write data to the kernel buffer when the buffer is full.

[0054] The value is calculated as follows: Stream Buffer Threshold = (Video Bit Rate + Audio Bit Rate) * 0.5 / 8 (in bytes).

[0055] The value calculated by the above formula is then aligned to 512 bytes. This ensures that the data encoded in less than 500ms plus some container information is exactly equal to the set data size. When the data in the buffer reaches the set size, the data in the user buffer is automatically written to the kernel buffer. fsync is called every 500ms to write the kernel buffer data to the physical device. The file is checked to see if it has been written. If not, fwrite is called again to write data to the buffer. If so, fflush and fsync are called to synchronize the data in the two buffers to the physical device. fclose is called to close the stream.

[0056] Through the above method, the second and third functions are no longer called at a preset period. For example, fflush and fsync are called every 500ms. This eliminates the need to call fflush every 500ms, reduces the number of fflush operations, improves system performance, and ensures that data loss due to power failure or disconnection of the external storage is less than 500ms.

[0057] In actual use, external storage devices can include multiple different types of storage devices, such as USB flash drives and SD cards. Furthermore, different manufacturers have different performance parameters for the same type of device. Some external storage devices can only guarantee an average write speed, which can be fast at times and slow at others, with fluctuations. Therefore, for situations where there are multiple external storage devices, this application provides corresponding operation solutions to meet user needs and improve the device's write performance. The specific solutions are as follows:

[0058] In one embodiment, the external memory includes at least a first external memory and a second external memory, wherein the data writing performance of the first external memory is lower than the data writing performance of the second external memory, such as Figure 2 As shown, Figure 2 yes Figure 1 Schematic diagram of the sub-steps of step S30 in an embodiment of the present invention; wherein step S30 stores the multimedia data in the kernel buffer into the external memory, and further includes the following sub-steps:

[0059] Step S31: storing the multimedia data in the kernel buffer into the first external memory.

[0060] Step S32: In response to the data volume of the multimedia data stored in the user buffer exceeding the second data volume threshold, the multimedia data in the kernel buffer is stored in the second external memory.

[0061] Step S33: Migrate the multimedia data in the second external memory to the first external memory.

[0062] In the above solution, when it is detected that the amount of multimedia data stored in the user buffer exceeds a second data volume threshold, it is determined that the write performance of the current external memory is poor, so the file is immediately switched, the original file is closed, a new file is reopened, and the data is written to the high-speed memory (i.e., the second external memory). A background process is started to transfer data, the number and size of the high-speed memories are detected, and the recorded data in the high-speed memories are transferred to the low-speed memory (i.e., the first external memory) in the following manner.

[0063] Through the above-mentioned embodiment, when it is detected that all the multimedia data in the kernel buffer are stored in the external memory, the multimedia data in the user buffer and the kernel buffer are stored for the second time by calling the second function and the third function to avoid the situation where the user cache area is still storing data after the data storage in the kernel buffer is completed, and therefore part of the data will continue to be saved to avoid incomplete data storage.

[0064] In one embodiment, if Figure 3 As shown, Figure 3 yes Figure 2 Schematic diagram of the sub-steps of step S33 of an embodiment; wherein step S33 migrates the multimedia data in the second external memory to the first external memory, including the following sub-steps:

[0065] Step S330: Detect the number and size of multimedia data files in the second external memory.

[0066] Step S331: Migrate the multimedia data files in the second external memory to the first external memory according to the number of files and / or the file size of each file.

[0067] Through the above embodiment, the multimedia data files are gradually moved to the first external memory according to the number of files and / or the file size of each file, completing the data migration and avoiding the slow writing situation that occurs again after the second external memory is full of data.

[0068] Among them, for the above steps, the following specific solutions are provided:

[0069] In one embodiment, multimedia data files in the second external memory are migrated to the first external memory based on the number of files and / or the file size of each file, including: in response to the number of files being greater than a preset number, the multimedia data files corresponding to the second external memory are migrated to the first external memory in ascending order of file timestamps until only one multimedia data file exists in the second external memory.

[0070] As can be understood, when the data transfer process detects that there are multiple recorded files in the current high-speed memory, it traverses all files, searches for the file with the smallest file timestamp, and transfers that file to the low-speed memory. Finally, it deletes the file from the high-speed memory. This process is repeated until only one recorded file (multimedia data file) remains in the high-speed memory.

[0071] Through the above embodiment, data migration to the external memory is completed, thereby avoiding the situation where slow writing occurs again after the second external memory is full of data.

[0072] In one embodiment, multimedia data files in the second external memory are migrated to the first external memory based on the number of files and / or the file size of each file, including: in response to the number of files being equal to 1 and the file size of the multimedia data file not changing after a preset time threshold, migrating the multimedia data file to the first external memory.

[0073] When it is detected that only one multimedia data file exists in the second external memory (high-speed memory), the file size of the multimedia data file is checked at intervals of a preset time threshold to see if it has changed, for example, every 3 seconds to see if the file size has changed. Since it is possible that only one file is recorded at the end of the recording, when a file is written to the high-speed memory, that is, when the file size no longer changes, the program is executed to transfer the data in the high-speed memory to the low-speed memory. When the transfer is completed, the corresponding file in the high-speed memory is deleted.

[0074] Through the above embodiment, the number and size of files are detected to determine whether the current data has stopped recording and storing the data, so as to end the migration process and save device energy consumption.

[0075] In one embodiment, the method further includes: when a multimedia data file is completely migrated from the second external memory to the first external memory, deleting the corresponding multimedia data file in the second external memory.

[0076] Through the above-mentioned embodiment, data migration is completed, data duplication is avoided, and device storage utilization is improved.

[0077] When the problem of poor performance in writing to the low-speed memory occurs, the system may lose power, the recording program may crash, or the user may remove the card. In this case, the recording will be terminated, but part of the file will be in the high-speed memory and part of the file will be in the low-speed memory. Therefore, the next time the system starts recording, it will first check whether there are recorded files in the high-speed memory. If there are files, the process will be started to move the data in the high-speed memory to the low-speed memory. The specific embodiment scheme is as follows:

[0078] In one embodiment, before automatically storing the multimedia data in the user buffer into the kernel buffer in the built-in memory, the method further includes: detecting whether there is a multimedia data file in the second external memory; if so, moving the multimedia data file to the first external memory.

[0079] Through the above embodiment, before the system starts storing data, the data detection of the second external memory is completed, and the data is moved in advance, which is beneficial to improving the storage performance of the device.

[0080] During the recording process, if the number of recorded files in the high-speed memory exceeds the first waiting time, and there is only one file, for example, if only one recorded file exists in the second external memory within 10 minutes, it indicates that the write performance of the low-speed memory has improved. After the current file is written, the next file is directly written to the first external memory, and the data transfer process exits after the last file is transferred.

[0081] When the second waiting time is exceeded during the recording process, for example, the recording exceeds 10 minutes, and there is no recorded file in the high-speed memory (the second external memory), it means that the user may have stopped recording at this time, and the data transfer process exits.

[0082] To solve the above problems, the present application also provides a recording device 100, such as Figure 4 As shown, Figure 4 It is a structural diagram of an embodiment of a recording device provided by the present application; the recording device 100 includes: a processing module 110, the processing module 110 is used to call a first function to store multimedia data in a user buffer in a built-in memory; and when the amount of multimedia data in the user buffer exceeds a first data amount threshold, the multimedia data in the user buffer is automatically stored in a kernel buffer in the built-in memory; and, according to a preset period, a second function is called to store the multimedia data in the kernel buffer in an external memory; a storage module 120, the storage module 120 is coupled to the processing module 110, and the storage module 120 includes a built-in memory 121 and an external memory 122.

[0083] Regarding the recording device 100 , the recording device 100 utilizes structures such as the processing module 110 and the storage module 120 therein to implement the multimedia data processing method described in any one of the above embodiments.

[0084] In some embodiments, the processing module 110 in the above-mentioned recording device 100 calls the second function and the third function in response to all the multimedia data in the kernel buffer of the built-in memory 121 being stored in the external memory 122, and stores the multimedia data in the user buffer and the kernel buffer in the external memory 122.

[0085] In some embodiments, the external memory 122 in the storage module 120 includes at least a first external memory and a second external memory, wherein the processing module 110 can also store the multimedia data in the kernel buffer in the first external memory; in response to the amount of multimedia data stored in the user buffer exceeding the second data amount threshold, the multimedia data in the kernel buffer is stored in the second external memory; and the multimedia data in the second external memory is migrated to the first external memory.

[0086] In some embodiments, the processing module 110 can also detect the number and file size of multimedia data files in the second external memory in the external memory 122; and migrate the multimedia data files in the second external memory to the first external memory based on the number of files and / or the file size of each file.

[0087] In some embodiments, the processing module 110 can also migrate the multimedia data files corresponding to the second external memory to the first external memory in ascending order of file timestamps in response to the number of files being greater than a preset number until there is only one multimedia data file in the second external memory.

[0088] In some embodiments, the processing module 110 may further migrate the multimedia data file to the first external memory in response to the number of files being equal to 1 and the file size of the multimedia data file not changing after a preset time threshold.

[0089] In some embodiments, the processing module 110 may further delete the corresponding multimedia data file in the second external memory upon completing the migration of a multimedia data file from the second external memory to the first external memory.

[0090] In some embodiments, the processing module 110 may further detect whether a multimedia data file exists in the second external memory; if so, the multimedia data file is transferred to the first external memory.

[0091] To solve the above problems, the present application also provides an electronic device 200, such as Figure 5 As shown, Figure 5 It is a structural diagram of an embodiment of an electronic device provided in the present application; the electronic device 200 includes: a memory 210, the memory 210 includes a target storage medium; a processor 220, connected to the memory 210, and the processor 220 is configured to execute the multimedia data processing method described in any one of the above embodiments.

[0092] To solve the above problems, the present application also provides a computer-readable storage medium 300 / computer program product 400, such as Figure 6a and Figure 6b As shown, Figure 6a This is a schematic structural diagram of an embodiment of a computer-readable storage medium provided by the present application; Figure 6b It is a structural diagram of an embodiment of a computer program product provided by the present application; the computer-readable storage medium 300 stores computer execution instructions 310, which, when executed by the processor 220, are used to implement the method for processing multimedia data as described in any one of the above embodiments; the computer program product 400 includes a computer program 410, which, when executed by the processor 220, implements the method for processing multimedia data as described in any one of the above embodiments.

[0093] The present application provides a method for processing multimedia data, which includes: calling a first function to store the multimedia data in a user buffer in a built-in memory; when the amount of multimedia data in the user buffer exceeds a first data amount threshold, automatically storing the multimedia data in the user buffer in a kernel buffer in the built-in memory; calling a second function according to a preset period to store the multimedia data in the kernel buffer in an external memory.

[0094] Through the above method, the device uses the built-in memory as a cache to store multimedia data in the buffer of the built-in memory during recording, reducing the risk of data loss due to degraded write performance. The second function is called at preset intervals to ensure that the amount of data lost in the event of a system abnormality is within a limit, thus avoiding excessive data loss. Furthermore, for multiple external memories, if the speed of the currently saved external memory is detected to be too slow, a separate program will save the data to the faster one of the external memories. Through data migration, the data is gradually moved to the slower memory to avoid storage anomalies caused by the different speeds of multiple external memories, thereby improving storage efficiency and system performance.

[0095] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for processing multimedia data, characterized in that: The processing method comprises: Call the first function to store the multimedia data into the user buffer in the built-in memory; When the amount of the multimedia data in the user buffer exceeds a first data amount threshold, automatically storing the multimedia data in the user buffer into a kernel buffer in the built-in memory; The second function is called according to a preset period to store the multimedia data in the kernel buffer into an external memory.

2. The method for processing multimedia data according to claim 1, wherein: In the process of storing the multimedia data in the kernel buffer into an external memory, the processing method further includes: In response to all the multimedia data in the kernel buffer being stored in the external memory, the second function and the third function are called to store the multimedia data in the user buffer and the kernel buffer in the external memory.

3. The method for processing multimedia data according to claim 1, wherein: The external memory includes at least a first external memory and a second external memory, wherein data writing performance of the first external memory is lower than data writing performance of the second external memory, and storing the multimedia data in the kernel buffer into the external memory further includes: storing the multimedia data in the kernel buffer into the first external memory; In response to the amount of the multimedia data stored in the user buffer exceeding a second data amount threshold, storing the multimedia data in the kernel buffer into the second external memory; Migrating the multimedia data in the second external memory to the first external memory.

4. The method for processing multimedia data according to claim 3, wherein: Migrating the multimedia data in the second external memory to the first external memory includes: detecting the number and size of multimedia data files in the second external memory; The multimedia data files in the second external memory are migrated to the first external memory according to the number of files and / or the file size of each file.

5. The method for processing multimedia data according to claim 4, wherein: The migrating the multimedia data files in the second external memory to the first external memory according to the number of files and / or the file size of each file includes: In response to the number of files being greater than a preset number, the multimedia data files corresponding to the second external memory are migrated to the first external memory in ascending order of file timestamps until only one multimedia data file exists in the second external memory.

6. The method for processing multimedia data according to claim 4 or 5, characterized in that: The migrating the multimedia data files in the second external memory to the first external memory according to the number of files and / or the file size of each file includes: In response to the number of files being equal to 1 and the file size of the multimedia data file not changing after a preset time threshold, the multimedia data file is migrated to the first external memory.

7. The method for processing multimedia data according to claim 4, wherein: The method further comprises: When a multimedia data file is completely migrated from the second external memory to the first external memory, the corresponding multimedia data file is deleted from the second external memory.

8. A recording device, characterized in that: The recording device comprises: a processing module, the processing module being configured to call a first function to store multimedia data in a user buffer in the built-in memory; and automatically store the multimedia data in the user buffer in a kernel buffer in the built-in memory when the amount of the multimedia data in the user buffer exceeds a first data amount threshold; and, further, call a second function according to a preset period to store the multimedia data in the kernel buffer in an external memory; A storage module is coupled to the processing module, and the storage module includes the built-in memory and the external memory.

9. An electronic device, characterized in that: The electronic device comprises: a memory, the memory including a target storage medium; A processor is connected to the memory, and the processor is configured to execute the multimedia data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium / computer program product, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method for processing multimedia data according to any one of claims 1 to 7; The computer program product comprises a computer program, which, when executed by a processor, implements the method for processing multimedia data according to any one of claims 1 to 7.