Method and device for automatic synthesis of media files

By obtaining and sorting the time parameters of media files to form collections and indexes, the problem of file disorder during server storage is solved, allowing the operator to obtain complete playback sources, reducing memory space waste and improving system availability.

CN112507148BActive Publication Date: 2024-10-11BEIJING THUNISOFT INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011484520.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-16
Publication Date
2024-10-11
Estimated Expiration
2040-12-16

AI Technical Summary

Technical Problem

In the existing technology, the server uses small files and multiple files when storing media files, which results in the video files obtained by the operator being disordered and unable to easily obtain the complete playback source.

Method used

By obtaining the time parameters of the media files, sorting and organizing the media files with a preset data structure to form a collection, and generating an index of the media file collection for retrieval and playback.

Benefits of technology

Operators can obtain playback sources built in advance, reduce waste of memory space, and improve system availability and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112507148B_ABST
    Figure CN112507148B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for automatically synthesizing media files, thereby providing an implementation method for automatically merging media files to generate a complete playback source. The method for automatically synthesizing media files includes the following steps: obtaining the first time parameter of the media file; sorting the media file according to the first time parameter of the media file; organizing the sorted media files with a preset data structure to form a collection of media files. The device for automatically synthesizing media files includes: an acquisition module for obtaining the first time parameter of the media file; a sorting module for sorting the media files according to the first time parameter of the media file; and a synthesis module for organizing the sorted media files with a preset data structure to form a collection of media files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of media file processing, and in particular to a method and device for automatically synthesizing media files. Background Art

[0002] We live in a media age where media data is generated all the time, such as surveillance videos, daily life videos, and video evidence submissions.

[0003] In the process of implementing the prior art, the inventor discovered that:

[0004] In the prior art, in order to facilitate the storage, playback and acquisition of media files, the server uses small files and multiple files to store media files. This storage method brings huge reading advantages to the server, but the large number of video files obtained by the operator are multiple and disordered, making it impossible for the operator to obtain the desired playback source.

[0005] Therefore, it is necessary to provide a technical solution for realizing automatic merging of media files, so as to automatically merge the media files and generate a complete playback source. Summary of the invention

[0006] The embodiment of the present application provides a solution for realizing automatic synthesis of media files, which is used to solve the technical problem that the text box needs to be manually activated when entering text.

[0007] A method for automatically synthesizing a media file provided in this application comprises the following steps:

[0008] Get the first time parameters of the media file;

[0009] sorting the media files according to the first time parameters of the media files;

[0010] The sorted media files are organized according to a preset data structure to form a media file collection.

[0011] Furthermore, the media file format is at least one of AVI, AIR, Flash, FLV, MKV, MOV, MP4, WMV, Word, Excel, PPT, and PDF.

[0012] Furthermore, the obtaining of the first time parameter of the media file specifically includes:

[0013] At least one data object block in box data or atom data of the media file is read to obtain a first time parameter of the media file.

[0014] Furthermore, the media files are sorted according to the first time parameters of the media files, specifically including:

[0015] The media files are sorted according to at least one of a creation time, a last transmission time, and an archive time of the media files.

[0016] Furthermore, the sorted media files are organized in a preset data structure to form a media file collection, which specifically includes:

[0017] Organizing and sorting audio and video media files in audio and video file formats to form an audio and video file collection;

[0018] Or organize and sort at least one document in Word, Excel, or PPT in PDF file format to form a document collection.

[0019] Furthermore, the media file is a streaming media file.

[0020] Furthermore, organizing the sorted media files in a preset data structure to form a media file collection also includes:

[0021] An index of the media file collection is generated to retrieve information of media files constituting the media file collection.

[0022] A media file automatic synthesis device, characterized by comprising:

[0023] An acquisition module, used to acquire the first time parameters of the media file;

[0024] A sorting module, used for sorting media files according to first time parameters of the media files;

[0025] The synthesis module is used to organize the sorted media files in a preset data structure to form a media file collection.

[0026] Furthermore, the synthesis module is also used for:

[0027] An index of the media file collection is generated to facilitate retrieval of information of media files constituting the media file collection.

[0028] Further, the acquisition module is used to acquire the first time parameter of the media file, specifically for:

[0029] At least one data object block in box data or atom data of the media file is read to obtain a first time parameter of the media file.

[0030] The embodiments provided in this application have at least the following beneficial effects:

[0031] The playback source obtained by the operator is the media data constructed in advance, and the client only obtains the data of the media file according to the information of the media file in the media file collection, thereby reducing the waste of memory space and increasing the availability of multiple systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0033] Figure 1 A flowchart of a method for automatically synthesizing media files provided in an embodiment of the present application.

[0034] Figure 2 A flowchart of another method for automatically synthesizing media files provided in an embodiment of the present application.

[0035] Figure 3 A schematic block diagram of the structure of an apparatus for automatically synthesizing media files provided in an embodiment of the present application.

[0036] Reference numerals:

[0037] 100 Media file automatic synthesis device

[0038] 110 Get Module

[0039] 120 Sorting Module

[0040] 130 Synthesis Module DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. 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 the present application.

[0042] Please refer to Figure 1 The present application provides a method for automatically synthesizing a media file, comprising the following steps:

[0043] S110: Acquire a first time parameter of a media file.

[0044] It should be noted that the first time parameter may be at least one of the creation time, the last transmission time, and the archiving time of the media file.

[0045] The file format of the media file may be at least one of AVI, AIR, Flash, FLV, MKV, MOV, MP4, WMV, Word, Excel, PPT, PDF, etc.

[0046] The first time parameter of the media file is obtained by reading a data object block of the media file.

[0047] Specifically, the media file automatic synthesis system can obtain the file information of the media file by reading the data object block of the media file.

[0048] For example, the media file automatic synthesis system can obtain at least one piece of information including the file name of the media file, the size of the media file, the location of the media file, the video sequence of the media file, the audio sequence of the media file, the creation time of the media file, the last transmission time of the media file, the archiving time of the media file, the corresponding timestamp of the audio frame of the media file, the corresponding timestamp of the video frame of the media file, etc. by reading the data object block of the media file.

[0049] In a specific embodiment provided in the present application, when the file encapsulation format of the media file is the MP4 file encapsulation format, the data object block of the media file may be at least one of box data and atom data.

[0050] When the file encapsulation format of the media file is a PDF file format, the data object block of the media file may be a file attribute.

[0051] Specifically, when the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the creation time of the media file by reading the box data of the media file.

[0052] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the last transmission time of the media file by reading the box data of the media file.

[0053] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the archiving time of the media file by reading the box data of the media file.

[0054] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the corresponding timestamp of the audio frame of the media file by reading the box data of the media file.

[0055] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the corresponding timestamp of the video frame of the media file by reading the box data of the media file.

[0056] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain corresponding timestamps of the audio frame and the video frame of the media file by reading the box data of the media file.

[0057] When the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the creation time of the media file by reading the atom data of the media file.

[0058] When the file encapsulation format of the media file is the PDF file format, the media file automatic synthesis system can obtain the creation time of the media file by reading the file attribute of the media file.

[0059] S120: Sort the media files according to the first time parameters of the media files.

[0060] It should be noted that the media file automatic synthesis system will sort the media files according to at least one of the creation time, the last transmission time, and the archiving time of the media files.

[0061] Specifically, the media file automatic synthesis system will sort the media files in ascending order according to their creation time.

[0062] Or the media file automatic synthesis system will sort the media files in descending order according to their creation time.

[0063] Or the media file automatic synthesis system will sort the media files in ascending order according to the last transmission time of the media files.

[0064] Or the media file automatic synthesis system will sort the media files in descending order according to their last transmission time.

[0065] Or the media file automatic synthesis system will sort the media files in ascending order according to their archiving time.

[0066] Or the media file automatic synthesis system will sort the media files in descending order according to their archiving time.

[0067] In a specific embodiment provided in the present application, the media file automatic synthesis system sorts the media files in ascending order according to the creation time of the media files.

[0068] The media file automatic synthesis system sorts the media files in ascending order according to the corresponding timestamps of the audio frames of the media files.

[0069] The media file automatic synthesis system sorts the media files in ascending order according to the corresponding timestamps of the video frames of the media files.

[0070] The media file automatic synthesis system sorts the media files in ascending order according to the corresponding timestamps of the audio frames and video frames of the media files.

[0071] The media file automatic synthesis system sorts the media files in descending order according to the creation time of the media files.

[0072] S130: Organizing the sorted media files in a preset data structure to form a media file collection.

[0073] It should be noted that the media file automatic synthesis system will organize the sorted audio and video media files in the audio and video file format to form an audio and video file collection;

[0074] Or organize and sort at least one document in Word, Excel, or PPT in PDF file format to form a document collection.

[0075] Specifically, the media file automatic synthesis system organizes at least one item of data in the audio frame or the video frame of the media file in a preset data structure according to the sorted media files.

[0076] In the specific embodiment provided in the present application, the media file automatic synthesis system will incrementally sort the audio frames of the media files according to the sorted media files to form an audio file collection.

[0077] The media file automatic synthesis system will sort the video frames of the media files in ascending order according to the sorted media files to form a collection of audio and video files.

[0078] The media file automatic synthesis system will sort the audio frames and video frames of the media files in ascending order according to the sorted media files to form a collection of audio and video files.

[0079] The media file automatic synthesis system will sort the audio frames and video frames of the media files in ascending order according to the sorted media documents to form a document collection.

[0080] In a specific implementation provided in the present application, there are several surveillance videos in MP4 file encapsulation format.

[0081] The media file automatic synthesis system obtains the creation time of each surveillance video by reading the box data object block of each surveillance video.

[0082] Afterwards, the media file automatic synthesis system sorts the surveillance videos in ascending order according to their creation time.

[0083] Finally, the media file automatic synthesis system will sort the audio frames and video frames of the surveillance video in ascending order according to the sorted surveillance video, and generate a collection of synthetic surveillance video files.

[0084] In another specific implementation provided in the present application, there are several surveillance video documents in the PPT file packaging format.

[0085] The media file automatic synthesis system obtains the creation time of each surveillance video by reading the attributes of each surveillance video.

[0086] Afterwards, the media file automatic synthesis system sorts the surveillance videos in ascending order according to their creation time.

[0087] Finally, the media file automatic synthesis system will sort the audio frames and video frames of the surveillance video in ascending order according to the sorted surveillance video documents, and generate a collection of synthetic surveillance video documents.

[0088] It should be noted that the media file collection may be a complete playback source or a streaming media file.

[0089] When the media file collection is a complete playback source, the sorted media files will generate a media file collection playback source in a preset data structure.

[0090] When the media file collection is a streaming media file, the sorted media files will be read according to the sorting order.

[0091] Please refer to Figure 2 When the media file collection is a streaming media file, the present application provides another media file automatic synthesis method, which includes the following steps in addition to the above S110 to S130:

[0092] S140: Generate an index of the media file collection to retrieve information of media files constituting the media file collection.

[0093] It should be noted that the index of the media file collection may be a representation of at least one item of information in a data object block of the media file collection or a data file header of the media file collection.

[0094] The data object blocks and data file headers of the media file collection are both used to record the media file collection information.

[0095] Specifically, the data object block of the media file collection is used to record at least one piece of information including the file name, file size, file location, file video sequence, file audio sequence, file creation time, corresponding timestamp of the file audio frame, corresponding timestamp of the file video frame, etc. of the media file.

[0096] The data file header of the media file collection is used to store the audio frame of the media file, the video frame of the media file, the timestamp of the audio frame of the media file, the timestamp of the video frame of the media file, the location of the media file, and the size of the media file.

[0097] It should be noted that, when the file encapsulation format of the composite media file is the MP4 file encapsulation format, the data object block of the composite media file may be at least one of box data and atom data.

[0098] In a specific embodiment provided by the present application, when the data object block of the synthetic media file is a box data object block, the box data object block record includes:

[0099] ftyp box, used to specify the file type;

[0100] moov box, used to save the temporal and spatial information of audio and video data;

[0101] mdat box, used to store audio data and video data;

[0102] The moov box contains metadata information of the file media, usually including one "mvhd" and several "traks". The "mvhd" is a header box, which usually appears as the first child box of the "moov box". The "trak" contains information related to an audio or video track.

[0103] In the specific embodiment provided in the present application, the data file header of the composite media file is composed of an ftyp box and a moov box.

[0104] The ftyp box records the location and size of each sub-media file in the merged media file.

[0105] The moov box records at least one item of data in the audio trak or video trak of each sub-media file in the merged media file.

[0106] It should be noted that the retrieving the information of the media files constituting the media file collection may be that the media file automatic synthesis system sequentially reads the media file data according to the media file data object blocks of the media file collection.

[0107] Or the media file automatic synthesis system reads the media file data in sequence according to the data file header of the synthesized media file.

[0108] Specifically, the media file automatic synthesis system will read the audio data and video data in the mdat box data of the media files constituting the media file collection in sequence according to the ftypbox information and moov box information in the data file header of the synthesized media file.

[0109] In a specific implementation provided in the present application, there are several surveillance videos in MP4 file encapsulation format.

[0110] The media file automatic synthesis system obtains the creation time of each surveillance video by reading the box data object block of each surveillance video.

[0111] Afterwards, the media file automatic synthesis system sorts the surveillance videos in ascending order according to their creation time.

[0112] And according to the sorted surveillance videos, the audio frames and video frames of the surveillance videos are sorted in ascending order to generate a collection of surveillance video files.

[0113] Afterwards, the media file automatic synthesis system will construct a surveillance video file collection data object block, that is, a box of the surveillance video file collection, based on the surveillance video file collection.

[0114] In the box data object block of the surveillance video file collection, the ftyp box as the data file header records the location and size of the media files constituting the media file collection;

[0115] The moov box records the audio tracks and video tracks of the media files that constitute the media file collection.

[0116] Finally, the media file automatic synthesis system only needs to read the audio data and video data in the mdat box data of the media files constituting the media file collection in sequence according to the ftyp box information and moov box information in the data file header constituting the media file collection, and can complete the coherent viewing of the surveillance video files in the form of streaming media.

[0117] During this operation, because the data file header of the media file stores the audio frame, video frame, timestamp, position and size of the video frame, and this information belongs to metadata, it is easy to store and does not take up space, but the video media information takes up a lot of space and is not easy to read, so the data file header and media file data of the media file are operated separately.

[0118] First, calculate the data file header information of the media file, store the metadata of the location and size of all audio frames and video frames, and then respond to the metadata to the web end after construction.

[0119] Then, the media data of the video is addressed to the corresponding position in turn, the bytes are read and written to the memory, and the data is returned to the web client. The real-time reading and writing of bytes here can reduce the waste of memory space, and will not affect the performance due to the old system. It has wide compatibility and high scalability.

[0120] To support the media file automatic synthesis method, the present application provides a media file automatic synthesis device 100.

[0121] Please refer to Figure 3 , a media file automatic synthesis device 100 provided in the present application includes:

[0122] The acquisition module 110 is used to acquire a first time parameter of a media file.

[0123] It should be noted that the first time parameter may be at least one of the creation time, the last transmission time, and the archiving time of the media file.

[0124] The file format of the media file may be at least one of AVI, AIR, Flash, FLV, MKV, MOV, MP4, WMV, Word, Excel, PPT, PDF, etc.

[0125] The first time parameter of the media file is obtained by reading a data object block of the media file.

[0126] Specifically, the acquisition module 110 may acquire the file information of the media file by reading the data object block of the media file.

[0127] For example, the acquisition module 110 can obtain at least one of the following information: the file name of the media file, the size of the media file, the location of the media file, the video sequence of the media file, the audio sequence of the media file, the creation time of the media file, the last transmission time of the media file, the archiving time of the media file, the corresponding timestamp of the audio frame of the media file, the corresponding timestamp of the video frame of the media file, etc. by reading the data object block of the media file.

[0128] In a specific embodiment provided in the present application, when the file encapsulation format of the media file is the MP4 file encapsulation format, the data object block of the media file may be at least one of box data and atom data.

[0129] When the file encapsulation format of the media file is a PDF file format, the data object block of the media file may be a file attribute.

[0130] Specifically, when the file encapsulation format of the media file is the MP4 file encapsulation format, the media file automatic synthesis system can obtain the creation time of the media file by reading the box data of the media file.

[0131] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire the last transmission time of the media file by reading the box data of the media file.

[0132] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire the archiving time of the media file by reading the box data of the media file.

[0133] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire the corresponding timestamp of the audio frame of the media file by reading the box data of the media file.

[0134] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire the corresponding timestamp of the video frame of the media file by reading the box data of the media file.

[0135] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire corresponding timestamps of audio frames and video frames of the media file by reading the box data of the media file.

[0136] When the file encapsulation format of the media file is the MP4 file encapsulation format, the acquisition module 110 can acquire the creation time of the media file by reading the atom data of the media file.

[0137] When the file encapsulation format of the media file is the PDF file format, the acquisition module 110 can acquire the creation time of the media file by reading the file attribute of the media file.

[0138] The sorting module 120 is used to sort the media files according to the first time parameters of the media files.

[0139] It should be noted that the sorting module 120 sorts the media files according to at least one of the creation time, the last transmission time, and the archiving time of the media files.

[0140] Specifically, the sorting module 120 will sort the media files in ascending order according to the creation time.

[0141] Or the sorting module 120 will sort the media files in descending order according to the creation time.

[0142] Alternatively, the sorting module 120 may sort the media files in ascending order according to the last transmission time of the media files.

[0143] Alternatively, the sorting module 120 may sort the media files in descending order according to the last transmission time of the media files.

[0144] Or the sorting module 120 may sort the media files in ascending order according to the archiving time of the media files.

[0145] Or the sorting module 120 will sort the media files in descending order according to the archiving time of the media files.

[0146] In the specific embodiment provided in the present application, the sorting module 120 sorts the media files in ascending order according to the creation time of the media files.

[0147] The sorting module 120 sorts the media files in ascending order according to the corresponding timestamps of the audio frames of the media files.

[0148] The sorting module 120 sorts the media files in ascending order according to the corresponding timestamps of the video frames of the media files.

[0149] The sorting module 120 sorts the media files in ascending order according to the corresponding timestamps of the audio frames and video frames of the media files.

[0150] The sorting module 120 sorts the media files in descending order according to the creation time of the media files.

[0151] The synthesis module 130 is used to organize the sorted media files in a preset data structure to form a media file collection.

[0152] It should be noted that the synthesis module 130 organizes the sorted audio and video media files in an audio and video file format to form an audio and video file collection;

[0153] Or organize and sort at least one document in Word, Excel, or PPT in PDF file format to form a document collection.

[0154] Specifically, the synthesis module 130 organizes at least one item of data in the audio frame or the video frame of the media file in a preset data structure according to the sorted media file.

[0155] In the specific embodiment provided in the present application, the synthesis module 130 will incrementally sort the audio frames of the media files according to the sorted media files to form an audio file collection.

[0156] The synthesis module 130 will incrementally sort the video frames of the media files according to the sorted media files to form a collection of audio and video files.

[0157] The synthesis module 130 will sort the audio frames and video frames of the media files in ascending order according to the sorted media files to form a collection of audio and video files.

[0158] The synthesis module 130 will sort the audio frames and video frames of the media files in ascending order according to the sorted media files to form a document collection.

[0159] In a specific implementation provided in the present application, there are several surveillance videos in MP4 file encapsulation format.

[0160] The acquisition module 110 acquires the creation time of each surveillance video by reading the box data object block of each surveillance video.

[0161] Afterwards, the sorting module 120 sorts the surveillance videos in ascending order according to their creation time.

[0162] Finally, the synthesis module 130 will sort the audio frames and video frames of the surveillance video in ascending order according to the sorted surveillance video, and generate a collection of synthesized surveillance video files.

[0163] In another specific implementation provided in the present application, there are several surveillance video documents in the PPT file packaging format.

[0164] The acquisition module 110 acquires the creation time of each surveillance video by reading the attributes of each surveillance video.

[0165] Afterwards, the sorting module 120 sorts the surveillance videos in ascending order according to their creation time.

[0166] Finally, the synthesis module 130 will sort the audio frames and video frames of the surveillance video in ascending order according to the sorted surveillance video documents, and generate a collection of synthesized surveillance video documents.

[0167] It should be noted that the media file collection may be a complete playback source or a streaming media file.

[0168] When the media file collection is a complete playback source, the sorted media files will generate a media file collection playback source in a preset data structure.

[0169] When the media file collection is a streaming media file, the sorted media files will be read according to the sorting order.

[0170] It should be particularly noted that when the media file collection is a streaming media file, the synthesis module 130 is further used to:

[0171] An index of the media file collection is generated to facilitate retrieval of information of media files constituting the media file collection.

[0172] It should be emphasized that the index of the media file collection may be a representation of at least one item of information in a data object block of the media file collection or a data file header of the media file collection.

[0173] The data object blocks and data file headers of the media file collection are both used to record the media file collection information.

[0174] Specifically, the data object block of the media file collection is used to record at least one piece of information including the file name, file size, file location, file video sequence, file audio sequence, file creation time, corresponding timestamp of the file audio frame, corresponding timestamp of the file video frame, etc. of the media file.

[0175] The data file header of the media file collection is used to store the audio frame of the media file, the video frame of the media file, the timestamp of the audio frame of the media file, the timestamp of the video frame of the media file, the location of the media file, and the size of the media file.

[0176] It should be noted that, when the file encapsulation format of the composite media file is the MP4 file encapsulation format, the data object block of the composite media file may be at least one of box data and atom data.

[0177] In a specific embodiment provided by the present application, when the data object block of the synthetic media file is a box data object block, the box data object block record includes:

[0178] ftyp box, used to specify the file type;

[0179] moov box, used to save the temporal and spatial information of audio and video data;

[0180] mdat box, used to store audio data and video data;

[0181] The moov box contains metadata information of the file media, usually including one "mvhd" and several "traks". The "mvhd" is a header box, which usually appears as the first child box of the "moov box". The "trak" contains information related to an audio or video track.

[0182] In the specific embodiment provided in the present application, the data file header of the composite media file is composed of an ftyp box and a moov box.

[0183] The ftyp box records the location and size of each sub-media file in the merged media file.

[0184] The moov box records at least one item of data in the audio trak or video trak of each sub-media file in the merged media file.

[0185] It should be noted that the retrieving the information of the media files constituting the media file collection may be that the media file automatic synthesis system sequentially reads the media file data according to the media file data object blocks of the media file collection.

[0186] Or the media file automatic synthesis system reads the media file data in sequence according to the data file header of the synthesized media file.

[0187] Specifically, the synthesis module 130 reads the audio data and the video data in the mdat box data of the media files constituting the media file collection in sequence according to the ftyp box information and the moov box information in the data file header of the synthesized media file.

[0188] In a specific implementation provided in the present application, there are several surveillance videos in MP4 file encapsulation format.

[0189] The acquisition module 110 acquires the creation time of each surveillance video by reading the box data object block of each surveillance video.

[0190] Afterwards, the sorting module 120 sorts the surveillance videos in ascending order according to their creation time.

[0191] The synthesis module 130 sorts the audio frames and video frames of the surveillance video in ascending order according to the sorted surveillance video to generate a collection of surveillance video files.

[0192] Afterwards, the synthesis module 130 constructs a surveillance video file collection data object block, that is, a box of the surveillance video file collection, according to the surveillance video file collection.

[0193] In the box data object block of the surveillance video file collection, the ftyp box as the data file header records the location and size of the media files constituting the media file collection;

[0194] The moov box records the audio tracks and video tracks of the media files that constitute the media file collection.

[0195] Finally, the media file automatic synthesis device 100 only needs to read the audio data and video data in the mdat box data of the media files constituting the media file collection in sequence according to the ftyp box information and moov box information in the data file header constituting the media file collection, so as to complete the continuous viewing of the surveillance video file in the form of streaming media.

[0196] During this operation, because the data file header of the media file stores the audio frame, video frame, timestamp, position and size of the video frame, and this information belongs to metadata, it is easy to store and does not take up space, but the video media information takes up a lot of space and is not easy to read, so the data file header and media file data of the media file are operated separately.

[0197] First, calculate the data file header information of the media file, store the metadata of the location and size of all audio frames and video frames, and then respond to the metadata to the web end after construction.

[0198] Then, the media data of the video is addressed to the corresponding position in turn, the bytes are read and written to the memory, and the data is returned to the web client. The real-time reading and writing of bytes here can reduce the waste of memory space, and will not affect the performance due to the old system. It has wide compatibility and high scalability.

[0199] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0200] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0201] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A method for automatically synthesizing media files, characterized in that: The following steps are involved: Get the first time parameters of the media file; Sorting the media files according to the first time parameter of the media files; specifically, sorting the media files according to at least one of the creation time, the last transmission time, and the archiving time of the media files; Organize and sort media files in a preset data structure to form a media file collection; specifically, organize and sort audio and video media files in an audio and video file format to form an audio and video file collection; or organize and sort at least one document in Word, Excel, and PPT in a PDF file format to form a document collection. When responding to the web side, first calculate the data file header information of the media file, store metadata for the location and size of all audio frames and video frames, and after constructing the metadata, respond to the web side, then address the media data of the video to the corresponding location in turn, read and write bytes to the memory, and return the data to the web client.

2. The method for automatically synthesizing media files according to claim 1, characterized in that: The media file format is at least one of AVI, AIR, Flash, FLV, MKV, MOV, MP4, WMV, Word, Excel, PPT, and PDF.

3. The method for automatically synthesizing media files as claimed in claim 1, characterized in that: The obtaining of the first time parameter of the media file specifically includes: Read at least one data object block in box data or atom data of the media file to obtain a first time parameter of the media file.

4. The method for automatically synthesizing media files as claimed in claim 1, characterized in that: The media file is a streaming media file.

5. The method for automatically synthesizing media files as claimed in claim 1, characterized in that: Organizing and sorting media files in a preset data structure to form a media file collection, which also includes: An index of the media file collection is generated to retrieve information of media files constituting the media file collection.

6. A media file automatic synthesis device, characterized in that: include: An acquisition module, used to acquire the first time parameters of the media file; A sorting module, used for sorting media files according to first time parameters of the media files; Specifically used for: sorting media files according to at least one of the creation time, last transmission time, and archiving time of the media files; a synthesis module, used to organize the sorted media files in a preset data structure to form a media file collection, specifically used for: organizing the sorted audio and video media files in audio and video file format to form an audio and video file collection; or organizing at least one document in Word, Excel, and PPT in PDF file format to form a document collection. When responding to the web side, first calculate the data file header information of the media file, store metadata for the location and size of all audio frames and video frames, and respond to the metadata to the web side after constructing it, then address the media data of the video to the corresponding position in turn, read and write bytes to the memory, and return the data to the web client.

7. The media file automatic synthesis device according to claim 6, characterized in that: The synthesis module is also used to: An index of the media file collection is generated to retrieve information of media files constituting the media file collection.

8. The media file automatic synthesis device as claimed in claim 6, characterized in that: The acquisition module is used to acquire the first time parameter of the media file, specifically for: Read at least one data object block in box data or atom data of the media file to obtain a first time parameter of the media file.