Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention. For convenience of description, the embodiment of the present invention takes the monitoring field as an example. It is obvious that the present invention is not limited thereto, and the embodiments of the present invention can also be applied to other fields where video containers are not uniform.
The embodiment of the invention provides a solution to the problem that video containers (or video container formats) in the monitoring field in the prior art are often private, video files packaged according to the private video container format can only be decoded and played by a private player (namely decoding software) provided by a monitoring manufacturer, and standard multimedia players such as VLC, KMPLAYER and the like can not be played correctly, so that a user may need to manage a plurality of players, and the management complexity is high, namely, a solution is provided, namely, detection and identification are carried out on the compression coding formats of various multimedia data frames in a code stream through characteristic information of various multimedia compression coding formats stored in a code stream detection characteristic library, the effect of directly extracting various multimedia data frames from the code stream of any video container format to obtain source data is realized, and the problem that the private player is used for decoding the video files of the private video container format is avoided, has compatibility.
The multimedia in the following embodiments of the present invention may be audio, video, or pictures, or may be any combination of audio, video, and pictures.
Fig. 1 is a flowchart of a multimedia data processing method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step 100, receiving a code stream sent by an encoding end, wherein the code stream comprises a plurality of multimedia data frames stored according to a preset multimedia container format, and the plurality of multimedia data frames are obtained by performing compression encoding on source data;
the encoding end first performs compression encoding on source data according to a standard multimedia compression encoding format (the source data mentioned in the embodiments of the present invention may be a video file), the standard multimedia compression encoding format includes, for example, an Audio compression encoding format MP3(Moving Picture Experts Group Audio Layer III, Motion Picture Experts compression standard Audio Layer 3), AAC-LC (Advanced Coding-low complexity) and the like, a video compression encoding format h.264, MPEG (Motion Picture Experts Group) 4, and MJPEG (Motion joint Picture Experts Group) and the like, the source data is compression encoded to form a plurality of multimedia data frames having various multimedia compression encoding formats (that is, the compression encoding formats used for the plurality of multimedia data frames may be different or the same), storing each multimedia data frame according to a predetermined multimedia container format to form a code stream with a certain sequence and sending the code stream, wherein the multimedia container format comprises a standard multimedia container format and a private multimedia container format, for example, the standard multimedia container format is an open standard which can be FLV, MP4, TS and MKV, and each multimedia data frame in the standard multimedia container is stored according to a specified sequence; in the proprietary multimedia container format, the frames of multimedia data are stored in any non-standard order customized by each vendor.
Step 101, identifying a compression coding format used by each multimedia data frame in a code stream according to a code stream detection feature library and extracting each multimedia data frame from the code stream, wherein the code stream detection feature library comprises feature information used for identifying the compression coding format used by the multimedia data frame;
after receiving the code stream sent by the encoding end, the decoding end can detect the code stream in real time or non-real time (for example, store the code stream first and then store the video file), and identify the compression encoding format used by each multimedia data frame obtained by compression encoding in the code stream, so as to obtain the source data.
And 102, acquiring the source data according to the extracted multimedia data frames and the used compression coding format thereof. Then, the playback can be performed.
The decoding end detects the code stream according to a code stream detection characteristic library maintained by the decoding end, the code stream detection characteristic library stores characteristic information of various multimedia compression coding formats, specifically identifies the multimedia compression coding format used by each multimedia data frame in the code stream, and extracts each multimedia data frame from the code stream to acquire source data.
In the multimedia data processing method provided by this embodiment, the compressed coding formats of the multimedia data frames in the code stream are detected and identified through the feature information of various multimedia compressed coding formats stored in the code stream detection feature library, so that the compressed coding formats of the multimedia data frames in the code stream can be identified, and then the source data can be acquired according to the extracted data frames and the used compressed coding formats thereof, so that the video container decoding step in the prior art is skipped, and the effect of directly identifying and extracting the multimedia data frames from the original to-be-played bit stream of any video container format to acquire the source data is realized through matching with the feature information of various multimedia compressed coding formats, so that compatibility is achieved. Meanwhile, the defect that in the prior art, a one-to-one private player is needed to decode and acquire source data for the code stream with the private video container format can be overcome.
Further, fig. 2 is a schematic diagram of performing code stream detection and decoding by using a code stream detection feature library in the multimedia data processing method according to the embodiment of the present invention, as shown in fig. 2, the code stream detection feature library stores therein feature information of various multimedia compression coding formats, where the feature information includes header file information of the multimedia compression formats, formats of intermediate files, and formats of end files, such as header file information of standard multimedia compression coding formats h.264, MPEG4, MJPEG, and the like, formats of the intermediate files, and formats of the end files. Then, when identifying the compression encoding format used by each multimedia data frame in the code stream according to the code stream detection feature library in step 101, for each multimedia data frame in the code stream, at least one of the following information may be used: matching the multimedia data frame with each compression coding format in the code stream detection feature library to determine the compression coding format used by the multimedia data frame as the matched compression coding format. Specifically, the compression encoding format used for a frame of multimedia data may be identified in a number of ways:
mode 1: respectively comparing the header file information of the multimedia data frame with the header file information of the compression coding format in the code stream detection feature library, the format of the intermediate file of the multimedia data frame with the format of the intermediate file of the compression coding format in the code stream detection feature library, and the format of the end file of the multimedia data frame with the format of the end file of the compression coding format in the code stream detection feature library, if so, determining that the multimedia data frame is matched with the currently compared compression coding format, and the compression coding format used by the multimedia data frame is the matched compression coding format.
In practical application, the comparison sequence may be performed according to requirements, for example, the header file information of the multimedia data frame and the header file information of the current compression coding format may be compared first, then the format of the intermediate file of the multimedia data frame and the format of the intermediate file of the current compression coding format may be compared, and finally the format of the end file of the multimedia data frame and the format of the end file of the current compression coding format may be compared; or comparing the formats of the intermediate files of the two files, then comparing the header file information and finally comparing the format of the end file; and so on.
The method can also be characterized in that after the header file information of the multimedia data frame is compared with the header file information of each compression code in the code stream detection feature library, a plurality of consistent compression coding formats are obtained, then the format of the intermediate file of the multimedia data frame is compared with the format of the obtained intermediate file of the plurality of compression coding formats to obtain a plurality of consistent compression coding formats, finally the format of the end file of the multimedia data frame is compared with the format of the end file of the plurality of compression coding formats obtained by the second comparison, and finally the compression coding formats with consistent three types of information are obtained. Obviously, the format of the intermediate file can be compared first, then the header file information can be compared, and finally the format of the end file can be compared; and so on.
For example, the header file information of a multimedia data frame in the code stream is obtained as "00.00.01", firstly, the header file information of the multimedia data frame is compared with the header file information of various multimedia compression coding formats in the code stream detection feature library respectively, if it is judged that "00.00.01" is consistent with the header file information of the multimedia compression coding formats H.264, MPEG4 and MJPEG, then the format of the intermediate file of the multimedia data frame is continuously compared with the formats of the intermediate files of the multimedia compression coding formats H.264, MPEG4 and MJPEG in the code stream detection feature library respectively, if the formats of the intermediate files are judged to be consistent with the formats of the intermediate files of H.264 and MJPEG, the format of the end file of the multimedia data frame is continuously compared with the formats of the end files of H.264 and MJPEG in the code stream detection feature library, and if the format of the end file of the H.264 is judged to be consistent with the format of the end file of the H.264, the compression coding format used by the data frame can be determined to be the H.264.
Mode 2: respectively comparing the header file information of the multimedia data frame with the header file information of the compression coding format in the code stream detection feature library, and whether the format of the intermediate file of the multimedia data frame is consistent with the format of the intermediate file of the compression coding format in the code stream detection feature library, if so, determining that the multimedia data frame is matched with the currently compared compression coding format, and the compression coding format used by the multimedia data frame is the matched compression coding format.
Or respectively comparing the format of the intermediate file of the multimedia data frame with the format of the intermediate file of the compression coding format in the code stream detection feature library, and comparing whether the format of the end file of the multimedia data frame is consistent with the format of the end file of the compression coding format in the code stream detection feature library, if so, determining that the multimedia data frame is matched with the currently compared compression coding format, and the compression coding format used by the multimedia data frame is the matched compression coding format.
Or, the formats of the header file information and the end file of the two files are respectively compared, and so on.
Similarly, in practical applications, the comparison sequence may also be performed according to requirements, and is not described herein again, as in the method 1.
Mode 3: and comparing the header file information of the multimedia data frame with the header file information of each compression coding format in the code stream detection feature library, and determining that the compression coding format used by the multimedia data frame is the matched compression coding format.
Or comparing the format of the intermediate file of the multimedia data frame with the format of the intermediate file of each compression coding format in the code stream detection feature library, and determining that the compression coding format used by the multimedia data frame is the matched compression coding format.
Or comparing the format of the end file of the multimedia data frame with the format of the end file of each compression coding format in the code stream detection feature library, and determining that the compression coding format used by the multimedia data frame is the matched compression coding format.
In practical applications, a data Frame (Frame) may be composed of a Frame Header (Frame Header), a plurality of slices, a Slice Header (Slice Header) of each Slice, and a Tail (Tail) of the Frame. The header file may be a frame header, the intermediate file may be a slice header, and the end file may be a trailer. Obviously, the intermediate file may also be a combination of a slice header and a slice, and may also be a slice, which is not limited in this embodiment of the present invention.
Based on the foregoing embodiment, after identifying the compression coding format used by each multimedia data frame in the code stream and extracting each multimedia data frame from the code stream, source data can be obtained according to each extracted multimedia data frame and the compression coding format used by the extracted multimedia data frame (corresponding to step 102), this embodiment introduces two processing procedures for obtaining source data (corresponding to step 102), as shown in fig. 2:
ten thousand formula one:
the extracted multimedia data frames are stored according to a storage sequence specified by an open standard multimedia container format under the condition of no decompression to generate a standard code stream, for example, the multimedia data frames are stored according to a storage sequence specified by FLV, MP4, TS or MKV, so that a standard multimedia player such as VLC, kmPLAYER and the like can perform container decoding on the standard code stream to obtain the multimedia data frames, and then the multimedia data frames are decompressed to obtain source data to be played.
In the multimedia data processing method provided in this embodiment, after each multimedia data frame is obtained from the code stream, each obtained multimedia data frame is stored and generated into a standard code stream according to a standard multimedia container format, so that a private video code stream is quickly converted into a standard video code stream, and the standard video code stream can be played directly by using an existing standard player without using a private player.
The second method comprises the following steps:
and sending each extracted multimedia data frame to a data decoder (CODEC) corresponding to the compression coding format for decompression to acquire source data, for example, sending an h.264 compressed data frame extracted from the code stream to an h.264 decoder for decompression to acquire the source data.
In the multimedia data processing method provided in this embodiment, after each multimedia data frame is acquired from the code stream, each extracted multimedia data frame is directly decompressed by a decoder corresponding to a compression coding format used by the data frame, so that a private video file can be decoded by using decoders of various standard compression coding formats, and a private player is avoided.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Fig. 3 is a schematic structural diagram of a multimedia data processing apparatus according to an embodiment of the present invention, as shown in fig. 3, the apparatus includes: the system comprises a receiving module 11 and an obtaining module 12, wherein the receiving module 11 is configured to receive a code stream sent by an encoding end, where the code stream includes a plurality of multimedia data frames stored according to a multimedia container format, and the plurality of multimedia data frames are obtained by performing compression encoding on source data; the obtaining module 12 is configured to identify a compression coding format used by each multimedia data frame in the code stream according to a code stream detection feature library, extract each multimedia data frame from the code stream, and obtain the source data according to each extracted multimedia data frame and the compression coding format used by the extracted multimedia data frame, where the code stream detection feature library includes feature information used for identifying the compression coding format used by the multimedia data frame. The multimedia data processing apparatus provided in this embodiment is located in the decoding end in the embodiment of the multimedia data processing method provided in this embodiment of the present invention.
The functions and processing flows of the multimedia data processing apparatus provided in this embodiment may refer to the above method embodiments, and are not described herein again.
The multimedia data processing apparatus provided in this embodiment detects and identifies the compression coding format of each multimedia data frame in the code stream through the feature information of each multimedia compression coding format stored in the code stream detection feature library, so as to identify the compression coding format of each multimedia data frame in the code stream, and then can acquire source data according to each extracted data frame and the compression coding format used by the extracted data frame, thereby skipping the step of decoding a video container in the prior art, and by matching the features of each multimedia compression format in the monitoring field, the effect of directly identifying and extracting a video frame from an original to-be-played bit stream of any video container format to acquire source data is achieved, and the apparatus has compatibility. Meanwhile, the defect that in the prior art, one-to-one private decoding software is needed to decode the code stream with the private video container format to acquire the source data can be overcome.
FIG. 4 is a block diagram of a multimedia data processing apparatus according to another embodiment of the present invention. The feature information stored in the code stream detection feature library may specifically include: header file information in a multimedia compression coding format, a format of an intermediate file, and a format of an end file; as shown in fig. 4, based on the above embodiment, the obtaining module 12 includes: a comparing unit 121, configured to, for each multimedia data frame in the bitstream, according to at least one of the following information: matching the multimedia data frame with each compression coding format in the code stream detection feature library to determine the compression coding format used by the multimedia data frame as the matched compression coding format. In this way, the compression encoding format of each multimedia data frame in the codestream can be identified. The specific implementation manner can be referred to as manner 1-3 in the above method embodiments, and is not described herein again.
Further, the obtaining module 12 further includes a storage unit 122, configured to store a code stream detection feature library.
The multimedia data processing apparatus provided in this embodiment compares the data frames in the code stream with the feature information of various multimedia compression coding formats stored in the code stream detection feature library, so as to directly identify and extract each multimedia data frame from the code stream of any video container format, and further obtain the effect of source data, thereby avoiding decoding the video file of the private video container format by using a private player, and having compatibility.
Fig. 5 is a schematic structural diagram of a multimedia data processing apparatus according to another embodiment of the present invention, and as shown in fig. 5, in order to further acquire source data based on the foregoing embodiment, the acquiring module 12 further includes: the generating unit 123, the generating unit 123 is configured to obtain the source data in one of the following two ways:
the first method is as follows: storing each multimedia data frame according to a standard video container format and a compression coding format of each multimedia data frame to generate a standard code stream, so that a standard player can perform container decoding on the standard code stream to obtain each multimedia data frame, and then decompressing each multimedia data frame to obtain the source data;
the second method comprises the following steps: and decompressing each multimedia data frame by using a data decoder corresponding to the compression coding format of each multimedia data frame to acquire the source data.
The multimedia data processing device provided by the embodiment can realize that the existing standard player is directly used for playing the private video file without using the private player by quickly converting the video code stream in the private video container format into the video code stream of the standard video container.
Fig. 6 is a schematic structural diagram of a multimedia data processing system according to an embodiment of the present invention, as shown in fig. 6, the system includes: the multimedia data processing apparatus 1 may employ the multimedia data processing apparatus provided in the foregoing embodiment, and the specific structure, function, and processing flow of each device in the multimedia data processing system provided in this embodiment may refer to the embodiments of the foregoing method and device, and details are not described here.
The multimedia data processing system provided in this embodiment detects and identifies the compression coding format of each multimedia data frame in the code stream through the feature information of each multimedia compression coding format stored in the code stream detection feature library, so that the compression coding format of each multimedia data frame in the code stream can be identified, and then source data can be acquired according to each extracted data frame and the compression coding format used by the extracted data frame, thereby skipping the video container decoding step in the prior art, and by matching the features of each multimedia compression coding format in the monitoring field, the effect of directly identifying and extracting a video frame from an original to-be-played bit stream of any video container format to acquire the source data is achieved, and compatibility is achieved. Meanwhile, the defect that in the prior art, one-to-one private decoding software is needed to decode the code stream with the private video container format to acquire the source data can be overcome.
Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be implemented by relevant hardware instructed by a program, and the program may be stored in a computer readable storage medium, such as: ROM/RAM, magnetic disk, optical disk, etc.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.