WO2020107168A1 - Video decoding method and device, electronic apparatus, and computer-readable storage medium - Google Patents

Video decoding method and device, electronic apparatus, and computer-readable storage medium Download PDF

Info

Publication number
WO2020107168A1
WO2020107168A1 PCT/CN2018/117478 CN2018117478W WO2020107168A1 WO 2020107168 A1 WO2020107168 A1 WO 2020107168A1 CN 2018117478 W CN2018117478 W CN 2018117478W WO 2020107168 A1 WO2020107168 A1 WO 2020107168A1
Authority
WO
WIPO (PCT)
Prior art keywords
decoding
identifier
video
file
audio
Prior art date
Application number
PCT/CN2018/117478
Other languages
French (fr)
Chinese (zh)
Inventor
胡小朋
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2018/117478 priority Critical patent/WO2020107168A1/en
Priority to CN201880098443.5A priority patent/CN112823519B/en
Publication of WO2020107168A1 publication Critical patent/WO2020107168A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/24Systems for the transmission of television signals using pulse code modulation
    • H04N7/52Systems for transmission of a pulse code modulated video signal with one or more other pulse code modulated signals, e.g. an audio signal or a synchronizing signal

Definitions

  • the present application relates to the field of computer technology, and in particular, to a video decoding method, device, electronic device, and computer-readable storage medium.
  • Electronic devices can display pictures, play music, and also play videos.
  • a video file to be processed is generated, different encoding methods are used, and a video file to be processed in a different format is generated.
  • the video file to be processed needs to be decoded. Therefore, when playing to-be-processed video files in different formats, the decoding methods adopted are also different.
  • Embodiments of the present application provide a video decoding method, device, electronic device, and computer-readable storage medium.
  • a video decoding method including:
  • the first file format is used to represent the format of the to-be-processed video file
  • the second file format It is used to indicate the format of the audio and video stream in the to-be-processed video file
  • the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain a decoded audio and video stream, wherein, the The decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
  • a video decoding device including:
  • a file obtaining module configured to obtain a to-be-processed video file, and obtain a first file format and a second file format corresponding to the to-be-processed video file, the first file format is used to represent the format of the to-be-processed video file, The second file format is used to represent the format of the audio and video stream in the video file to be processed;
  • a parsing set acquisition module used to acquire a parsing identification set corresponding to the first file format
  • a parsing processing module configured to obtain a target parsing identifier with the strongest parsing performance from the parsing identifier set, and parsing the to-be-processed video file through a parser corresponding to the target parsing identifier to obtain an audio and video stream
  • the parsing performance is used to indicate the performance of the parser corresponding to the parsing identifier
  • a decoding set acquisition module for acquiring a decoding identification set corresponding to the second file format
  • a decoding processing module configured to obtain a target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain decoded audio and video Stream, where the decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
  • An electronic device includes a memory and a processor.
  • a computer program is stored in the memory.
  • the processor causes the processor to perform the steps of the video decoding method.
  • the above video decoding method, device, electronic device, and computer-readable storage medium may obtain the corresponding set of resolution identifiers according to the first file format, And obtain the target resolution identifier with the strongest resolution performance from the resolution identifier set, and analyze and process the video file to be processed by the parser corresponding to the target resolution identifier to obtain the audio and video stream. Then, the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier with the strongest decoding performance is obtained from the decoding identifier set. Finally, the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream. In this way, the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
  • FIG. 1 is a flowchart of a video decoding method in an embodiment
  • FIG. 2 is a flowchart of a video decoding method in another embodiment
  • FIG. 3 is a schematic diagram of decoding a video file to be processed in an embodiment
  • FIG. 4 is a flowchart of a video decoding method in yet another embodiment
  • FIG. 5 is a flowchart of a video decoding method in yet another embodiment
  • FIG. 6 is a flowchart of a video decoding method in yet another embodiment
  • FIG. 7 is a schematic structural diagram of a video decoding device in an embodiment
  • FIG. 8 is a block diagram of a partial structure of a mobile phone related to an electronic device provided by an embodiment of the present application.
  • first”, “second”, etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element.
  • first file format may be referred to as the second file format
  • second file format may be referred to as the first file format. Both the first file format and the second file format are file formats, but they are not the same file format.
  • FIG. 1 is a flowchart of a video decoding method in an embodiment. As shown in FIG. 1, the video decoding method includes steps 102 to 110. among them:
  • Step 102 Obtain a video file to be processed, and obtain a first file format and a second file format corresponding to the video file to be processed.
  • the first file format is used to indicate the format of the video file to be processed
  • the second file format is used to indicate the to-be-processed The format of the audio and video streams in the video file.
  • the electronic device may encode the video file, and there are various encoding methods, and different encoding methods encode the video file in different file formats.
  • common video encoding formats are WMV (Windows Media Video, Media Video Format), MPEG (Moving Pictures Experts Group, Motion Picture Experts Group), MP4 (Moving Pictures Experts Group 4, Motion Picture Experts Group 4) FFMPEG ( Fast, Forward, Moving Pictures, Experts Group).
  • the main function of encoding is to compress video pixel data and audio data into a code stream, thereby reducing the amount of data in the video file.
  • the audio and video stream is a code stream into which video pixel data and audio data are compressed, and may specifically include an audio stream and a video stream.
  • the electronic device may obtain a video file stored locally or a video file sent by another electronic device, which is not limited herein.
  • a user may start a third-party application in the terminal, and initiate a video file acquisition instruction through the third-party application, and then the terminal may initiate an acquisition request to acquire a video file to the server according to the acquisition instruction. After the server receives the acquisition request, Send the corresponding video file to the terminal.
  • the file bytes of the to-be-processed video file can be read.
  • the file format of the video file can be obtained according to the read bytes.
  • the file format of the video file to be processed includes a first file format and a second file format.
  • the first file format is used to represent the format of the video file to be processed
  • the second file format is used to represent the audio and video stream in the video file to be processed. Format.
  • the first file format may be the file ID of the video file to be processed
  • the second file format may include the Mimetype (Multipurpose Internet Mail Extensions) of the audio stream and the Chumktype (file encapsulation type) of the video stream
  • Codec ID Codec Identification
  • Mimetype of audio stream Codec ID of audio stream
  • Chumktype of audio stream etc.
  • Step 104 Acquire a set of resolution identifiers corresponding to the first file format.
  • the electronic device may store the resolution identification set, and a correspondence relationship between the resolution identification set and the first file format is established in advance. After the first file format is obtained, the analysis identifier set corresponding to the first file format can be obtained according to the corresponding relationship between the analysis identifier set and the first file format.
  • the set of parsing identifiers includes at least one parsing identifier, and the parsing identifier is used to indicate a parser that parses the video file.
  • the parser corresponding to the parsing identifier included in the parsing identifier set may be used to parse the corresponding video file in the first file format.
  • the first file format of the to-be-processed video file is the file ID of the to-be-processed video file. If the file ID of the to-be-processed video file is "video/mp4", it can parse the video file with the file ID of "video/mp4" There are MPEG4Extractor parser, ffmpeg parser, MP4 parser.
  • the set of parsing identifiers corresponding to "video/mp4" stored in the electronic device may include parsing identifiers corresponding to the MPEG4Extractor parser, ffmpeg parser, and MP4 parser.
  • Step 106 Obtain the target resolution identifier with the strongest resolution performance from the set of resolution identifiers.
  • the parser corresponding to the target resolution identifier analyzes the video file to be processed to obtain an audio and video stream.
  • the resolution performance is used to indicate the resolution corresponding to the resolution identifier. Performance.
  • the target resolution identification with the strongest resolution performance can be obtained from the resolution identification set.
  • the parsing performance is used to indicate the performance of the parser corresponding to the parsing logo. Specifically, the parsing performance may be obtained according to one or more of the stability, speed, compatibility, and error rate of parsing the video file by the parser, and is not limited to this.
  • the analysis identifiers included in the analysis identifier set may be provided with analysis performance tags, and according to the analysis performance tags, it is possible to determine the strength of the analysis performance of the corresponding resolver, so as to filter out the target analysis identification with the strongest analysis performance.
  • the parser corresponding to the target parsing identifier can be processed for parsing.
  • the attribute information of the video file to be processed you can obtain the audio and video streams. For example, by parsing the audio and video streams in the video file, you can also obtain attribute information such as the playback duration of the video stream, the size of the video image, and the audio format of the audio stream.
  • the electronic device can use its own integrated parser to parse the video file, or it can call the API (Application Programming Interface) of a third-party parsing platform to parse the video file, which is not limited here. .
  • API Application Programming Interface
  • the above-mentioned resolution identification set may include at least one resolution identification sorted according to the resolution performance
  • the step of obtaining the target resolution identification may specifically include: obtaining the resolution identification included in the resolution identification set according to the second file format In the first arrangement order, obtain the target resolution identifier from the resolution identifier set according to the first arrangement sequence.
  • Step 108 Acquire a set of decoding identifiers corresponding to the second file format.
  • the electronic device may store a set of decoding identifiers, and pre-establish a correspondence between the set of decoding identifiers and the second file format.
  • the set of decoding identifiers corresponding to the second file format can be obtained according to the correspondence between the above set of decoding identifiers and the second file format.
  • the set of decoding identifiers includes at least one decoding identifier arranged in sequence, and the decoding identifier is used to indicate a decoder that decodes the video file.
  • the decoder corresponding to the decoding identifier included in the decoding identifier set may be used to decode the corresponding video file in the second file format.
  • the second file format is the Minetype of the video stream.
  • the decoder that can decode the video stream with the Minetype of "video/avc” is Qualcomm AVC (Advanced Video Coding, Advanced video coding) Hard decoder, Google AVC soft decoder, ffmpeg AVC decoder.
  • the corresponding decoding identification set contains the decoding identification corresponding to the Qualcomm AVC hard decoder, Google AVC soft decoder, and ffmpeg AVC decoder.
  • Step 110 Obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream through the decoder corresponding to the target decoding identifier to obtain a decoded audio and video stream, where the decoding performance is used to express The performance of the decoder corresponding to the decoding identifier.
  • the target decoding identifier can be obtained from the decoding identifier set.
  • the decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier, and may specifically be obtained according to one or more of decoding stability, speed, compatibility, and error rate of the decoder, and is not limited thereto.
  • the decoding identifiers included in the set of decoding identifiers may be provided with decoding performance flags, and according to the decoding performance flags, the decoding performance of the corresponding decoder may be judged, so as to filter out the target decoding identifier with the strongest decoding performance.
  • logo It can be understood that the target decoding identifier may also be selected according to other methods, which is not limited herein.
  • the above set of decoding identifiers includes at least one decoding identifier sorted according to decoding performance
  • the step of acquiring the target decoding identifier may specifically include: obtaining a second arrangement order of the decoding identifiers included in the set of decoding identifiers, according to the second arrangement order Obtain the target decoding identifier from the decoding identifier set.
  • the audio and video stream can be decoded by the decoder corresponding to the target decoding identifier.
  • the obtained decoded audio and video stream can be played in the electronic device.
  • the audio and video stream includes an audio stream and a video stream, and the decoder corresponding to the target decoding identifier decodes the audio stream and the video stream respectively.
  • the obtained decoded audio stream and decoded video stream can be passed through an electronic device To play.
  • the video decoding method provided in the above embodiment after obtaining the to-be-processed video file and the corresponding first file format and second file format, may obtain the corresponding parsing identifier set according to the first file format and obtain from the parsing identifier set
  • the target parsing mark with the strongest parsing performance is analyzed and processed by the parser corresponding to the target parsing mark to obtain the audio and video stream.
  • the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier with the strongest decoding performance is obtained from the decoding identifier set.
  • the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream.
  • the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
  • the video decoding method includes steps 202 to 220. among them:
  • Step 202 Send a file acquisition request to the server.
  • the electronic device may be a terminal.
  • the terminal may send a request to the server to obtain the video file to be processed.
  • the terminal may display a playback link of the video file to be processed.
  • the terminal sends a file acquisition request to the server to acquire the video file to be processed for playback.
  • the file acquisition request sent by the terminal to the server may include information such as the terminal identification that initiated the file acquisition request, the file identification of the to-be-processed video file, the time when the request was initiated, and the server identification that received the request, which is not limited herein.
  • Step 204 The receiving server returns the to-be-processed video file according to the file acquisition request, and the first and second file formats corresponding to the to-be-processed video file.
  • the server may search for the corresponding video file to be processed according to the file identifier contained in the file acquisition request, and perform a preliminary analysis on the acquired video file to be processed to obtain the first file format of the video file to be processed and The second file format.
  • the corresponding terminal can be searched for according to the terminal identifier included in the file acquisition request, and the to-be-processed video file and the corresponding first file format and The two file format is sent to the terminal corresponding to the terminal identification.
  • Step 206 Acquire a set of resolution identifiers corresponding to the first file format.
  • the video files in different formats have different parsers used in parsing, so different first file formats have different sets of parsing identifiers.
  • the resolution identification set may be preset, and the resolution identification included in the resolution identification set may be adjusted during the operation of the electronic device, which is not limited herein. For example, the number of errors in parsing the video file when the parser corresponding to the parsing identifier in the parsing identifier set is counted, and the order of the parsing identifiers is adjusted according to the number of errors. If the number of errors exceeds the threshold, the parsing identifier is removed Resolve the logo collection.
  • Step 208 Acquire the first arrangement order of the analysis identifiers contained in the analysis identifier set according to the second file format, obtain the first target analysis identifier from the analysis identifier set according to the first arrangement order, and pass the analysis corresponding to the first target analysis identifier
  • the processor performs the first parsing process on the video file to be processed.
  • the parser included in the parsing identification set can parse the video file in the first file format, but different parsers have different parsing effects on video files in different second file formats. Therefore, the analysis identifiers in the analysis identifier set may be sorted according to the second file format in advance, and the analysis performance of the corresponding parser is determined according to the order. For example, according to the order of the analysis performance from strong to weak, the analysis identifiers are sorted. The higher the analysis identifier in the analysis identifier set, the stronger the analysis performance of the corresponding parser to process the video file.
  • the correspondence relationship between the second file format and the first arrangement order is pre-defined, and the first arrangement order corresponding to the second file format can be obtained according to the correspondence relationship between the second file format and the first arrangement order. If there is no first arrangement sequence corresponding to the second file format of the video file to be processed in the terminal, the default first arrangement sequence may be adopted to obtain the target resolution identifier.
  • the second file format may include an audio stream format and a video stream format.
  • the first arrangement order may be established according to the audio stream format, the video stream format, or the audio stream format and the video stream format.
  • the above step of obtaining the first sorting order may include: obtaining the first sorting order of the resolution identifiers included in the resolution identifier set according to the audio stream format and/or the video stream format.
  • the MPEG4Extractor parser does not support the parsing of MP4 video files with Chunk type ".mp3" and "ms02" of the audio stream, nor does it support the parsing of MP4 video files with Chunk type "mjpeg” or "sorenso" of the video stream. Therefore, when parsing the MP4 video file in the above-mentioned second file format, the ffmpeg parser with better compatibility for this type of MP4 video file will be selected for parsing, rather than the MPEG4Extractor parser.
  • the first target parsing identifier can be obtained from the set of parsing identifiers according to the first arrangement order, and the parser corresponding to the first target parsing identifier can be subjected to the first parsing process.
  • the resolution identifiers in the resolution identifier set can be arranged in order from weakest to strongest in resolution performance, then the last-ordered resolution identifier in the resolution identifier set can be obtained as the first target resolution identifier, and then the first target resolution identifier can be resolved
  • the corresponding parser performs the first parsing process on the video file to be processed.
  • Step 210 When the first parsing process reports an error, obtain first error reporting data obtained during the first parsing process, and obtain a second target parsing identifier from the parsing identifier set according to the first error reporting data.
  • the parser corresponding to the first target parsing identifier When the parser corresponding to the first target parsing identifier performs the first parsing process on the video file to be processed, if the first parsing process does not report an error, the audio and video stream can be obtained directly according to the first parsing process; if the first parsing process reports an error, It means that the parser corresponding to the first target parsing identifier cannot parse the video file to be processed.
  • the first target parsing process reports an error
  • the first parsing process first error reporting data may also be obtained. The reason for the error in the first parsing process can be obtained through the first error report data.
  • the parser corresponding to the first target parsing identifier When the parser corresponding to the first target parsing identifier performs the first parsing process and reports an error, the cause of the error may be obtained based on the first error reporting data, thereby accurately resolving the second target parsing identifier from the parsing identifier set based on the first error reporting data Then, the parser corresponding to the obtained second target parsing identifier is subjected to second parsing processing on the video file to be processed.
  • the first error data can be expressed as "cannot parse the video stream whose Codec ID is'V_MS/VFW/FOURC'".
  • the parsing process is because the above format video stream cannot be parsed Error, and then you can choose a parser that can parse the video stream in the above format.
  • Step 212 Perform a second parsing process on the video file to be processed through a parser corresponding to the second target parsing identifier to obtain an audio and video stream.
  • the parser corresponding to the second target parsing identifier can be subjected to second parsing processing to obtain the audio and video stream.
  • the to-be-processed video file may be composed of several bytes of data, for example, including data representing the attributes of the to-be-processed video, audio and video stream data, and data representing the attributes of the audio and video stream.
  • the audio and video stream In the process of parsing the video file to be processed, you can read the data of several bytes contained in the video file to be processed and parse the read data to obtain the attributes of the video to be processed and the audio and video stream. Properties and audio and video streams.
  • the parsed audio video stream only separates the data representing the audio and video stream from the video file to be processed, and cannot be directly played by the terminal.
  • the audio and video stream needs to be decoded before it can be played by the terminal. Therefore, after the audio and video streams are obtained, the audio and video streams must be decoded.
  • Step 214 Acquire a set of decoding identifiers corresponding to the second file format.
  • the corresponding set of decoding identifiers may be obtained according to the second file format of the audio and video stream.
  • the decoding identifier set may be preset, and the decoding identifier included in the decoding identifier set may be adjusted during the operation of the electronic device, which is not limited herein. For example, the number of errors in decoding the video file by the decoder corresponding to the decoding identifier in the decoding identifier set is counted, and the order of the decoding identifiers is adjusted according to the number of errors. If the number of errors exceeds the threshold, the decoding identifier is removed. Decode identification set.
  • Step 216 Acquire a second arrangement order of decoding identifiers included in the decoding identifier set, obtain a first target decoding identifier from the decoding identifier set according to the second arrangement order, and use the decoder to correspond to the audio and video stream corresponding to the first target decoding identifier The first decoding process is performed.
  • the decoder included in the decoding identification set can decode the video file in the second file format, and can sort the decoding identifications in the decoding identification set according to the second file format in advance, and determine the corresponding decoding according to the order
  • the decoding performance of the device is strong or weak.
  • the decoding identifiers are sorted in order from strongest to weakest decoding performance. The higher the decoding identifier in the decoding identifier set, the stronger the decoding performance of the corresponding decoder for the audio and video stream in the second file format.
  • the first target decoding identifier can be obtained from the decoding identifier set according to the second arrangement order, and the first decoding process is performed on the audio and video stream according to the decoder corresponding to the first target decoding identifier.
  • the decoding identifiers in the decoding identifier set may be arranged in order from weak to strong decoding performance, and then the last-ordered decoding identifier in the decoding identifier set may be obtained as the first target decoding identifier, and then the first target decoding identifier The corresponding decoder performs the first parsing process on the audio and video stream.
  • Step 218 When the first decoding process reports an error, obtain the second error reporting data obtained during the first decoding process, and obtain the second target decoding identifier from the decoding identification set according to the second error reporting data.
  • the audio and video stream can be directly obtained according to the first decoding process; if the first decoding process reports an error, It means that the decoder corresponding to the first target decoding identifier cannot decode the above audio and video stream.
  • the second error reported data of the first decoding process can also be obtained. The reason for the error in the first decoding process can be obtained through the second error report data.
  • the cause of the error can be obtained based on the second error reporting data, so that the second target decoding identifier can be accurately found from the decoding identification set according to the second error reporting data And then perform a second decoding process on the audio and video stream according to the obtained decoder corresponding to the second target decoding identifier.
  • step 216 may specifically further include: acquiring a second arrangement order of the decoding identifiers included in the decoding identifier set, sequentially obtaining the first target decoding identifier from the decoding identifier set according to the second arrangement order, and The first decoding process is performed on the audio and video stream by the decoder corresponding to the first target decoding identifier.
  • Step 218 may further specifically include: when the first decoding process reports an error, count the number of error reports during the first decoding process on the audio and video stream; when the number of error reports is less than or equal to the threshold value, return to perform decoding Obtain the first target decoding identifier from the identifier set, and perform the first decoding processing step on the audio and video stream through the decoder corresponding to the first target decoding identifier; when the number of error reports is greater than the threshold number of times, obtain the first decoded result obtained during the first decoding process Second error data, and obtain the second target decoding identifier from the decoding identifier set according to the second error reporting data.
  • Step 220 Perform a second decoding process on the audio and video stream through the decoder corresponding to the second target decoding identifier to obtain the decoded audio and video stream.
  • the audio and video stream can be decoded to generate an audio and video stream that can be played by the terminal, that is, the decoded audio and video stream obtained by the decoding process can be Played by the terminal.
  • audio and video streams are expressed in binary form, and the data in binary form can be converted into pictures and audio that can be played by the terminal through decoding processing.
  • FIG. 3 is a schematic diagram of decoding a video file to be processed in an embodiment.
  • the to-be-processed video file 302 contains several binary bytes of data.
  • the data in the to-be-processed video file 302 can be parsed to obtain an audio stream 304 and a video stream 306.
  • the audio stream 304 and the video stream 306 can be decoded separately.
  • a decoded audio stream 308 is obtained.
  • a decoded video stream 310 is obtained.
  • the electronic device can play the decoded audio stream 308 and the decoded video stream 310.
  • the video decoding method provided in the above embodiment can accurately select the parser and decoder according to the format of the video file to be processed, thereby improving the decoding efficiency of the video file.
  • the cause of the error can be located according to the error data, and then the corresponding parser or decoder can be selected according to the cause of the error, thereby further improving the decoding accuracy of the video file and Decoding efficiency.
  • the method for obtaining the video file to be processed may specifically include:
  • Step 402 The receiving server returns the original video file according to the file acquisition request, and the first original file format and the second original file format corresponding to the original video file.
  • the server may acquire the corresponding original video file according to the file acquisition request. Then, the original video file is preliminarily parsed to obtain the first original file format and the second original file format of the original video file, and the original video file and the corresponding first original file format and second original file format are returned to the terminal.
  • the first original file format is used to represent the format of the original video file
  • the second original file format is used to represent the format of the audio and video stream in the original video file.
  • Step 404 when there is a set of parsing identifiers corresponding to the first original file format, the original video file is used as the video file to be processed, the first original file format is used as the first file format of the video to be processed, and the second original file format As the second file format of the video to be processed.
  • the terminal After receiving the original video file and the corresponding first original file format and second original file format, the terminal will search for the set of parsing identifiers corresponding to the first original file format. If there is a set of resolution identifiers corresponding to the first original file format in the terminal, the terminal can parse the video file in the first original file format. At this time, the original video file can be directly used as the to-be-processed video file, the first original file format as the first file format of the to-be-processed video, and the second original file format as the second file format of the to-be-processed video. The video file to be processed is parsed.
  • Step 406 When there is no set of resolution identifiers corresponding to the first original file format, send a format conversion request to the server.
  • the terminal can send a format conversion request to the server, and the server performs format conversion on the original video file to generate a video file that can be parsed by the terminal.
  • the format conversion request may include information such as the file identification of the original video file, the video file format supported by the terminal, the terminal identification that sends the format conversion request, and the server identification that receives the format conversion request.
  • the server can obtain the original video file corresponding to the file identifier, and then convert the obtained original video file into a file format to be processed that the terminal supports parsing.
  • the parser in the terminal can also be called to sequentially analyze the original video files in the first original file format. If all parsers in the terminal do not support parsing processing of the original video file, it means that the terminal does not support parsing processing of the original video file, you can send a format conversion request to the server; if there is a terminal that supports the original video file
  • the parser for parsing processing means that the terminal supports parsing processing of the original video file, and you can obtain the original parser that supports parsing the original video file. According to the original parser, the parsing process of the original video file is performed, and according to the original The parsing identifier corresponding to the parser generates a parsing identifier set corresponding to the first original file format.
  • the original video file can be directly used as the to-be-processed video file, and the first original file format can be used as the first file format of the to-be-processed video, and the second original The file format is used as the second file format of the video to be processed, and the video file to be processed is parsed in the terminal.
  • Step 408 Receive the to-be-processed video file obtained by format conversion of the original video file according to the format conversion request sent by the server, and the first file format and the second file format corresponding to the to-be-processed video file.
  • the server may perform a preliminary analysis on the to-be-processed video file to obtain a first file format and a second file format corresponding to the to-be-processed video file. Then the server sends the obtained video file to be processed and the corresponding first file format and second file format to the terminal.
  • the steps of parsing the video file to be processed may specifically include:
  • Step 502 Acquire the first target resolution identifier from the set of resolution identifiers according to the first order, and perform the first parsing process on the video file to be processed through the parser corresponding to the first target resolution identifier.
  • the first target parsing identifier may be obtained from the parsing identifier set in sequence according to the first order, and the parser corresponding to the obtained first target parsing identifier may be obtained
  • the first parsing process of the video file to be processed is stopped until the first parsing process is completed for the first time to obtain the audio and video stream.
  • the number of errors reported by the video file to be processed in the first parsing process may be counted. If the number of error reports is relatively small, you can continue to obtain the next first target resolution identifier according to the order of the resolution identifiers in the resolution identifier set, and perform the first resolution process on the video file to be processed according to the next first target resolution identifier. If the number of error reports is relatively small, the second target resolution identifier can be obtained according to the error report data, and the second resolution process can be performed according to the second target resolution identifier corresponding to the video file to be processed.
  • Step 504 When the first parsing process reports an error, count the number of error reports in the first parsing process of the video file to be processed.
  • the first target resolution identifier is sequentially read from the set of resolution identifiers, and the first parsing process is performed on the video file to be processed according to the parser corresponding to the read first target resolution identifier.
  • the number of error reports in the first parsing process can be counted.
  • the set of parsing identifiers includes sequentially arranged identifiers A, B, and C.
  • the identifier A is read, and the first parsing process is performed according to the parser corresponding to the identifier A. If the parser corresponding to the identifier A performs the first parsing process and obtains the audio and video streams in the to-be-processed video file, the execution is stopped. If the first parsing process reports an error according to the parser corresponding to the identifier A, the number of error reports in the first parsing process obtained by statistics is 1, and the next identifier B may be continuously read. Similarly, if the first parsing process according to the identifier B is successful, the execution stops. If the first parsing process reports an error according to the identifier B, the number of error reports in the first parsing process obtained by statistics is 2.
  • Step 506 When the number of error reports is less than or equal to the threshold of number of times, return to execute to obtain the first target parsing identifier from the set of parsing identifiers according to the first ranking order, and perform the first processing of the video file to be processed by the parser corresponding to the first target parsing identifier Analytical processing steps.
  • Step 508 When the number of error reports is greater than the threshold number of times, obtain first error report data obtained during the first parsing process.
  • the first error report data obtained during the first analysis process can be used, and then the second target analysis tag that can be parsed can be accurately selected from the set of analysis tags according to the first error report data.
  • the first error report data may be error report data obtained when the first analysis process is performed for the last time, or may be error report data obtained when the first analysis process is performed for any one time, which is not limited herein.
  • the steps of decoding the audio and video specifically include:
  • Step 602 Acquire an audio decoding identifier set corresponding to an audio stream format, and acquire a video decoding identifier set corresponding to a video stream format.
  • the parsed audio and video streams include audio streams and video streams
  • the second file format includes the audio stream format corresponding to the audio stream and the video stream format corresponding to the video stream
  • the decoding identification set includes the audio decoding identification set and video Decode identification set.
  • the audio and video streams can be decoded separately.
  • Step 604 Acquire the target audio decoding identifier with the strongest audio decoding performance from the set of audio decoding identifiers, and perform decoding processing on the audio stream through the audio decoder corresponding to the target audio decoding identifier to obtain the decoded audio stream.
  • the video decoding identifier set corresponding to the video stream format is obtained.
  • the set of audio decoding identifiers includes at least one audio decoding identifier arranged in sequence
  • the set of video decoding identifiers includes at least one video decoding identifier arranged in sequence.
  • the target audio decoding identifier with the strongest audio decoding performance can be obtained from the audio decoding identifier set.
  • the audio decoding performance represents the performance of the decoder corresponding to the audio decoding identifier, and the audio stream is decoded according to the obtained target audio decoding identifier with the strongest audio decoding performance.
  • the method for obtaining the target audio decoding identifier from the audio decoding identifier set is not limited.
  • the audio decoding identifiers in the audio decoding identifier set may be sorted according to the strength of the audio decoding performance, and then the target audio decoding identifier with the strongest audio decoding performance in the audio decoding identifier set may be obtained according to the ranking.
  • Step 606 Obtain the target video decoding identifier with the strongest video decoding performance from the video decoding identifier set, and perform decoding processing on the video stream through the video decoder corresponding to the target video decoding identifier to obtain the decoded video stream.
  • the video decoding identifier set corresponding to the video stream format is obtained.
  • the set of video decoding identifiers includes at least one video decoding identifier arranged in sequence, and the set of video decoding identifiers includes at least one video decoding identifier arranged in sequence.
  • the target video decoding identifier with the strongest video decoding performance can be obtained from the video decoding identifier set.
  • the video decoding performance indicates the performance of the decoder corresponding to the video decoding identifier, and the video stream is decoded according to the obtained target video decoding identifier with the strongest video decoding performance.
  • the method for obtaining the target video decoding identifier from the video decoding identifier set is not limited.
  • the video decoding identifiers in the video decoding identifier set may be sorted according to the strength of the video decoding performance, and then the target video decoding identifier with the strongest video decoding performance in the video decoding identifier set may be obtained according to the ranking.
  • steps in the flowcharts of FIGS. 1, 2, 4, 5, and 6 are displayed in order according to the arrows, the steps are not necessarily executed in the order indicated by the arrows. Unless clearly stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least some of the steps in FIGS. 1, 2, 4, 5, and 6 may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with at least a part of other steps or sub-steps or stages of other steps.
  • the above video decoding method may further specifically include:
  • the original video file is used as the video file to be processed
  • the first original file format is used as the first file format of the video to be processed
  • the second original file format As the second file format of the video to be processed.
  • the video decoding method provided in the above embodiment can accurately select the parser and decoder according to the format of the video file to be processed, thereby improving the decoding efficiency of the video file.
  • the cause of the error can be located according to the error data, and then the corresponding parser or decoder can be selected according to the cause of the error, thereby further improving the decoding efficiency of the video file.
  • the video decoding apparatus 700 includes a file acquisition module 702, an analysis set acquisition module 704, an analysis processing module 706, a decoding set module 708, and a decoding processing module 710. among them:
  • the file obtaining module 702 is used to obtain a to-be-processed video file and obtain a first file format and a second file format corresponding to the to-be-processed video file.
  • the first file format is used to represent the format of the to-be-processed video file
  • the second file format is used Is used to indicate the format of audio and video streams in the video file to be processed.
  • the parsing set obtaining module 704 is used to obtain a parsing identification set corresponding to the first file format.
  • the parsing and processing module 706 is used to obtain the target parsing identifier with the strongest parsing performance from the parsing identifier set, and parsing the video file to be processed through the parser corresponding to the target parsing identifier to obtain an audio and video stream. Represents the performance of the parser corresponding to the parsing identifier;
  • the decoding set obtaining module 708 is used to obtain a decoding identification set corresponding to the second file format.
  • the decoding processing module 710 is used to obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream through the decoder corresponding to the target decoding identifier to obtain the decoded audio and video stream, wherein, decoding Performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
  • the video decoding device After obtaining the to-be-processed video file and the corresponding first file format and second file format, the video decoding device provided in the above embodiment may obtain the corresponding resolution identification set according to the first file format and obtain from the resolution identification set The target parsing mark, through the parser corresponding to the target parsing mark, analyzes the video file to be processed to obtain an audio and video stream. Then, the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier is obtained from the decoding identifier set. Finally, the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream. In this way, the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
  • the above-mentioned file obtaining module 702 is further configured to send a file obtaining request to the server; receiving the video file to be processed returned by the server according to the file obtaining request, and the first file format and the second file format corresponding to the video file to be processed .
  • the above file obtaining module 702 is further used to receive the original video file returned by the server according to the file obtaining request, and the first original file format and the second original file format corresponding to the original video file; when the first original file exists When parsing the identification set corresponding to the format, the original video file is used as the video file to be processed, the first original file format is used as the first file format of the video to be processed, and the second original file format is used as the second file format of the video to be processed ; When there is no set of parsing identifiers corresponding to the first original file format, send a format conversion request to the server; receive the to-be-processed video file and the to-be-processed video file obtained by format conversion of the original video file according to the format conversion request sent by the server Corresponding first file format and second file format.
  • the resolution identification set includes at least one resolution identification sorted according to resolution performance.
  • the above-mentioned resolution processing module 706 is further used to obtain the first arrangement order of the resolution identifications included in the resolution identification set according to the second file format, according to The first sorting order obtains the target resolution identifier from the resolution identifier set.
  • the parsing processing module 706 is further configured to obtain the first target parsing identifier from the set of parsing identifiers according to the first sort order, and perform the first parsing processing on the video file to be processed through the parser corresponding to the first target parsing identifier ;
  • the first parsing process reports an error
  • obtain the first error reporting data obtained during the first parsing process and obtain the second target parsing identification from the parsing identification set according to the first error reporting data; through the parser corresponding to the second target parsing identification Perform a second parsing process on the video file to be processed to obtain an audio and video stream.
  • the parsing processing module 706 is further configured to count the number of errors reported during the first parsing process of the video file to be processed when the first parsing process reports an error; when the number of reported errors is less than or equal to the threshold number of times, return to execute The first sorting sequence obtains the first target resolution identifier from the set of resolution identifiers, and performs the first resolution processing step on the video file to be processed through the parser corresponding to the first target resolution identifier; when the number of error reports is greater than the threshold value, the first resolution is obtained The first error data obtained during processing.
  • the set of decoding identifiers includes at least one decoding identifier sorted according to decoding performance
  • the above-mentioned decoding processing module 710 is further used to obtain a second arrangement order of the decoding identifiers included in the set of decoding identifiers, from Obtain the target decoding identifier from the decoding identifier set.
  • the above-mentioned decoding processing module 710 is further configured to obtain the first target decoding identifier from the set of decoding identifiers according to the second arrangement order, and perform the first decoding of the audio and video stream by the decoder corresponding to the first target decoding identifier Processing; when the first decoding process reports an error, obtain the second error reporting data obtained during the first decoding process, and obtain the second target decoding identifier from the decoding identification set according to the second error reporting data; The decoder performs a second decoding process on the audio and video stream to obtain the decoded audio and video stream.
  • the audio and video stream includes an audio stream and a video stream
  • the second file format includes an audio stream format and a video stream format
  • the above-mentioned decoding processing module 710 is further used to obtain an audio decoding identifier set corresponding to the audio stream format and obtain The video decoding identifier set corresponding to the video stream format; obtain the target audio decoding identifier with the strongest audio decoding performance from the audio decoding identifier set, and perform decoding processing on the audio stream through the audio decoder corresponding to the target audio decoding identifier to obtain the decoded Audio stream; and obtain the target video decoding identifier with the strongest video decoding performance from the video decoding identifier set, and decode the video stream through the video decoder corresponding to the target video decoding identifier to obtain the decoded video stream.
  • each module in the above video decoding device is for illustration only. In other embodiments, the video decoding device may be divided into different modules as needed to complete all or part of the functions of the above video decoding device.
  • Each module in the above video decoding device may be implemented in whole or in part by software, hardware, or a combination thereof.
  • the above modules may be embedded in the hardware or independent of the processor in the computer device, or may be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • An embodiment of the present application also provides an electronic device. As shown in FIG. 8, for ease of description, only parts related to the embodiments of the present application are shown, and specific technical details are not disclosed, please refer to the method part of the embodiments of the present application.
  • the electronic device may be any terminal device including a mobile phone, tablet computer, PDA (Personal Digital Assistant), POS (Point of Sales), in-vehicle computer, wearable device, etc. Taking the electronic device as a mobile phone for example :
  • the mobile phone includes: a radio frequency (Radio Frequency) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, and a processor 880 , And power supply 890 and other components.
  • Radio Frequency Radio Frequency
  • a memory 820 for storing data
  • a sensor 850 for detecting and a wireless fidelity
  • WiFi wireless fidelity
  • processor 880 a processor 880
  • power supply 890 and other components.
  • the structure of the mobile phone shown in FIG. 8 does not constitute a limitation on the mobile phone, and may include more or fewer components than those shown in the figure, or a combination of certain components, or a different component arrangement.
  • the RF circuit 810 can be used to receive and send signals during the sending and receiving of information or during a call. It can receive the downlink information of the base station and process it to the processor 880; it can also send the uplink data to the base station.
  • RF circuits include but are not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (Low Noise Amplifier, LNA), duplexer, and so on.
  • the RF circuit 810 can also communicate with other devices through a wireless communication network.
  • the above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile (GSM), General Packet Radio Service (GPRS), and Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Message Service (SMS), etc.
  • GSM Global System of Mobile
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short Message Service
  • the memory 820 may be used to store software programs and modules.
  • the processor 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820.
  • the memory 820 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system and at least one function-required application program (such as a sound playback function application program, an image playback function application program, etc.), etc.;
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone.
  • the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the input unit 830 may be used to receive input numeric or character information, and generate key signal input related to user settings and function control of the mobile phone 800.
  • the input unit 830 may include a touch panel 831 and other input devices 832.
  • the touch panel 831 also known as a touch screen, can collect user's touch operations on or near it (such as the user using any finger, stylus, or any other suitable object or accessory on or near the touch panel 831 Operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 831 may include a touch detection device and a touch controller.
  • the touch detection device detects the user's touch orientation, and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into contact coordinates To the processor 880, and can receive the command sent by the processor 880 and execute it.
  • the touch panel 831 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 830 may also include other input devices 832.
  • other input devices 832 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), and the like.
  • the display unit 840 may be used to display information input by the user or information provided to the user and various menus of the mobile phone.
  • the display unit 840 may include a display panel 841.
  • the display panel 841 may be configured in the form of a liquid crystal display (Liquid Crystal) (LCD), an organic light emitting diode (Organic Light-Emitting Diode, OLED), or the like.
  • the touch panel 831 may cover the display panel 841, and when the touch panel 831 detects a touch operation on or near it, it is transmitted to the processor 880 to determine the type of touch event, and then the processor 880 according to The type of touch event provides a corresponding visual output on the display panel 841.
  • the touch panel 831 and the display panel 841 are implemented as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 831 and the display panel 841 may be integrated and Realize the input and output functions of the mobile phone.
  • the mobile phone 800 may further include at least one sensor 850, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 841 according to the brightness of the ambient light, and the proximity sensor may close the display panel 841 and/or when the mobile phone moves to the ear Or backlight.
  • the motion sensor may include an acceleration sensor. The acceleration sensor can detect the magnitude of acceleration in various directions, and can detect the magnitude and direction of gravity when at rest. Pedometer, percussion), etc.
  • the mobile phone can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor and so on.
  • the audio circuit 860, the speaker 861, and the microphone 862 may provide an audio interface between the user and the mobile phone.
  • the audio circuit 860 can transmit the converted electrical signal of the received audio data to the speaker 861, and the speaker 861 converts it into a sound signal output; on the other hand, the microphone 862 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 860 After receiving, it is converted into audio data, and then processed by the audio data output processor 880, and then sent to another mobile phone via the RF circuit 810, or the audio data is output to the memory 820 for subsequent processing.
  • WiFi is a short-range wireless transmission technology.
  • the mobile phone can help users send and receive e-mails, browse web pages, and access streaming media through the WiFi module 870. It provides users with wireless broadband Internet access.
  • FIG. 8 shows the WiFi module 870, it can be understood that it is not a necessary component of the mobile phone 800, and may be omitted as needed.
  • the processor 880 is the control center of the mobile phone, connects various parts of the entire mobile phone with various interfaces and lines, executes or executes the software programs and/or modules stored in the memory 820, and calls the data stored in the memory 820 to execute Various functions and processing data of the mobile phone, so as to monitor the mobile phone as a whole.
  • the processor 880 may include one or more processing units.
  • the processor 880 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, user interface, application programs, and the like; the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 880.
  • the mobile phone 800 further includes a power supply 890 (such as a battery) that supplies power to various components.
  • a power supply 890 (such as a battery) that supplies power to various components.
  • the power supply can be logically connected to the processor 880 through a power management system, so as to realize functions such as charging, discharging, and power management through the power management system.
  • the mobile phone 800 may further include a camera, a Bluetooth module, and the like.
  • the embodiments of the present application also provide a computer-readable storage medium.
  • One or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, causing the processors to execute the video decoding method provided by the foregoing embodiments step.
  • Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM), which acts as external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR) SDRAM, enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous Link (Synchlink) DRAM
  • Rambus direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Abstract

A video decoding method comprises: acquiring a video file to be processed and a first file format and a second file format corresponding thereto; acquiring a target parser identifier from a parser identifier set corresponding to the first file format, and using a parser corresponding to the target parser identifier to parse the video file so as to obtain an audio and video stream; and acquiring a target decoder identifier from a decoder identifier set corresponding to the second file format, and using a decoder corresponding to the target decoder identifier to decode the audio and video stream.

Description

视频解码方法、装置、电子设备、计算机可读存储介质Video decoding method, device, electronic equipment, computer readable storage medium 技术领域Technical field
本申请涉及计算机技术领域,特别是涉及一种视频解码方法、装置、电子设备、计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to a video decoding method, device, electronic device, and computer-readable storage medium.
背景技术Background technique
电子设备可以展示图片、播放音乐,还可以播放视频等。一般地,在生成待处理视频文件的时候,采用的编码方式不同,会生成不同格式的待处理视频文件。对编码后的待处理视频文件进行播放的之前,需要先对待处理视频文件进行解码。因此,在对不同格式的待处理视频文件进行播放的时候,所采用的解码方式也不同。Electronic devices can display pictures, play music, and also play videos. Generally, when a video file to be processed is generated, different encoding methods are used, and a video file to be processed in a different format is generated. Before playing the encoded video file to be processed, the video file to be processed needs to be decoded. Therefore, when playing to-be-processed video files in different formats, the decoding methods adopted are also different.
发明内容Summary of the invention
本申请实施例提供一种视频解码方法、装置、电子设备、计算机可读存储介质。Embodiments of the present application provide a video decoding method, device, electronic device, and computer-readable storage medium.
一种视频解码方法,包括:A video decoding method, including:
获取待处理视频文件,并获取所述待处理视频文件对应的第一文件格式和第二文件格式,所述第一文件格式用于表示所述待处理视频文件的格式,所述第二文件格式用于表示所述待处理视频文件中的音视频流的格式;Acquiring a to-be-processed video file, and acquiring a first file format and a second file format corresponding to the to-be-processed video file, the first file format is used to represent the format of the to-be-processed video file, and the second file format It is used to indicate the format of the audio and video stream in the to-be-processed video file;
获取所述第一文件格式对应的解析标识集合;Obtaining a set of resolution identifiers corresponding to the first file format;
从所述解析标识集合中获取解析性能最强的目标解析标识,并通过所述目标解析标识对应的解析器对所述待处理视频文件进行解析处理,得到音视频流,其中,所述解析性能用于表示解析标识对应的解析器的性能;Obtaining the target resolution identifier with the strongest resolution performance from the set of resolution identifiers, and parsing the to-be-processed video file through a parser corresponding to the target resolution identifier to obtain an audio and video stream, wherein the resolution performance Used to indicate the performance of the parser corresponding to the parsing identifier;
获取所述第二文件格式对应的解码标识集合;及Obtaining a set of decoding identifiers corresponding to the second file format; and
从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,其中,所述解码性能用于表示解码标识对应的解码器的性能。Obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain a decoded audio and video stream, wherein, the The decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
一种视频解码装置,包括:A video decoding device, including:
文件获取模块,用于获取待处理视频文件,并获取所述待处理视频文件对应的第一文件格式和第二文件格式,所述第一文件格式用于表示所述待处理视频文件的格式,所述第二文件格式用于表示所述待处理视频文件中的音视频流的格式;A file obtaining module, configured to obtain a to-be-processed video file, and obtain a first file format and a second file format corresponding to the to-be-processed video file, the first file format is used to represent the format of the to-be-processed video file, The second file format is used to represent the format of the audio and video stream in the video file to be processed;
解析集合获取模块,用于获取所述第一文件格式对应的解析标识集合;A parsing set acquisition module, used to acquire a parsing identification set corresponding to the first file format;
解析处理模块,用于从所述解析标识集合中获取解析性能最强的目标解析标识,并通过所述目标解析标识对应的解析器对所述待处理视频文件进行解析处理,得到音视频流,其中,所述解析性能用于表示解析标识对应的解析器的性能;A parsing processing module, configured to obtain a target parsing identifier with the strongest parsing performance from the parsing identifier set, and parsing the to-be-processed video file through a parser corresponding to the target parsing identifier to obtain an audio and video stream Wherein, the parsing performance is used to indicate the performance of the parser corresponding to the parsing identifier;
解码集合获取模块,用于获取所述第二文件格式对应的解码标识集合;及A decoding set acquisition module, for acquiring a decoding identification set corresponding to the second file format; and
解码处理模块,用于从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,其中,所述解码性能用于表示解码标识对应的解码器的性能。A decoding processing module, configured to obtain a target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain decoded audio and video Stream, where the decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行上述视频解码方法的步骤。An electronic device includes a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor causes the processor to perform the steps of the video decoding method.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述视频解码方法的步骤。A computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the steps of the above video decoding method.
上述视频解码方法、装置、电子设备、计算机可读存储介质,在获取到待处理视频文件及对应的第一文件格式和第二文件格式之后,可以根据第一文件格式获取对应的解析标 识集合,并从解析标识集合中获取解析性能最强的目标解析标识,通过目标解析标识对应的解析器对待处理视频文件进行解析处理,得到音视频流。然后根据第二文件格式获取对应的解码标识集合,并从解码标识集合中获取解码性能最强的目标解码标识。最后通过目标解码标识对应的解码器对音视频流进行解码处理,得到解码后的音视频流。这样可以根据待处理视频文件的格式精准地选择解析器和解码器,提高了视频文件的解码效率。After obtaining the video file to be processed and the corresponding first file format and second file format, the above video decoding method, device, electronic device, and computer-readable storage medium may obtain the corresponding set of resolution identifiers according to the first file format, And obtain the target resolution identifier with the strongest resolution performance from the resolution identifier set, and analyze and process the video file to be processed by the parser corresponding to the target resolution identifier to obtain the audio and video stream. Then, the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier with the strongest decoding performance is obtained from the decoding identifier set. Finally, the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream. In this way, the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly explain the embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, without paying any creative work, other drawings can be obtained based on these drawings.
图1为一个实施例中视频解码方法的流程图;FIG. 1 is a flowchart of a video decoding method in an embodiment;
图2为另一个实施例中视频解码方法的流程图;2 is a flowchart of a video decoding method in another embodiment;
图3为一个实施例中对待处理视频文件进行解码的示意图;3 is a schematic diagram of decoding a video file to be processed in an embodiment;
图4为又一个实施例中视频解码方法的流程图;4 is a flowchart of a video decoding method in yet another embodiment;
图5为又一个实施例中视频解码方法的流程图;5 is a flowchart of a video decoding method in yet another embodiment;
图6为又一个实施例中视频解码方法的流程图;6 is a flowchart of a video decoding method in yet another embodiment;
图7为一个实施例中视频解码装置的结构示意图;7 is a schematic structural diagram of a video decoding device in an embodiment;
图8为与本申请实施例提供的电子设备相关的手机的部分结构的框图。8 is a block diagram of a partial structure of a mobile phone related to an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be described in further detail in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一文件格式称为第二文件格式,且类似地,可将第二文件格式称为第一文件格式。第一文件格式和第二文件格式两者都是文件格式,但其不是同一文件格式。It can be understood that the terms “first”, “second”, etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the present application, the first file format may be referred to as the second file format, and similarly, the second file format may be referred to as the first file format. Both the first file format and the second file format are file formats, but they are not the same file format.
图1为一个实施例中视频解码方法的流程图。如图1所示,该视频解码方法包括步骤102至步骤110。其中:FIG. 1 is a flowchart of a video decoding method in an embodiment. As shown in FIG. 1, the video decoding method includes steps 102 to 110. among them:
步骤102,获取待处理视频文件,并获取待处理视频文件对应的第一文件格式和第二文件格式,第一文件格式用于表示待处理视频文件的格式,第二文件格式用于表示待处理视频文件中的音视频流的格式。Step 102: Obtain a video file to be processed, and obtain a first file format and a second file format corresponding to the video file to be processed. The first file format is used to indicate the format of the video file to be processed, and the second file format is used to indicate the to-be-processed The format of the audio and video streams in the video file.
在一个实施例中,电子设备可以对视频文件进行编码,编码的方式多种多样,不同编码方式对视频文件进行编码后的文件格式不同。例如,常见的视频编码格式有WMV(Windows Media Video,媒体视频格式)、MPEG(Moving Pictures Experts Group,动态图象专家组)、MP4(Moving Picture Experts Group 4,动态图象专家组4)FFMPEG(Fast Forward Moving Pictures Experts Group,快进动态图象专家组)。In one embodiment, the electronic device may encode the video file, and there are various encoding methods, and different encoding methods encode the video file in different file formats. For example, common video encoding formats are WMV (Windows Media Video, Media Video Format), MPEG (Moving Pictures Experts Group, Motion Picture Experts Group), MP4 (Moving Pictures Experts Group 4, Motion Picture Experts Group 4) FFMPEG ( Fast, Forward, Moving Pictures, Experts Group).
具体的,编码的主要作用是将视频像素数据和音频数据压缩成为码流,从而降低视频文件的数据量。音视频流即为将视频像素数据和音频数据压缩成为的码流,具体可以包括音频流和视频流。电子设备获取的可以是存储在本地的视频文件,也可以是接收的其他电子设备发送的视频文件,在此不做限定。例如,用户可以启动终端中的第三方应用程序,通过第三方应用程序发起视频文件的获取指令,然后终端可以根据该获取指令向服务器发 起获取视频文件的获取请求,服务器在接收到获取请求之后,将对应的视频文件发送给终端。Specifically, the main function of encoding is to compress video pixel data and audio data into a code stream, thereby reducing the amount of data in the video file. The audio and video stream is a code stream into which video pixel data and audio data are compressed, and may specifically include an audio stream and a video stream. The electronic device may obtain a video file stored locally or a video file sent by another electronic device, which is not limited herein. For example, a user may start a third-party application in the terminal, and initiate a video file acquisition instruction through the third-party application, and then the terminal may initiate an acquisition request to acquire a video file to the server according to the acquisition instruction. After the server receives the acquisition request, Send the corresponding video file to the terminal.
获取到待处理视频文件之后,可以读取待处理视频文件的文件字节,在读取视频文件开头部分的字节之后,就可以根据读取的字节就得到视频文件的文件格式。其中,待处理视频文件的文件格式包括第一文件格式和第二文件格式,第一文件格式用于表示待处理视频文件的格式,第二文件格式用于表示待处理视频文件中的音视频流的格式。After obtaining the to-be-processed video file, the file bytes of the to-be-processed video file can be read. After reading the bytes at the beginning of the video file, the file format of the video file can be obtained according to the read bytes. The file format of the video file to be processed includes a first file format and a second file format. The first file format is used to represent the format of the video file to be processed, and the second file format is used to represent the audio and video stream in the video file to be processed. Format.
例如,第一文件格式可以是待处理视频文件的文件ID,第二文件格式可以包括音频流的Mimetype(Multipurpose Internet Mail Extensions Type,多用途互联网邮件扩展类型)、视频流的Chumktype(文件封装类型)、音频流的Codec ID(Codec Identification,编解码器标识)、音频流的Mimetype、音频流的Codec ID以及音频流的Chumktype等中的一种或多种。For example, the first file format may be the file ID of the video file to be processed, and the second file format may include the Mimetype (Multipurpose Internet Mail Extensions) of the audio stream and the Chumktype (file encapsulation type) of the video stream One or more of Codec ID (Codec Identification) of audio stream, Mimetype of audio stream, Codec ID of audio stream, Chumktype of audio stream, etc.
步骤104,获取第一文件格式对应的解析标识集合。Step 104: Acquire a set of resolution identifiers corresponding to the first file format.
在本申请提供的实施例中,电子设备中可以存储解析标识集合,并预先建立解析标识集合与第一文件格式的对应关系。在获取到第一文件格式之后,根据上述解析标识集合与第一文件格式的对应关系就可以获取第一文件格式对应的解析标识集合。In the embodiment provided by the present application, the electronic device may store the resolution identification set, and a correspondence relationship between the resolution identification set and the first file format is established in advance. After the first file format is obtained, the analysis identifier set corresponding to the first file format can be obtained according to the corresponding relationship between the analysis identifier set and the first file format.
具体的,解析标识集合中包含至少一个解析标识,该解析标识用于标示对视频文件进行解析的解析器。解析标识集合中包含的解析标识所对应的解析器,可用于将对应的第一文件格式的视频文件进行解析。Specifically, the set of parsing identifiers includes at least one parsing identifier, and the parsing identifier is used to indicate a parser that parses the video file. The parser corresponding to the parsing identifier included in the parsing identifier set may be used to parse the corresponding video file in the first file format.
例如,待处理视频文件的第一文件格式为待处理视频文件的文件ID,若待处理视频文件的文件ID为"video/mp4",能够解析文件ID为"video/mp4"的视频文件的解析器有MPEG4Extractor解析器、ffmpeg解析器、MP4解析器。电子设备中存储的"video/mp4"对应的解析标识集合就可以包括MPEG4Extractor解析器、ffmpeg解析器、MP4解析器对应的解析标识。For example, the first file format of the to-be-processed video file is the file ID of the to-be-processed video file. If the file ID of the to-be-processed video file is "video/mp4", it can parse the video file with the file ID of "video/mp4" There are MPEG4Extractor parser, ffmpeg parser, MP4 parser. The set of parsing identifiers corresponding to "video/mp4" stored in the electronic device may include parsing identifiers corresponding to the MPEG4Extractor parser, ffmpeg parser, and MP4 parser.
步骤106,从解析标识集合中获取解析性能最强的目标解析标识通过目标解析标识对应的解析器对待处理视频文件进行解析处理,得到音视频流,其中,解析性能用于表示解析标识对应的解析器的性能。Step 106: Obtain the target resolution identifier with the strongest resolution performance from the set of resolution identifiers. The parser corresponding to the target resolution identifier analyzes the video file to be processed to obtain an audio and video stream. The resolution performance is used to indicate the resolution corresponding to the resolution identifier. Performance.
获取到解析标识集合之后,可以从解析标识集合中获取解析性能最强的目标解析标识。解析性能用于表示解析标识对应的解析器的性能,具体的,解析性能可以是根据解析器解析视频文件的稳定性、速度、兼容性、出错率中的一种或多种得到的,不限于此。After the resolution identification set is obtained, the target resolution identification with the strongest resolution performance can be obtained from the resolution identification set. The parsing performance is used to indicate the performance of the parser corresponding to the parsing logo. Specifically, the parsing performance may be obtained according to one or more of the stability, speed, compatibility, and error rate of parsing the video file by the parser, and is not limited to this.
在一个实施例中,解析标识集合中包含的解析标识可以带有解析性能标记,根据解析性能标记可以判断对应的解析器的解析性能的强弱,从而筛选出解析性能最强的目标解析标识。还可以根据解析性能的强弱对解析标识进行排序,解析标识在解析标识集合中的排序越靠前,对第一文件格式的视频文件的解析性能越强,根据排序就可以筛选出解析性能最强的目标解析标识。可以理解的是,还可以是根据其他方式筛选目标解析标识,在此不做限定。In one embodiment, the analysis identifiers included in the analysis identifier set may be provided with analysis performance tags, and according to the analysis performance tags, it is possible to determine the strength of the analysis performance of the corresponding resolver, so as to filter out the target analysis identification with the strongest analysis performance. You can also sort the analysis tags according to the strength of the analysis performance. The higher the order of the analysis tags in the analysis identification set, the stronger the analysis performance of the video file in the first file format. According to the sorting, you can filter out the most analytical performance Strong target resolution identification. It can be understood that the target resolution identifier may be filtered according to other methods, which is not limited herein.
在获取到目标解析标识之后,可以通过目标解析标识对应的解析器对待处理视频文件进行解析处理。在对待处理视频文件进行解析处理后,可以获取到待处理视频文件的属性信息以及音视频流等。例如,通过解析处理获取视频文件中的音视频流,还可以得到视频流的播放时长、视频图像的尺寸、音频流的音频格式等属性信息。After the target parsing identifier is obtained, the parser corresponding to the target parsing identifier can be processed for parsing. After parsing the video file to be processed, you can obtain the attribute information of the video file to be processed and the audio and video streams. For example, by parsing the audio and video streams in the video file, you can also obtain attribute information such as the playback duration of the video stream, the size of the video image, and the audio format of the audio stream.
可以理解的是,电子设备可以采用自身集成的解析器对视频文件进行解析,也可以调用第三方解析平台的API(Application Programming Interface,应用程序编程接口)对视频文件进行解析,在此不做限定。It can be understood that the electronic device can use its own integrated parser to parse the video file, or it can call the API (Application Programming Interface) of a third-party parsing platform to parse the video file, which is not limited here. .
在本申请提供的实施例中,上述解析标识集合中可以包含按照解析性能排序的至少一个解析标识,获取目标解析标识的步骤具体可以包括:根据第二文件格式获取解析标识集合中包含的解析标识的第一排列顺序,按照第一排列顺序从解析标识集合中获取目标解析 标识。In the embodiment provided by the present application, the above-mentioned resolution identification set may include at least one resolution identification sorted according to the resolution performance, and the step of obtaining the target resolution identification may specifically include: obtaining the resolution identification included in the resolution identification set according to the second file format In the first arrangement order, obtain the target resolution identifier from the resolution identifier set according to the first arrangement sequence.
步骤108,获取第二文件格式对应的解码标识集合。Step 108: Acquire a set of decoding identifiers corresponding to the second file format.
电子设备中可以存储解码标识集合,并预先建立解码标识集合与第二文件格式的对应关系。在获取到第二文件格式之后,根据上述解码标识集合与第二文件格式的对应关系就可以获取第二文件格式对应的解码标识集合。具体的,解码标识集合中包含顺序排列的至少一个解码标识,该解码标识用于标示对视频文件进行解码的解码器。解码标识集合中包含的解码标识所对应的解码器,可用于将对应的第二文件格式的视频文件进行解码。The electronic device may store a set of decoding identifiers, and pre-establish a correspondence between the set of decoding identifiers and the second file format. After the second file format is obtained, the set of decoding identifiers corresponding to the second file format can be obtained according to the correspondence between the above set of decoding identifiers and the second file format. Specifically, the set of decoding identifiers includes at least one decoding identifier arranged in sequence, and the decoding identifier is used to indicate a decoder that decodes the video file. The decoder corresponding to the decoding identifier included in the decoding identifier set may be used to decode the corresponding video file in the second file format.
例如,第二文件格式为视频流的Minetype,若视频流的Minetype为“video/avc”,而能够对Minetype为“video/avc”的视频流进行解码的解码器有高通AVC(Advanced Video Coding,高级视频编码)硬解码器、谷歌AVC软解码器、ffmpeg AVC解码器。那么Minetype为“video/avc”时对应的解码标识集合中包含的即为高通AVC硬解码器、谷歌AVC软解码器、ffmpeg AVC解码器对应的解码标识。For example, the second file format is the Minetype of the video stream. If the Minetype of the video stream is "video/avc", the decoder that can decode the video stream with the Minetype of "video/avc" is Qualcomm AVC (Advanced Video Coding, Advanced video coding) Hard decoder, Google AVC soft decoder, ffmpeg AVC decoder. Then, when the Minetype is "video/avc", the corresponding decoding identification set contains the decoding identification corresponding to the Qualcomm AVC hard decoder, Google AVC soft decoder, and ffmpeg AVC decoder.
步骤110,从解码标识集合中获取解码性能最强的目标解码标识,并通过目标解码标识对应的解码器对音视频流进行解码处理,得到解码后的音视频流,其中,解码性能用于表示解码标识对应的解码器的性能。Step 110: Obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream through the decoder corresponding to the target decoding identifier to obtain a decoded audio and video stream, where the decoding performance is used to express The performance of the decoder corresponding to the decoding identifier.
获取到解码标识集合之后,可以从解码标识集合中获取目标解码标识。解码性能用于表示解码标识对应的解码器的性能,具体可以是根据解码器解码的稳定性、速度、兼容性、出错率中的一种或多种得到的,不限于此。After the decoding identifier set is obtained, the target decoding identifier can be obtained from the decoding identifier set. The decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier, and may specifically be obtained according to one or more of decoding stability, speed, compatibility, and error rate of the decoder, and is not limited thereto.
在一个实施例中,解码标识集合中包含的解码标识可以带有解码性能标记,根据解码性能标记可以判断对应的解码器的解码性能的强弱,从而筛选出解码性能最强的目标解码标识。还可以根据解码性能的强弱对解码标识进行排序,解码标识在解码标识集合中的排序越靠前,对音视频流的解码性能越强,根据排序就可以筛选出解码性能最强的目标解码标识。可以理解的是,还可以是根据其他方式筛选目标解码标识,在此不做限定。In one embodiment, the decoding identifiers included in the set of decoding identifiers may be provided with decoding performance flags, and according to the decoding performance flags, the decoding performance of the corresponding decoder may be judged, so as to filter out the target decoding identifier with the strongest decoding performance. You can also sort the decoding identifiers according to the strength of the decoding performance. The higher the ranking of the decoding identifiers in the decoding identifier set, the stronger the decoding performance of the audio and video streams. According to the ranking, the target decoding with the strongest decoding performance can be screened out. Logo. It can be understood that the target decoding identifier may also be selected according to other methods, which is not limited herein.
具体的,上述解码标识集合中包含按照解码性能排序的至少一个解码标识,获取目标解码标识的步骤具体可以包括:获取解码标识集合中包含的解码标识的第二排列顺序,按照第二排列顺序从解码标识集合中获取目标解码标识。Specifically, the above set of decoding identifiers includes at least one decoding identifier sorted according to decoding performance, and the step of acquiring the target decoding identifier may specifically include: obtaining a second arrangement order of the decoding identifiers included in the set of decoding identifiers, according to the second arrangement order Obtain the target decoding identifier from the decoding identifier set.
在获取到目标解码标识之后,可以通过目标解码标识对应的解码器对音视频流进行解码处理。在对音视频流进行解码处理后,得到的解码后的音视频流就可以在电子设备中进行播放。具体的,音视频流中包括音频流和视频流,通过目标解码标识对应的解码器分别对音频流和视频流进行解码处理,得到的解码后的音频流和解码后的视频流可以通过电子设备进行播放。After acquiring the target decoding identifier, the audio and video stream can be decoded by the decoder corresponding to the target decoding identifier. After decoding the audio and video stream, the obtained decoded audio and video stream can be played in the electronic device. Specifically, the audio and video stream includes an audio stream and a video stream, and the decoder corresponding to the target decoding identifier decodes the audio stream and the video stream respectively. The obtained decoded audio stream and decoded video stream can be passed through an electronic device To play.
上述实施例提供的视频解码方法,在获取到待处理视频文件及对应的第一文件格式和第二文件格式之后,可以根据第一文件格式获取对应的解析标识集合,并从解析标识集合中获取解析性能最强的目标解析标识,通过目标解析标识对应的解析器对待处理视频文件进行解析处理,得到音视频流。然后根据第二文件格式获取对应的解码标识集合,并从解码标识集合中获取解码性能最强的目标解码标识。最后通过目标解码标识对应的解码器对音视频流进行解码处理,得到解码后的音视频流。这样可以根据待处理视频文件的格式精准地选择解析器和解码器,提高了视频文件的解码效率。The video decoding method provided in the above embodiment, after obtaining the to-be-processed video file and the corresponding first file format and second file format, may obtain the corresponding parsing identifier set according to the first file format and obtain from the parsing identifier set The target parsing mark with the strongest parsing performance is analyzed and processed by the parser corresponding to the target parsing mark to obtain the audio and video stream. Then, the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier with the strongest decoding performance is obtained from the decoding identifier set. Finally, the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream. In this way, the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
图2为另一个实施例中视频解码方法的流程图。如图2所示,该视频解码方法包括步骤202至步骤220。其中:2 is a flowchart of a video decoding method in another embodiment. As shown in FIG. 2, the video decoding method includes steps 202 to 220. among them:
步骤202,向服务器发送文件获取请求。Step 202: Send a file acquisition request to the server.
在一个实施例中,上述电子设备可以是终端,终端在需要播放待处理视频文件时,可以向服务器发送获取待处理视频文件的请求。例如,终端上可以显示待处理视频文件的播放链接,当用户点击终端上显示的播放链接时,终端就向服务器发送文件获取请求,获取 待处理视频文件进行播放。In one embodiment, the electronic device may be a terminal. When the terminal needs to play a video file to be processed, the terminal may send a request to the server to obtain the video file to be processed. For example, the terminal may display a playback link of the video file to be processed. When the user clicks the playback link displayed on the terminal, the terminal sends a file acquisition request to the server to acquire the video file to be processed for playback.
终端向服务器发送的文件获取请求中可以包含发起该文件获取请求的终端标识、待处理视频文件的文件标识、请求发起时刻、接收请求的服务器标识等信息,在此不做限定。The file acquisition request sent by the terminal to the server may include information such as the terminal identification that initiated the file acquisition request, the file identification of the to-be-processed video file, the time when the request was initiated, and the server identification that received the request, which is not limited herein.
步骤204,接收服务器根据文件获取请求返回的待处理视频文件,以及待处理视频文件对应的第一文件格式和第二文件格式。Step 204: The receiving server returns the to-be-processed video file according to the file acquisition request, and the first and second file formats corresponding to the to-be-processed video file.
服务器在接收到文件获取请求之后,可以根据文件获取请求中包含的文件标识查找对应的待处理视频文件,并对获取的待处理视频文件进行初步解析,得到待处理视频文件的第一文件格式和第二文件格式。获取到待处理视频文件及对应的第一文件格式和第二文件格式之后,可以根据文件获取请求中包含的终端标识查找对应的终端,并将待处理视频文件及对应的第一文件格式和第二文件格式发送刚给终端标识对应的终端。After receiving the file acquisition request, the server may search for the corresponding video file to be processed according to the file identifier contained in the file acquisition request, and perform a preliminary analysis on the acquired video file to be processed to obtain the first file format of the video file to be processed and The second file format. After obtaining the to-be-processed video file and the corresponding first file format and second file format, the corresponding terminal can be searched for according to the terminal identifier included in the file acquisition request, and the to-be-processed video file and the corresponding first file format and The two file format is sent to the terminal corresponding to the terminal identification.
步骤206,获取第一文件格式对应的解析标识集合。Step 206: Acquire a set of resolution identifiers corresponding to the first file format.
不同格式的视频文件,解析时采用的解析器不同,因此不同第一文件格式对应的解析标识集合不同。解析标识集合可以是预先设置好的,在电子设备运行的过程中还可以对解析标识集合中包含的解析标识进行调整,在此不做限定。例如,统计解析标识集合中的解析标识对应的解析器对视频文件进行解析时出错的次数,根据出错的次数来调整解析标识的排序,如果出错的次数超过阈值,则将该解析标识移除该解析标识集合。The video files in different formats have different parsers used in parsing, so different first file formats have different sets of parsing identifiers. The resolution identification set may be preset, and the resolution identification included in the resolution identification set may be adjusted during the operation of the electronic device, which is not limited herein. For example, the number of errors in parsing the video file when the parser corresponding to the parsing identifier in the parsing identifier set is counted, and the order of the parsing identifiers is adjusted according to the number of errors. If the number of errors exceeds the threshold, the parsing identifier is removed Resolve the logo collection.
步骤208,根据第二文件格式获取解析标识集合中包含的解析标识的第一排列顺序,按照第一排列排序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。Step 208: Acquire the first arrangement order of the analysis identifiers contained in the analysis identifier set according to the second file format, obtain the first target analysis identifier from the analysis identifier set according to the first arrangement order, and pass the analysis corresponding to the first target analysis identifier The processor performs the first parsing process on the video file to be processed.
在一个实施例中,解析标识集合中包含的解析器可以对第一文件格式的视频文件进行解析,但是不同解析器对不同第二文件格式的视频文件的解析效果不同。因此,可以预先根据第二文件格式对解析标识集合中的解析标识进行排序,根据排序判断对应的解析器的解析性能强弱。例如,按照解析性能由强到弱的顺序对解析标识进行排序,解析标识集合中排序越靠前的解析标识,对应的解析器对待处理视频文件的解析性能越强。In one embodiment, the parser included in the parsing identification set can parse the video file in the first file format, but different parsers have different parsing effects on video files in different second file formats. Therefore, the analysis identifiers in the analysis identifier set may be sorted according to the second file format in advance, and the analysis performance of the corresponding parser is determined according to the order. For example, according to the order of the analysis performance from strong to weak, the analysis identifiers are sorted. The higher the analysis identifier in the analysis identifier set, the stronger the analysis performance of the corresponding parser to process the video file.
预先定义好第二文件格式与第一排列顺序的对应关系,根据第二文件格式与第一排列顺序对应关系可以获取第二文件格式对应的第一排列顺序。如果终端中不存在待处理视频文件的第二文件格式所对应的第一排列顺序,则可以采用默认的第一排列顺序获取目标解析标识。The correspondence relationship between the second file format and the first arrangement order is pre-defined, and the first arrangement order corresponding to the second file format can be obtained according to the correspondence relationship between the second file format and the first arrangement order. If there is no first arrangement sequence corresponding to the second file format of the video file to be processed in the terminal, the default first arrangement sequence may be adopted to obtain the target resolution identifier.
具体的,音视频流中包含音频流和视频流,则第二文件格式就可以包含音频流格式和视频流格式。那么第一排列顺序既可以是根据音频流格式建立的,也可以是根据视频流格式建立的,还可以是根据音频流格式和视频流格式共同建立的。上述获取第一排序顺序的步骤可以包括:可以根据音频流格式和/或视频流格式获取解析标识集合中包含的解析标识的第一排列顺序。Specifically, if the audio and video stream includes an audio stream and a video stream, the second file format may include an audio stream format and a video stream format. Then, the first arrangement order may be established according to the audio stream format, the video stream format, or the audio stream format and the video stream format. The above step of obtaining the first sorting order may include: obtaining the first sorting order of the resolution identifiers included in the resolution identifier set according to the audio stream format and/or the video stream format.
例如,MPEG4Extractor解析器不支持音频流Chunk type为“.mp3”和“ms02”的MP4视频文件的解析,也不支持视频流Chunk type为“mjpeg”或“sorenso”的MP4视频文件的解析。因此在解析上述第二文件格式的MP4视频文件时,就会选择对这类MP4视频文件兼容较好的ffmpeg解析器解析,而不是选择MPEG4Extractor解析器。For example, the MPEG4Extractor parser does not support the parsing of MP4 video files with Chunk type ".mp3" and "ms02" of the audio stream, nor does it support the parsing of MP4 video files with Chunk type "mjpeg" or "sorenso" of the video stream. Therefore, when parsing the MP4 video file in the above-mentioned second file format, the ffmpeg parser with better compatibility for this type of MP4 video file will be selected for parsing, rather than the MPEG4Extractor parser.
因此,在获取到解析标识集合之后,可以按照第一排列顺序从解析标识集合中获取第一目标解析标识,并根据第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。例如,解析标识集合中的解析标识可以按照解析性能由弱到强的顺序进行排列,则可以首先获取解析标识集合中排序末位的解析标识作为第一目标解析标识,然后通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。Therefore, after the set of parsing identifiers is obtained, the first target parsing identifier can be obtained from the set of parsing identifiers according to the first arrangement order, and the parser corresponding to the first target parsing identifier can be subjected to the first parsing process. For example, the resolution identifiers in the resolution identifier set can be arranged in order from weakest to strongest in resolution performance, then the last-ordered resolution identifier in the resolution identifier set can be obtained as the first target resolution identifier, and then the first target resolution identifier can be resolved The corresponding parser performs the first parsing process on the video file to be processed.
步骤210,当第一解析处理报错时,获取第一解析处理过程中得到的第一报错数据,根据第一报错数据从解析标识集合中获取第二目标解析标识。Step 210: When the first parsing process reports an error, obtain first error reporting data obtained during the first parsing process, and obtain a second target parsing identifier from the parsing identifier set according to the first error reporting data.
在通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理时,若第 一解析处理未报错,则可以直接根据第一解析处理得到音视频流;若第一解析处理报错,则说明该第一目标解析标识对应的解析器无法对待处理视频文件进行解析。在第一目标解析处理报错时,还可以得到第一解析处理的第一报错数据。通过该第一报错数据可以获取第一解析处理出错的原因。When the parser corresponding to the first target parsing identifier performs the first parsing process on the video file to be processed, if the first parsing process does not report an error, the audio and video stream can be obtained directly according to the first parsing process; if the first parsing process reports an error, It means that the parser corresponding to the first target parsing identifier cannot parse the video file to be processed. When the first target parsing process reports an error, the first parsing process first error reporting data may also be obtained. The reason for the error in the first parsing process can be obtained through the first error report data.
当根据第一目标解析标识对应的解析器进行第一解析处理报错的时候,可以根据第一报错数据得到出错的原因,从而根据第一报错数据从解析标识集合中精准地第二目标解析标识,然后根据获取的第二目标解析标识对应的解析器对待处理视频文件进行第二解析处理。When the parser corresponding to the first target parsing identifier performs the first parsing process and reports an error, the cause of the error may be obtained based on the first error reporting data, thereby accurately resolving the second target parsing identifier from the parsing identifier set based on the first error reporting data Then, the parser corresponding to the obtained second target parsing identifier is subjected to second parsing processing on the video file to be processed.
例如,第一报错数据可以表示为“无法对Codec ID为‘V_MS/VFW/FOURC’的视频流进行解析”,根据第一报错数据就可以知道解析处理是因为无法对上述格式的视频流进行解析才出错的,然后就可以针对性地去选择可以对上述格式的视频流进行解析的解析器。For example, the first error data can be expressed as "cannot parse the video stream whose Codec ID is'V_MS/VFW/FOURC'". According to the first error data, it can be known that the parsing process is because the above format video stream cannot be parsed Error, and then you can choose a parser that can parse the video stream in the above format.
步骤212,通过第二目标解析标识对应的解析器对待处理视频文件进行第二解析处理,得到音视频流。Step 212: Perform a second parsing process on the video file to be processed through a parser corresponding to the second target parsing identifier to obtain an audio and video stream.
在选取到第二目标解析标识之后,就可以通过第二目标解析标识对应的解析器对待处理视频文件进行第二解析处理,得到音视频流。具体的,待处理视频文件可以是有若干个字节的数据构成的,比如包含表示待处理视频的属性的数据、音视频流的数据、以及表示音视频流的属性的数据等。After the second target parsing identifier is selected, the parser corresponding to the second target parsing identifier can be subjected to second parsing processing to obtain the audio and video stream. Specifically, the to-be-processed video file may be composed of several bytes of data, for example, including data representing the attributes of the to-be-processed video, audio and video stream data, and data representing the attributes of the audio and video stream.
在对待处理视频文件进行解析的过程中,就可以通过读取待处理视频文件中包含的若干个字节的数据,并对读取的数据进行解析,得到待处理视频的属性、音视频流的属性以及音视频流等。解析出来的音频视流只是将表示音视频流的数据从待处理视频文件中分离出来,还不能直接被终端播放,需要将音视频流进行解码之后才能被终端播放。因此,在得到音视频流之后,还要对音视频流进行解码处理。In the process of parsing the video file to be processed, you can read the data of several bytes contained in the video file to be processed and parse the read data to obtain the attributes of the video to be processed and the audio and video stream. Properties and audio and video streams. The parsed audio video stream only separates the data representing the audio and video stream from the video file to be processed, and cannot be directly played by the terminal. The audio and video stream needs to be decoded before it can be played by the terminal. Therefore, after the audio and video streams are obtained, the audio and video streams must be decoded.
步骤214,获取第二文件格式对应的解码标识集合。Step 214: Acquire a set of decoding identifiers corresponding to the second file format.
在一个实施例中,在对待处理视频文件进行解码得到音视频流之后,可以根据音视频流的第二文件格式获取对应的解码标识集合。解码标识集合可以是预先设置好的,在电子设备运行的过程中还可以对解码标识集合中包含的解码标识进行调整,在此不做限定。例如,统计解码标识集合中的解码标识对应的解码器对视频文件进行解码时出错的次数,根据出错的次数来调整解码标识的排序,如果出错的次数超过阈值,则将该解码标识移除该解码标识集合。In one embodiment, after decoding the video file to be processed to obtain the audio and video stream, the corresponding set of decoding identifiers may be obtained according to the second file format of the audio and video stream. The decoding identifier set may be preset, and the decoding identifier included in the decoding identifier set may be adjusted during the operation of the electronic device, which is not limited herein. For example, the number of errors in decoding the video file by the decoder corresponding to the decoding identifier in the decoding identifier set is counted, and the order of the decoding identifiers is adjusted according to the number of errors. If the number of errors exceeds the threshold, the decoding identifier is removed. Decode identification set.
步骤216,获取解码标识集合中包含的解码标识的第二排列顺序,按照第二排列顺序从解码标识集合中获取第一目标解码标识,并通过第一目标解码标识对应的解码器对音视频流进行第一解码处理。Step 216: Acquire a second arrangement order of decoding identifiers included in the decoding identifier set, obtain a first target decoding identifier from the decoding identifier set according to the second arrangement order, and use the decoder to correspond to the audio and video stream corresponding to the first target decoding identifier The first decoding process is performed.
在一个实施例中,解码标识集合中包含的解码器可以对第二文件格式的视频文件进行解码,可以预先根据第二文件格式对解码标识集合中的解码标识进行排序,根据排序判断对应的解码器的解码性能强弱。例如,按照解码性能由强到弱的顺序对解码标识进行排序,解码标识集合中排序越靠前的解码标识,对应的解码器对第二文件格式的音视频流的解码性能越强。In one embodiment, the decoder included in the decoding identification set can decode the video file in the second file format, and can sort the decoding identifications in the decoding identification set according to the second file format in advance, and determine the corresponding decoding according to the order The decoding performance of the device is strong or weak. For example, the decoding identifiers are sorted in order from strongest to weakest decoding performance. The higher the decoding identifier in the decoding identifier set, the stronger the decoding performance of the corresponding decoder for the audio and video stream in the second file format.
在获取到解码标识集合之后,可以按照第二排列顺序从解码标识集合中获取第一目标解码标识,并根据第一目标解码标识对应的解码器对音视频流进行第一解码处理。例如,解码标识集合中的解码标识可以按照解码性能由弱到强的顺序进行排列,则可以首先获取解码标识集合中排序末位的解码标识作为第一目标解码标识,然后通过第一目标解码标识对应的解码器对音视频流进行第一解析处理。After the decoding identifier set is obtained, the first target decoding identifier can be obtained from the decoding identifier set according to the second arrangement order, and the first decoding process is performed on the audio and video stream according to the decoder corresponding to the first target decoding identifier. For example, the decoding identifiers in the decoding identifier set may be arranged in order from weak to strong decoding performance, and then the last-ordered decoding identifier in the decoding identifier set may be obtained as the first target decoding identifier, and then the first target decoding identifier The corresponding decoder performs the first parsing process on the audio and video stream.
步骤218,当第一解码处理报错时,获取第一解码处理过程中得到的第二报错数据,并根据第二报错数据从解码标识集合中获取第二目标解码标识。Step 218: When the first decoding process reports an error, obtain the second error reporting data obtained during the first decoding process, and obtain the second target decoding identifier from the decoding identification set according to the second error reporting data.
在通过第一目标解码标识对应的解码器对音视频流进行第一解码处理时,若第一解码 处理未报错,则可以直接根据第一解码处理得到音视频流;若第一解码处理报错,则说明该第一目标解码标识对应的解码器无法对上述音视频流进行解码。在第一目标解码处理报错时,还可以得到第一解码处理的第二报错数据。通过该第二报错数据可以获取第一解码处理出错的原因。When performing the first decoding process on the audio and video stream by the decoder corresponding to the first target decoding identifier, if the first decoding process does not report an error, the audio and video stream can be directly obtained according to the first decoding process; if the first decoding process reports an error, It means that the decoder corresponding to the first target decoding identifier cannot decode the above audio and video stream. When an error is reported by the first target decoding process, the second error reported data of the first decoding process can also be obtained. The reason for the error in the first decoding process can be obtained through the second error report data.
当根据第一目标解码标识对应的解码器进行第一解码处理报错的时候,可以根据第二报错数据得到出错的原因,从而根据第二报错数据从解码标识集合中精准地查找第二目标解码标识,然后根据获取的第二目标解码标识对应的解码器对音视频流进行第二解码处理。When the decoder corresponding to the first target decoding identifier performs the first decoding process and reports an error, the cause of the error can be obtained based on the second error reporting data, so that the second target decoding identifier can be accurately found from the decoding identification set according to the second error reporting data And then perform a second decoding process on the audio and video stream according to the obtained decoder corresponding to the second target decoding identifier.
在本申请提供的实施例中,步骤216具体还可以包括:获取解码标识集合中包含的解码标识的第二排列顺序,按照第二排列顺序依次从解码标识集合中获取第一目标解码标识,并通过第一目标解码标识对应的解码器对音视频流进行第一解码处理。步骤218具体还可以包括:当第一解码处理报错时,统计在对音视频流进行第一解码处理中的报错次数;当报错次数小于或等于次数阈值时,返回执行按照第二排列顺序从解码标识集合中获取第一目标解码标识,并通过第一目标解码标识对应的解码器对音视频流进行第一解码处理步骤;当报错次数大于次数阈值时,获取第一解码处理过程中得到的第二报错数据,并根据第二报错数据从解码标识集合中获取第二目标解码标识。In the embodiment provided by the present application, step 216 may specifically further include: acquiring a second arrangement order of the decoding identifiers included in the decoding identifier set, sequentially obtaining the first target decoding identifier from the decoding identifier set according to the second arrangement order, and The first decoding process is performed on the audio and video stream by the decoder corresponding to the first target decoding identifier. Step 218 may further specifically include: when the first decoding process reports an error, count the number of error reports during the first decoding process on the audio and video stream; when the number of error reports is less than or equal to the threshold value, return to perform decoding Obtain the first target decoding identifier from the identifier set, and perform the first decoding processing step on the audio and video stream through the decoder corresponding to the first target decoding identifier; when the number of error reports is greater than the threshold number of times, obtain the first decoded result obtained during the first decoding process Second error data, and obtain the second target decoding identifier from the decoding identifier set according to the second error reporting data.
步骤220,通过第二目标解码标识对应的解码器对音视频流进行第二解码处理,得到解码后的音视频流。Step 220: Perform a second decoding process on the audio and video stream through the decoder corresponding to the second target decoding identifier to obtain the decoded audio and video stream.
通过第二目标解码标识对应的解码器对音视频流进行第二解码处理,可以将音视频流解码生成可被终端播放的音视频流,即经过解码处理得到的解码后的音视频流就可以被终端播放。例如,音视频流是以二进制形式表示的,通过解码处理就可以将二进制形式的数据转换成可以被终端播放的图片和音频。By performing the second decoding process on the audio and video stream through the decoder corresponding to the second target decoding identifier, the audio and video stream can be decoded to generate an audio and video stream that can be played by the terminal, that is, the decoded audio and video stream obtained by the decoding process can be Played by the terminal. For example, audio and video streams are expressed in binary form, and the data in binary form can be converted into pictures and audio that can be played by the terminal through decoding processing.
图3为一个实施例中对待处理视频文件进行解码的示意图。如图3所示,待处理视频文件302中包含若干个二进制字节的数据,首先可以将待处理视频文件302中的数据进行解析,得到音频流304和视频流306。得到音频流304和视频流306之后,可以分别对音频流304和视频流306进行解码处理。对音频流304进行解码处理之后,得到解码后的音频流308。对视频流306进行解码处理之后,得到解码后的视频流310。完成解码后,电子设备可以对解码后的音频流308和解码后的视频流310进行播放。FIG. 3 is a schematic diagram of decoding a video file to be processed in an embodiment. As shown in FIG. 3, the to-be-processed video file 302 contains several binary bytes of data. First, the data in the to-be-processed video file 302 can be parsed to obtain an audio stream 304 and a video stream 306. After the audio stream 304 and the video stream 306 are obtained, the audio stream 304 and the video stream 306 can be decoded separately. After decoding the audio stream 304, a decoded audio stream 308 is obtained. After decoding the video stream 306, a decoded video stream 310 is obtained. After the decoding is completed, the electronic device can play the decoded audio stream 308 and the decoded video stream 310.
上述实施例提供的视频解码方法,可以根据待处理视频文件的格式精准地选择解析器和解码器,提高了视频文件的解码效率。同时,在对待处理视频文件进行解析或解码过程报错时,可以根据报错数据定位报错的原因,然后根据报错的原因选择对应的解析器或解码器,从而进一步地提高了视频文件的解码准确率以及解码效率。The video decoding method provided in the above embodiment can accurately select the parser and decoder according to the format of the video file to be processed, thereby improving the decoding efficiency of the video file. At the same time, when an error is reported during the parsing or decoding of the video file to be processed, the cause of the error can be located according to the error data, and then the corresponding parser or decoder can be selected according to the cause of the error, thereby further improving the decoding accuracy of the video file and Decoding efficiency.
在一个实施例中,如图4所示,获取待处理视频文件的方法具体还可以包括:In one embodiment, as shown in FIG. 4, the method for obtaining the video file to be processed may specifically include:
步骤402,接收服务器根据文件获取请求返回的原始视频文件,以及原始视频文件对应的第一原始文件格式和第二原始文件格式。Step 402: The receiving server returns the original video file according to the file acquisition request, and the first original file format and the second original file format corresponding to the original video file.
具体的,当服务器接收到文件获取请求的时候,服务器可以根据文件获取请求获取对应的原始视频文件。然后将原始视频文件进行初步解析,得到原始视频文件的第一原始文件格式和第二原始文件格式,并将原始视频文件以及对应的第一原始文件格式和第二原始文件格式返回给终端。第一原始文件格式用于表示原始视频文件的格式,第二原始文件格式用于表示原始视频文件中的音视频流的格式。Specifically, when the server receives the file acquisition request, the server may acquire the corresponding original video file according to the file acquisition request. Then, the original video file is preliminarily parsed to obtain the first original file format and the second original file format of the original video file, and the original video file and the corresponding first original file format and second original file format are returned to the terminal. The first original file format is used to represent the format of the original video file, and the second original file format is used to represent the format of the audio and video stream in the original video file.
步骤404,当存在第一原始文件格式对应的解析标识集合时,将原始视频文件作为待处理视频文件,并将第一原始文件格式作为待处理视频的第一文件格式,将第二原始文件格式作为待处理视频的第二文件格式。Step 404, when there is a set of parsing identifiers corresponding to the first original file format, the original video file is used as the video file to be processed, the first original file format is used as the first file format of the video to be processed, and the second original file format As the second file format of the video to be processed.
终端接收到原始视频文件以及对应的第一原始文件格式和第二原始文件格式之后,会查找第一原始文件格式对应的解析标识集合。若终端中存在第一原始文件格式 对应的解析标识集合,终端可以对第一原始文件格式的视频文件进行解析处理。这时可以直接将原始视频文件作为待处理视频文件,并将第一原始文件格式作为待处理视频的第一文件格式,将第二原始文件格式作为待处理视频的第二文件格式,并在终端中对待处理视频文件进行解析。After receiving the original video file and the corresponding first original file format and second original file format, the terminal will search for the set of parsing identifiers corresponding to the first original file format. If there is a set of resolution identifiers corresponding to the first original file format in the terminal, the terminal can parse the video file in the first original file format. At this time, the original video file can be directly used as the to-be-processed video file, the first original file format as the first file format of the to-be-processed video, and the second original file format as the second file format of the to-be-processed video. The video file to be processed is parsed.
步骤406,当不存在第一原始文件格式对应的解析标识集合时,向服务器发送格式转换请求。Step 406: When there is no set of resolution identifiers corresponding to the first original file format, send a format conversion request to the server.
若终端中不存在第一原始文件格式对应的解析标识集合,说明终端无法对第一原始文件格式的视频文件进行解析处理。这时,终端可以向服务器发送格式转换请求,通过服务器对原始视频文件进行格式转换,生成能被终端解析的视频文件。If there is no set of parsing identifiers corresponding to the first original file format in the terminal, it means that the terminal cannot parse the video file in the first original file format. At this time, the terminal can send a format conversion request to the server, and the server performs format conversion on the original video file to generate a video file that can be parsed by the terminal.
具体的,格式转换请求中可以包括原始视频文件的文件标识、终端支持解析的视频文件格式、发送格式转换请求的终端标识、接收格式转换请求的服务器标识等信息。服务器接收到格式转换请求之后,就可以获取文件标识对应的原始视频文件,然后将获取的原始视频文件转换成终端支持解析的待处理文件格式。Specifically, the format conversion request may include information such as the file identification of the original video file, the video file format supported by the terminal, the terminal identification that sends the format conversion request, and the server identification that receives the format conversion request. After receiving the format conversion request, the server can obtain the original video file corresponding to the file identifier, and then convert the obtained original video file into a file format to be processed that the terminal supports parsing.
在一个实施例中,当不存在第一原始文件格式对应的解析标识集合时,还可以进一步判断还可以调用终端中的解析器依次对第一原始文件格式的原始视频文件进行解析处理。如果终端中的所有解析器都不支持对原始视频文件的解析处理,说明终端中不支持对原始视频文件的解析处理,则可以向服务器发送格式转换请求;如果终端中存在支持对原始视频文件的解析处理的解析器,则说明终端中支持对原始视频文件的解析处理,则可以获取支持对原始视频文件进行解析处理的原始解析器,根据原始解析器对原始视频文件进行解析处理,并根据原始解析器对应的解析标识生成第一原始文件格式对应的解析标识集合。In one embodiment, when there is no set of parsing identifiers corresponding to the first original file format, it can be further determined that the parser in the terminal can also be called to sequentially analyze the original video files in the first original file format. If all parsers in the terminal do not support parsing processing of the original video file, it means that the terminal does not support parsing processing of the original video file, you can send a format conversion request to the server; if there is a terminal that supports the original video file The parser for parsing processing means that the terminal supports parsing processing of the original video file, and you can obtain the original parser that supports parsing the original video file. According to the original parser, the parsing process of the original video file is performed, and according to the original The parsing identifier corresponding to the parser generates a parsing identifier set corresponding to the first original file format.
当存在支持对原始视频文件进行解析处理的解析器时,这时可以直接将原始视频文件作为待处理视频文件,并将第一原始文件格式作为待处理视频的第一文件格式,将第二原始文件格式作为待处理视频的第二文件格式,并在终端中对待处理视频文件进行解析。When there is a parser that supports parsing the original video file, the original video file can be directly used as the to-be-processed video file, and the first original file format can be used as the first file format of the to-be-processed video, and the second original The file format is used as the second file format of the video to be processed, and the video file to be processed is parsed in the terminal.
步骤408,接收服务器发送的根据格式转换请求对原始视频文件进行格式转换得到的待处理视频文件,以及待处理视频文件对应的第一文件格式和第二文件格式。Step 408: Receive the to-be-processed video file obtained by format conversion of the original video file according to the format conversion request sent by the server, and the first file format and the second file format corresponding to the to-be-processed video file.
在本申请提供的实施例中,服务器将原始视频文件转换成待处理视频文件之后,可以对待处理视频文件进行初步解析,得到待处理视频文件对应的第一文件格式和第二文件格式。然后服务器再将得到的待处理视频文件及对应的第一文件格式和第二文件格式发送给终端。In the embodiment provided by the present application, after the server converts the original video file into a to-be-processed video file, it may perform a preliminary analysis on the to-be-processed video file to obtain a first file format and a second file format corresponding to the to-be-processed video file. Then the server sends the obtained video file to be processed and the corresponding first file format and second file format to the terminal.
在一个实施例中,如图5所示,对待处理视频文件进行解析处理的步骤具体可以包括:In one embodiment, as shown in FIG. 5, the steps of parsing the video file to be processed may specifically include:
步骤502,按照第一排列排序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。Step 502: Acquire the first target resolution identifier from the set of resolution identifiers according to the first order, and perform the first parsing process on the video file to be processed through the parser corresponding to the first target resolution identifier.
具体的,在对待处理视频文件进行第一解析处理的过程中,可以按照第一排列排序依次从解析标识集合中获取第一目标解析标识,并根据获取的第一目标解析标识所对应的解析器对待处理视频文件第一解析处理,直至首次完成第一解析处理得到音视频流为止停止执行。Specifically, in the process of performing the first parsing process on the video file to be processed, the first target parsing identifier may be obtained from the parsing identifier set in sequence according to the first order, and the parser corresponding to the obtained first target parsing identifier may be obtained The first parsing process of the video file to be processed is stopped until the first parsing process is completed for the first time to obtain the audio and video stream.
如果在第一解析处理过程中报错,则可以统计待处理视频文件在第一解析处理中报错的次数。如果报错次数比较少,则可以继续按照解析标识集合中解析标识的排序获取下一个第一目标解析标识,并根据下一个第一目标解析标识对待处理视频文件进行第一解析处理。如果报错次数比较少,则可以根据报错数据获取第二目标解析标识,并根据第二目标解析标识对应待处理视频文件进行第二解析处理。If an error is reported during the first parsing process, the number of errors reported by the video file to be processed in the first parsing process may be counted. If the number of error reports is relatively small, you can continue to obtain the next first target resolution identifier according to the order of the resolution identifiers in the resolution identifier set, and perform the first resolution process on the video file to be processed according to the next first target resolution identifier. If the number of error reports is relatively small, the second target resolution identifier can be obtained according to the error report data, and the second resolution process can be performed according to the second target resolution identifier corresponding to the video file to be processed.
步骤504,当第一解析处理报错时,统计在对待处理视频文件进行第一解析处理 中的报错次数。Step 504: When the first parsing process reports an error, count the number of error reports in the first parsing process of the video file to be processed.
具体的,从解析标识集合中依次读取第一目标解析标识,并根据读取的第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。在第一解析处理报错时,可以统计第一解析处理的报错次数。Specifically, the first target resolution identifier is sequentially read from the set of resolution identifiers, and the first parsing process is performed on the video file to be processed according to the parser corresponding to the read first target resolution identifier. When an error is reported in the first parsing process, the number of error reports in the first parsing process can be counted.
例如,解析标识集合中包含顺序排列的标识A、标识B和标识C,首先读取标识A,并根据标识A对应的解析器进行第一解析处理。若标识A对应的解析器进行第一解析处理时,得到了待处理视频文件中的音视频流,那么停止执行。如果根据标识A对应的解析器进行第一解析处理报错时,统计得到的第一解析处理中的报错次数就为1,则可以继续读取下一个标识B。同样的,如果根据标识B进行第一解析处理成功,则停止执行。如果根据标识B进行第一解析处理报错,那么统计得到的第一解析处理中的报错次数就为2。For example, the set of parsing identifiers includes sequentially arranged identifiers A, B, and C. First, the identifier A is read, and the first parsing process is performed according to the parser corresponding to the identifier A. If the parser corresponding to the identifier A performs the first parsing process and obtains the audio and video streams in the to-be-processed video file, the execution is stopped. If the first parsing process reports an error according to the parser corresponding to the identifier A, the number of error reports in the first parsing process obtained by statistics is 1, and the next identifier B may be continuously read. Similarly, if the first parsing process according to the identifier B is successful, the execution stops. If the first parsing process reports an error according to the identifier B, the number of error reports in the first parsing process obtained by statistics is 2.
步骤506,当报错次数小于或等于次数阈值时,返回执行按照第一排列顺序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理步骤。Step 506: When the number of error reports is less than or equal to the threshold of number of times, return to execute to obtain the first target parsing identifier from the set of parsing identifiers according to the first ranking order, and perform the first processing of the video file to be processed by the parser corresponding to the first target parsing identifier Analytical processing steps.
在报错次数小于或等于次数阈值时,可以继续按照第一排列顺序依次从解析标识集合中读取下一个第一目标解析标识,并根据读取的第一目标解析标识对待处理视频文件进行第一解析处理。When the number of error reports is less than or equal to the threshold number of times, you can continue to read the next first target parsing identifier from the set of parsing identifiers in sequence according to the first sort order, and perform the first process on the video file to be processed according to the read first target parsing identifier Resolution processing.
步骤508,当报错次数大于次数阈值时,获取第一解析处理过程中得到的第一报错数据。Step 508: When the number of error reports is greater than the threshold number of times, obtain first error report data obtained during the first parsing process.
当报错次数大于次数阈值时,可以第一解析处理过程中得到的第一报错数据,然后根据第一报错数据从解析标识集合中精准地选择可解析的第二目标解析标识。其中,该第一报错数据可以是最后一次进行第一解析处理时得到的报错数据,也可以是任意一次进行第一解析处理时得到的报错数据,在此不做限定。When the number of error reports is greater than the threshold number of times, the first error report data obtained during the first analysis process can be used, and then the second target analysis tag that can be parsed can be accurately selected from the set of analysis tags according to the first error report data. The first error report data may be error report data obtained when the first analysis process is performed for the last time, or may be error report data obtained when the first analysis process is performed for any one time, which is not limited herein.
在本申请提供的实施例中,如图6所示,对音视频里进行解码处理的步骤具体包括:In the embodiment provided by the present application, as shown in FIG. 6, the steps of decoding the audio and video specifically include:
步骤602,获取音频流格式对应的音频解码标识集合,并获取视频流格式对应的视频解码标识集合。Step 602: Acquire an audio decoding identifier set corresponding to an audio stream format, and acquire a video decoding identifier set corresponding to a video stream format.
在一个实施例中,解析得到的音视频流包括音频流和视频流,第二文件格式包括音频流对应的音频流格式和视频流对应的视频流格式,解码标识集合包括音频解码标识集合和视频解码标识集合。在对音视频流进行解码的过程中,可以分别对音频流和视频流进行解码。In one embodiment, the parsed audio and video streams include audio streams and video streams, the second file format includes the audio stream format corresponding to the audio stream and the video stream format corresponding to the video stream, and the decoding identification set includes the audio decoding identification set and video Decode identification set. In the process of decoding the audio and video streams, the audio and video streams can be decoded separately.
步骤604,从音频解码标识集合中获取音频解码性能最强的目标音频解码标识,并通过目标音频解码标识对应的音频解码器对音频流进行解码处理,得到解码后的音频流。Step 604: Acquire the target audio decoding identifier with the strongest audio decoding performance from the set of audio decoding identifiers, and perform decoding processing on the audio stream through the audio decoder corresponding to the target audio decoding identifier to obtain the decoded audio stream.
具体的,根据音频流格式对应的音频解码标识集合,并获取视频流格式对应的视频解码标识集合。音频解码标识集合中包含顺序排列的至少一个音频解码标识,视频解码标识集合中包含顺序排列的至少一个视频解码标识。Specifically, according to the audio decoding identifier set corresponding to the audio stream format, the video decoding identifier set corresponding to the video stream format is obtained. The set of audio decoding identifiers includes at least one audio decoding identifier arranged in sequence, and the set of video decoding identifiers includes at least one video decoding identifier arranged in sequence.
获取到音频流格式对应的音频解码标识集合之后,可以从音频解码标识集合中获取音频解码性能最强的目标音频解码标识。音频解码性能表示音频解码标识对应的解码器的性能,根据获取的音频解码性能最强的目标音频解码标识对音频流进行解码处理。具体的,从音频解码标识集合中获取目标音频解码标识的方式不做限定。例如,音频解码标识集合中的音频解码标识可以按照音频解码性能的强弱进行排序,然后根据排序可以获取音频解码标识集合中音频解码性能最强的目标音频解码标识。After the audio decoding identifier set corresponding to the audio stream format is obtained, the target audio decoding identifier with the strongest audio decoding performance can be obtained from the audio decoding identifier set. The audio decoding performance represents the performance of the decoder corresponding to the audio decoding identifier, and the audio stream is decoded according to the obtained target audio decoding identifier with the strongest audio decoding performance. Specifically, the method for obtaining the target audio decoding identifier from the audio decoding identifier set is not limited. For example, the audio decoding identifiers in the audio decoding identifier set may be sorted according to the strength of the audio decoding performance, and then the target audio decoding identifier with the strongest audio decoding performance in the audio decoding identifier set may be obtained according to the ranking.
步骤606,从视频解码标识集合中获取视频解码性能最强的目标视频解码标识,并通过目标视频解码标识对应的视频解码器对视频流进行解码处理,得到解码后的视 频流。Step 606: Obtain the target video decoding identifier with the strongest video decoding performance from the video decoding identifier set, and perform decoding processing on the video stream through the video decoder corresponding to the target video decoding identifier to obtain the decoded video stream.
同样的,根据视频流格式对应的视频解码标识集合,并获取视频流格式对应的视频解码标识集合。视频解码标识集合中包含顺序排列的至少一个视频解码标识,视频解码标识集合中包含顺序排列的至少一个视频解码标识。Similarly, according to the video decoding identifier set corresponding to the video stream format, the video decoding identifier set corresponding to the video stream format is obtained. The set of video decoding identifiers includes at least one video decoding identifier arranged in sequence, and the set of video decoding identifiers includes at least one video decoding identifier arranged in sequence.
获取到视频流格式对应的视频解码标识集合之后,可以从视频解码标识集合中获取视频解码性能最强的目标视频解码标识。视频解码性能表示视频解码标识对应的解码器的性能,根据获取的视频解码性能最强的目标视频解码标识对视频流进行解码处理。具体的,从视频解码标识集合中获取目标视频解码标识的方式不做限定。例如,视频解码标识集合中的视频解码标识可以按照视频解码性能的强弱进行排序,然后根据排序可以获取视频解码标识集合中视频解码性能最强的目标视频解码标识。After the video decoding identifier set corresponding to the video stream format is obtained, the target video decoding identifier with the strongest video decoding performance can be obtained from the video decoding identifier set. The video decoding performance indicates the performance of the decoder corresponding to the video decoding identifier, and the video stream is decoded according to the obtained target video decoding identifier with the strongest video decoding performance. Specifically, the method for obtaining the target video decoding identifier from the video decoding identifier set is not limited. For example, the video decoding identifiers in the video decoding identifier set may be sorted according to the strength of the video decoding performance, and then the target video decoding identifier with the strongest video decoding performance in the video decoding identifier set may be obtained according to the ranking.
应该理解的是,虽然图1、2、4、5、6流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1、2、4、5、6中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts of FIGS. 1, 2, 4, 5, and 6 are displayed in order according to the arrows, the steps are not necessarily executed in the order indicated by the arrows. Unless clearly stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least some of the steps in FIGS. 1, 2, 4, 5, and 6 may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with at least a part of other steps or sub-steps or stages of other steps.
在本申请提供的实施例中,上述视频解码方法具体还可以包括:In the embodiment provided by the present application, the above video decoding method may further specifically include:
(1)向服务器发送文件获取请求。(1) Send a file acquisition request to the server.
(2)接收服务器根据文件获取请求返回的原始视频文件,以及原始视频文件对应的第一原始文件格式和第二原始文件格式。(2) The original video file returned by the receiving server according to the file acquisition request, and the first original file format and the second original file format corresponding to the original video file.
(3)当存在第一原始文件格式对应的解析标识集合时,将原始视频文件作为待处理视频文件,并将第一原始文件格式作为待处理视频的第一文件格式,将第二原始文件格式作为待处理视频的第二文件格式。(3) When there is a set of parsing identifiers corresponding to the first original file format, the original video file is used as the video file to be processed, the first original file format is used as the first file format of the video to be processed, and the second original file format As the second file format of the video to be processed.
(4)当不存在第一原始文件格式对应的解析标识集合时,向服务器发送格式转换请求。(4) When there is no set of resolution identifiers corresponding to the first original file format, send a format conversion request to the server.
(5)接收服务器发送的根据格式转换请求对原始视频文件进行格式转换得到的待处理视频文件,以及待处理视频文件对应的第一文件格式和第二文件格式,其中,第二文件格式包括音频流格式和视频流格式。(5) Receive the video file to be processed which is obtained by format conversion of the original video file according to the format conversion request sent by the server, and the first file format and the second file format corresponding to the video file to be processed, wherein the second file format includes audio Streaming format and video streaming format.
(6)获取第一文件格式对应的解析标识集合。(6) Acquire the set of resolution identifiers corresponding to the first file format.
(7)根据所述第二文件格式获取解析标识集合中包含的解析标识的第一排列顺序,按照第一排列顺序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理。(7) According to the second file format, obtain the first arrangement order of the analysis marks contained in the analysis mark set, obtain the first target analysis mark from the analysis mark set according to the first arrangement order, and correspond to the first target analysis mark The parser performs the first parsing process on the video file to be processed.
(8)当第一解析处理报错时,统计在对待处理视频文件进行第一解析处理中的报错次数。(8) When the first parsing process reports an error, count the number of errors reported in the first parsing process of the video file to be processed.
(9)当报错次数小于或等于次数阈值时,返回执行按照排序依次从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理步骤。(9) When the number of error reports is less than or equal to the threshold number of times, return to execute and obtain the first target resolution identifier from the set of resolution identifiers in order, and perform the first parsing process on the video file to be processed through the parser corresponding to the first target resolution identifier step.
(10)当报错次数大于次数阈值时,获取第一解析处理过程中得到的第一报错数据,根据第一报错数据从解析标识集合中获取第二目标解析标识。(10) When the number of error reports is greater than the threshold number of times, acquire the first error report data obtained during the first analysis process, and obtain the second target analysis identifier from the analysis identifier set according to the first error report data.
(11)通过第二目标解析标识对应的解析器对待处理视频文件进行第二解析处理,得到音视频流。(11) Perform a second parsing process on the video file to be processed by a parser corresponding to the second target parsing identifier to obtain an audio and video stream.
(12)获取音频流格式对应的音频解码标识集合。(12) Acquire the audio decoding identifier set corresponding to the audio stream format.
(13)获取音频解码标识集合中包含的音频解码标识的第二音频排列顺序,按照 第二音频排列顺序从音频解码标识集合中获取第一目标音频解码标识,并通过第一目标音频解码标识对应的解码器对音频流进行第一音频解码处理。(13) Acquire the second audio arrangement order of the audio decoding identifiers included in the audio decoding identifier set, obtain the first target audio decoding identifier from the audio decoding identifier set according to the second audio arrangement order, and correspond to the first target audio decoding identifier Of the decoder performs the first audio decoding process on the audio stream.
(14)当第一音频解码处理报错时,获取第一音频解码处理过程中得到的第二音频报错数据,并根据第二音频报错数据从音频解码标识集合中获取第二目标音频解码标识。(14) When the first audio decoding process reports an error, obtain the second audio error reporting data obtained during the first audio decoding process, and obtain the second target audio decoding identification from the audio decoding identification set according to the second audio error reporting data.
(15)通过第二目标音频解码标识对应的解码器对音频流进行第二音频解码处理,得到解码后的音频流。(15) Perform a second audio decoding process on the audio stream by the decoder corresponding to the second target audio decoding identifier to obtain the decoded audio stream.
(16)获取视频解码标识集合中包含的视频解码标识的第二视频排列顺序,按照第二视频排列顺序从视频解码标识集合中获取第一目标视频解码标识,并通过第一目标视频解码标识对应的解码器对视频流进行第一视频解码处理。(16) Obtain the second video arrangement order of the video decoding identifiers contained in the video decoding identifier set, obtain the first target video decoding identifier from the video decoding identifier set according to the second video arrangement order, and correspond to the first target video decoding identifier Of the decoder performs the first video decoding process on the video stream.
(17)当第一视频解码处理报错时,获取第一视频解码处理过程中得到的第二视频报错数据,并根据第二视频报错数据从视频解码标识集合中获取第二目标视频解码标识。(17) When the first video decoding process reports an error, obtain second video error reporting data obtained during the first video decoding process, and obtain the second target video decoding identification from the video decoding identification set according to the second video error reporting data.
(18)通过第二目标视频解码标识对应的解码器对视频流进行第二视频解码处理,得到解码后的视频流。(18) Perform a second video decoding process on the video stream by the decoder corresponding to the second target video decoding identifier to obtain the decoded video stream.
上述实施例提供的视频解码方法,可以根据待处理视频文件的格式精准地选择解析器和解码器,提高了视频文件的解码效率。同时,在对待处理视频文件进行解析或解码过程报错时,可以根据报错数据定位报错的原因,然后根据报错的原因选择对应的解析器或解码器,从而进一步地提高了视频文件的解码效率。The video decoding method provided in the above embodiment can accurately select the parser and decoder according to the format of the video file to be processed, thereby improving the decoding efficiency of the video file. At the same time, when an error is reported during the parsing or decoding of the video file to be processed, the cause of the error can be located according to the error data, and then the corresponding parser or decoder can be selected according to the cause of the error, thereby further improving the decoding efficiency of the video file.
图7为一个实施例中视频解码装置的结构示意图。如图7所示,该视频解码装置700包括文件获取模块702、解析集合获取模块704、解析处理模块706、解码集合模块708和解码处理模块710。其中:7 is a schematic structural diagram of a video decoding device in an embodiment. As shown in FIG. 7, the video decoding apparatus 700 includes a file acquisition module 702, an analysis set acquisition module 704, an analysis processing module 706, a decoding set module 708, and a decoding processing module 710. among them:
文件获取模块702,用于获取待处理视频文件,并获取待处理视频文件对应的第一文件格式和第二文件格式,第一文件格式用于表示待处理视频文件的格式,第二文件格式用于表示待处理视频文件中的音视频流的格式。The file obtaining module 702 is used to obtain a to-be-processed video file and obtain a first file format and a second file format corresponding to the to-be-processed video file. The first file format is used to represent the format of the to-be-processed video file, and the second file format is used Is used to indicate the format of audio and video streams in the video file to be processed.
解析集合获取模块704,用于获取第一文件格式对应的解析标识集合。The parsing set obtaining module 704 is used to obtain a parsing identification set corresponding to the first file format.
解析处理模块706,用于从解析标识集合中获取解析性能最强的目标解析标识,并通过目标解析标识对应的解析器对待处理视频文件进行解析处理,得到音视频流,其中,解析性能用于表示解析标识对应的解析器的性能;The parsing and processing module 706 is used to obtain the target parsing identifier with the strongest parsing performance from the parsing identifier set, and parsing the video file to be processed through the parser corresponding to the target parsing identifier to obtain an audio and video stream. Represents the performance of the parser corresponding to the parsing identifier;
解码集合获取模块708,用于获取第二文件格式对应的解码标识集合。The decoding set obtaining module 708 is used to obtain a decoding identification set corresponding to the second file format.
解码处理模块710,用于从解码标识集合中获取解码性能最强的目标解码标识,并通过目标解码标识对应的解码器对音视频流进行解码处理,得到解码后的音视频流,其中,解码性能用于表示解码标识对应的解码器的性能。The decoding processing module 710 is used to obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream through the decoder corresponding to the target decoding identifier to obtain the decoded audio and video stream, wherein, decoding Performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
上述实施例提供的视频解码装置,在获取到待处理视频文件及对应的第一文件格式和第二文件格式之后,可以根据第一文件格式获取对应的解析标识集合,并从解析标识集合中获取目标解析标识,通过目标解析标识对应的解析器对待处理视频文件进行解析处理,得到音视频流。然后根据第二文件格式获取对应的解码标识集合,并从解码标识集合中获取目标解码标识。最后通过目标解码标识对应的解码器对音视频流进行解码处理,得到解码后的音视频流。这样可以根据待处理视频文件的格式精准地选择解析器和解码器,提高了视频文件的解码效率。After obtaining the to-be-processed video file and the corresponding first file format and second file format, the video decoding device provided in the above embodiment may obtain the corresponding resolution identification set according to the first file format and obtain from the resolution identification set The target parsing mark, through the parser corresponding to the target parsing mark, analyzes the video file to be processed to obtain an audio and video stream. Then, the corresponding decoding identifier set is obtained according to the second file format, and the target decoding identifier is obtained from the decoding identifier set. Finally, the decoder corresponding to the target decoding identifier decodes the audio and video stream to obtain the decoded audio and video stream. In this way, the parser and decoder can be accurately selected according to the format of the video file to be processed, and the decoding efficiency of the video file is improved.
在一个实施例中,上述文件获取模块702还用于向服务器发送文件获取请求;接收服务器根据文件获取请求返回的待处理视频文件,以及待处理视频文件对应的第一文件格式和第二文件格式。In one embodiment, the above-mentioned file obtaining module 702 is further configured to send a file obtaining request to the server; receiving the video file to be processed returned by the server according to the file obtaining request, and the first file format and the second file format corresponding to the video file to be processed .
在一个实施例中,上述文件获取模块702还用于接收服务器根据文件获取请求返 回的原始视频文件,以及原始视频文件对应的第一原始文件格式和第二原始文件格式;当存在第一原始文件格式对应的解析标识集合时,将原始视频文件作为待处理视频文件,并将第一原始文件格式作为待处理视频的第一文件格式,将第二原始文件格式作为待处理视频的第二文件格式;当不存在第一原始文件格式对应的解析标识集合时,向服务器发送格式转换请求;接收服务器发送的根据格式转换请求对原始视频文件进行格式转换得到的待处理视频文件,以及待处理视频文件对应的第一文件格式和第二文件格式。In one embodiment, the above file obtaining module 702 is further used to receive the original video file returned by the server according to the file obtaining request, and the first original file format and the second original file format corresponding to the original video file; when the first original file exists When parsing the identification set corresponding to the format, the original video file is used as the video file to be processed, the first original file format is used as the first file format of the video to be processed, and the second original file format is used as the second file format of the video to be processed ; When there is no set of parsing identifiers corresponding to the first original file format, send a format conversion request to the server; receive the to-be-processed video file and the to-be-processed video file obtained by format conversion of the original video file according to the format conversion request sent by the server Corresponding first file format and second file format.
在一个实施例中,解析标识集合中包含按照解析性能排序的至少一个解析标识,上述解析处理模块706还用于根据第二文件格式获取解析标识集合中包含的解析标识的第一排列顺序,按照第一排列顺序从解析标识集合中获取目标解析标识。In one embodiment, the resolution identification set includes at least one resolution identification sorted according to resolution performance. The above-mentioned resolution processing module 706 is further used to obtain the first arrangement order of the resolution identifications included in the resolution identification set according to the second file format, according to The first sorting order obtains the target resolution identifier from the resolution identifier set.
在一个实施例中,解析处理模块706还用于按照第一排列排序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理;当第一解析处理报错时,获取第一解析处理过程中得到的第一报错数据,根据第一报错数据从解析标识集合中获取第二目标解析标识;通过第二目标解析标识对应的解析器对待处理视频文件进行第二解析处理,得到音视频流。In one embodiment, the parsing processing module 706 is further configured to obtain the first target parsing identifier from the set of parsing identifiers according to the first sort order, and perform the first parsing processing on the video file to be processed through the parser corresponding to the first target parsing identifier ; When the first parsing process reports an error, obtain the first error reporting data obtained during the first parsing process, and obtain the second target parsing identification from the parsing identification set according to the first error reporting data; through the parser corresponding to the second target parsing identification Perform a second parsing process on the video file to be processed to obtain an audio and video stream.
在一个实施例中,解析处理模块706还用于当第一解析处理报错时,统计在对待处理视频文件进行第一解析处理中的报错次数;当报错次数小于或等于次数阈值时,返回执行按照第一排列排序从解析标识集合中获取第一目标解析标识,并通过第一目标解析标识对应的解析器对待处理视频文件进行第一解析处理步骤;当报错次数大于次数阈值时,获取第一解析处理过程中得到的第一报错数据。In one embodiment, the parsing processing module 706 is further configured to count the number of errors reported during the first parsing process of the video file to be processed when the first parsing process reports an error; when the number of reported errors is less than or equal to the threshold number of times, return to execute The first sorting sequence obtains the first target resolution identifier from the set of resolution identifiers, and performs the first resolution processing step on the video file to be processed through the parser corresponding to the first target resolution identifier; when the number of error reports is greater than the threshold value, the first resolution is obtained The first error data obtained during processing.
在一个实施例中,解码标识集合中包含按照解码性能排序的至少一个解码标识,上述解码处理模块710还用于获取解码标识集合中包含的解码标识的第二排列顺序,按照第二排列顺序从解码标识集合中获取目标解码标识。In an embodiment, the set of decoding identifiers includes at least one decoding identifier sorted according to decoding performance, and the above-mentioned decoding processing module 710 is further used to obtain a second arrangement order of the decoding identifiers included in the set of decoding identifiers, from Obtain the target decoding identifier from the decoding identifier set.
在一个实施例中,上述解码处理模块710还用于按照第二排列顺序从解码标识集合中获取第一目标解码标识,并通过第一目标解码标识对应的解码器对音视频流进行第一解码处理;当第一解码处理报错时,获取第一解码处理过程中得到的第二报错数据,并根据第二报错数据从解码标识集合中获取第二目标解码标识;通过第二目标解码标识对应的解码器对音视频流进行第二解码处理,得到解码后的音视频流。In one embodiment, the above-mentioned decoding processing module 710 is further configured to obtain the first target decoding identifier from the set of decoding identifiers according to the second arrangement order, and perform the first decoding of the audio and video stream by the decoder corresponding to the first target decoding identifier Processing; when the first decoding process reports an error, obtain the second error reporting data obtained during the first decoding process, and obtain the second target decoding identifier from the decoding identification set according to the second error reporting data; The decoder performs a second decoding process on the audio and video stream to obtain the decoded audio and video stream.
在一个实施例中,音视频流包括音频流和视频流,第二文件格式包括音频流格式和视频流格式;上述解码处理模块710还用于获取音频流格式对应的音频解码标识集合,并获取视频流格式对应的视频解码标识集合;从音频解码标识集合中获取音频解码性能最强的目标音频解码标识,并通过目标音频解码标识对应的音频解码器对音频流进行解码处理,得到解码后的音频流;及从视频解码标识集合中获取视频解码性能最强的目标视频解码标识,并通过目标视频解码标识对应的视频解码器对视频流进行解码处理,得到解码后的视频流。In one embodiment, the audio and video stream includes an audio stream and a video stream, and the second file format includes an audio stream format and a video stream format; the above-mentioned decoding processing module 710 is further used to obtain an audio decoding identifier set corresponding to the audio stream format and obtain The video decoding identifier set corresponding to the video stream format; obtain the target audio decoding identifier with the strongest audio decoding performance from the audio decoding identifier set, and perform decoding processing on the audio stream through the audio decoder corresponding to the target audio decoding identifier to obtain the decoded Audio stream; and obtain the target video decoding identifier with the strongest video decoding performance from the video decoding identifier set, and decode the video stream through the video decoder corresponding to the target video decoding identifier to obtain the decoded video stream.
上述视频解码装置中各个模块的划分仅用于举例说明,在其他实施例中,可将视频解码装置按照需要划分为不同的模块,以完成上述视频解码装置的全部或部分功能。The division of each module in the above video decoding device is for illustration only. In other embodiments, the video decoding device may be divided into different modules as needed to complete all or part of the functions of the above video decoding device.
关于视频解码装置的具体限定可以参见上文中对于视频解码方法的限定,在此不再赘述。上述视频解码装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For specific definitions of the video decoding device, reference may be made to the above definition of the video decoding method, and details are not described herein again. Each module in the above video decoding device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in the hardware or independent of the processor in the computer device, or may be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
本申请实施例还提供了一种电子设备。如图8所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该电子设 备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以电子设备为手机为例:An embodiment of the present application also provides an electronic device. As shown in FIG. 8, for ease of description, only parts related to the embodiments of the present application are shown, and specific technical details are not disclosed, please refer to the method part of the embodiments of the present application. The electronic device may be any terminal device including a mobile phone, tablet computer, PDA (Personal Digital Assistant), POS (Point of Sales), in-vehicle computer, wearable device, etc. Taking the electronic device as a mobile phone for example :
图8为与本申请实施例提供的电子设备相关的手机的部分结构的框图。参考图8,手机包括:射频(Radio Frequency,RF)电路810、存储器820、输入单元830、显示单元840、传感器850、音频电路860、无线保真(wireless fidelity,WiFi)模块870、处理器880、以及电源890等部件。本领域技术人员可以理解,图8所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。8 is a block diagram of a partial structure of a mobile phone related to an electronic device provided by an embodiment of the present application. 8, the mobile phone includes: a radio frequency (Radio Frequency) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, and a processor 880 , And power supply 890 and other components. Those skilled in the art may understand that the structure of the mobile phone shown in FIG. 8 does not constitute a limitation on the mobile phone, and may include more or fewer components than those shown in the figure, or a combination of certain components, or a different component arrangement.
其中,RF电路810可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器880处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路810还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。Among them, the RF circuit 810 can be used to receive and send signals during the sending and receiving of information or during a call. It can receive the downlink information of the base station and process it to the processor 880; it can also send the uplink data to the base station. Generally, RF circuits include but are not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (Low Noise Amplifier, LNA), duplexer, and so on. In addition, the RF circuit 810 can also communicate with other devices through a wireless communication network. The above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile (GSM), General Packet Radio Service (GPRS), and Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Message Service (SMS), etc.
存储器820可用于存储软件程序以及模块,处理器880通过运行存储在存储器820的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器820可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器820可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 820 may be used to store software programs and modules. The processor 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820. The memory 820 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system and at least one function-required application program (such as a sound playback function application program, an image playback function application program, etc.), etc.; The data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
输入单元830可用于接收输入的数字或字符信息,以及产生与手机800的用户设置以及功能控制有关的键信号输入。具体地,输入单元830可包括触控面板831以及其他输入设备832。触控面板831,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板831上或在触控面板831附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板831可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器880,并能接收处理器880发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板831。除了触控面板831,输入单元830还可以包括其他输入设备832。具体地,其他输入设备832可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 830 may be used to receive input numeric or character information, and generate key signal input related to user settings and function control of the mobile phone 800. Specifically, the input unit 830 may include a touch panel 831 and other input devices 832. The touch panel 831, also known as a touch screen, can collect user's touch operations on or near it (such as the user using any finger, stylus, or any other suitable object or accessory on or near the touch panel 831 Operation), and drive the corresponding connection device according to the preset program. In one embodiment, the touch panel 831 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into contact coordinates To the processor 880, and can receive the command sent by the processor 880 and execute it. In addition, the touch panel 831 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 831, the input unit 830 may also include other input devices 832. Specifically, other input devices 832 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), and the like.
显示单元840可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元840可包括显示面板841。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板841。在一个实施例中,触控面板831可覆盖显示面板841,当触控面板831检测到在其上或附近的触摸操作后,传送给处理器880以确定触摸事件的类型,随后处理器880根据触摸事件的类型在显示面板841上提供相应的视觉输出。虽然在图8中,触控面板831与显示面板841是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板831与显示面板841集成而实现手机的输入和输出 功能。The display unit 840 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 840 may include a display panel 841. In one embodiment, the display panel 841 may be configured in the form of a liquid crystal display (Liquid Crystal) (LCD), an organic light emitting diode (Organic Light-Emitting Diode, OLED), or the like. In one embodiment, the touch panel 831 may cover the display panel 841, and when the touch panel 831 detects a touch operation on or near it, it is transmitted to the processor 880 to determine the type of touch event, and then the processor 880 according to The type of touch event provides a corresponding visual output on the display panel 841. Although in FIG. 8, the touch panel 831 and the display panel 841 are implemented as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 831 and the display panel 841 may be integrated and Realize the input and output functions of the mobile phone.
手机800还可包括至少一种传感器850,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板841的亮度,接近传感器可在手机移动到耳边时,关闭显示面板841和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The mobile phone 800 may further include at least one sensor 850, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 841 according to the brightness of the ambient light, and the proximity sensor may close the display panel 841 and/or when the mobile phone moves to the ear Or backlight. The motion sensor may include an acceleration sensor. The acceleration sensor can detect the magnitude of acceleration in various directions, and can detect the magnitude and direction of gravity when at rest. Pedometer, percussion), etc. In addition, the mobile phone can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor and so on.
音频电路860、扬声器861和传声器862可提供用户与手机之间的音频接口。音频电路860可将接收到的音频数据转换后的电信号,传输到扬声器861,由扬声器861转换为声音信号输出;另一方面,传声器862将收集的声音信号转换为电信号,由音频电路860接收后转换为音频数据,再将音频数据输出处理器880处理后,经RF电路810可以发送给另一手机,或者将音频数据输出至存储器820以便后续处理。The audio circuit 860, the speaker 861, and the microphone 862 may provide an audio interface between the user and the mobile phone. The audio circuit 860 can transmit the converted electrical signal of the received audio data to the speaker 861, and the speaker 861 converts it into a sound signal output; on the other hand, the microphone 862 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 860 After receiving, it is converted into audio data, and then processed by the audio data output processor 880, and then sent to another mobile phone via the RF circuit 810, or the audio data is output to the memory 820 for subsequent processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块870可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图8示出了WiFi模块870,但是可以理解的是,其并不属于手机800的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive e-mails, browse web pages, and access streaming media through the WiFi module 870. It provides users with wireless broadband Internet access. Although FIG. 8 shows the WiFi module 870, it can be understood that it is not a necessary component of the mobile phone 800, and may be omitted as needed.
处理器880是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器820内的软件程序和/或模块,以及调用存储在存储器820内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器880可包括一个或多个处理单元。在一个实施例中,处理器880可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器880中。The processor 880 is the control center of the mobile phone, connects various parts of the entire mobile phone with various interfaces and lines, executes or executes the software programs and/or modules stored in the memory 820, and calls the data stored in the memory 820 to execute Various functions and processing data of the mobile phone, so as to monitor the mobile phone as a whole. In one embodiment, the processor 880 may include one or more processing units. In one embodiment, the processor 880 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, user interface, application programs, and the like; the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 880.
手机800还包括给各个部件供电的电源890(比如电池),优选的,电源可以通过电源管理系统与处理器880逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 800 further includes a power supply 890 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 880 through a power management system, so as to realize functions such as charging, discharging, and power management through the power management system.
在一个实施例中,手机800还可以包括摄像头、蓝牙模块等。In one embodiment, the mobile phone 800 may further include a camera, a Bluetooth module, and the like.
在本申请实施例中,该电子设备所包括的处理器880执行存储在存储器上的计算机程序时实现上述实施例提供的视频解码方法的步骤。In the embodiment of the present application, when the processor 880 included in the electronic device executes the computer program stored in the memory, the steps of the video decoding method provided in the foregoing embodiment are implemented.
本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行上述实施例提供的视频解码方法的步骤。The embodiments of the present application also provide a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, causing the processors to execute the video decoding method provided by the foregoing embodiments step.
一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例提供的视频解码方法。A computer program product containing instructions, when it runs on a computer, causes the computer to execute the video decoding method provided by the above embodiment.
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any references to memory, storage, databases, or other media used in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR) SDRAM, enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能 因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation manners of the present application, and their descriptions are more specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which all fall within the protection scope of the present application. Therefore, the protection scope of the patent of this application shall be subject to the appended claims.

Claims (12)

  1. 一种视频解码方法,包括:A video decoding method, including:
    获取待处理视频文件,并获取所述待处理视频文件对应的第一文件格式和第二文件格式,所述第一文件格式用于表示所述待处理视频文件的格式,所述第二文件格式用于表示所述待处理视频文件中的音视频流的格式;Acquiring a to-be-processed video file, and acquiring a first file format and a second file format corresponding to the to-be-processed video file, the first file format is used to represent the format of the to-be-processed video file, and the second file format It is used to indicate the format of the audio and video stream in the to-be-processed video file;
    获取所述第一文件格式对应的解析标识集合;Obtaining a set of resolution identifiers corresponding to the first file format;
    从所述解析标识集合中获取解析性能最强的目标解析标识,并通过所述目标解析标识对应的解析器对所述待处理视频文件进行解析处理,得到音视频流,其中,所述解析性能用于表示解析标识对应的解析器的性能;Obtaining the target resolution identifier with the strongest resolution performance from the set of resolution identifiers, and parsing the to-be-processed video file through a parser corresponding to the target resolution identifier to obtain an audio and video stream, wherein the resolution performance Used to indicate the performance of the parser corresponding to the parsing identifier;
    获取所述第二文件格式对应的解码标识集合;及Obtaining a set of decoding identifiers corresponding to the second file format; and
    从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,其中,所述解码性能用于表示解码标识对应的解码器的性能。Obtain the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain a decoded audio and video stream, wherein, the The decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
  2. 根据权利要求1所述的方法,其特征在于,所述获取待处理视频文件,并获取所述待处理视频文件对应的第一文件格式和第二文件格式,包括:The method according to claim 1, wherein the acquiring the to-be-processed video file and acquiring the first and second file formats corresponding to the to-be-processed video file include:
    向服务器发送文件获取请求;Send a file acquisition request to the server;
    接收所述服务器根据所述文件获取请求返回的待处理视频文件,以及所述待处理视频文件对应的第一文件格式和第二文件格式。Receiving the to-be-processed video file returned by the server according to the file acquisition request, and the first and second file formats corresponding to the to-be-processed video file.
  3. 根据权利要求2所述的方法,其特征在于,所述接收所述服务器根据所述文件获取请求返回的待处理视频文件,以及所述待处理视频文件对应的第一文件格式和第二文件格式,包括:The method according to claim 2, wherein the receiving is to process the video file returned by the server according to the file acquisition request, and the first file format and the second file format corresponding to the video file to be processed ,include:
    接收所述服务器根据所述文件获取请求返回的原始视频文件,以及所述原始视频文件对应的第一原始文件格式和第二原始文件格式;Receiving the original video file returned by the server according to the file acquisition request, and the first original file format and the second original file format corresponding to the original video file;
    当存在所述第一原始文件格式对应的解析标识集合时,将所述原始视频文件作为待处理视频文件,并将所述第一原始文件格式作为所述待处理视频的第一文件格式,将所述第二原始文件格式作为所述待处理视频的第二文件格式;When there is a set of parsing identifiers corresponding to the first original file format, use the original video file as the to-be-processed video file, and use the first original file format as the first file format of the to-be-processed video, The second original file format is used as the second file format of the video to be processed;
    当不存在所述第一原始文件格式对应的解析标识集合时,向所述服务器发送格式转换请求;When there is no set of resolution identifiers corresponding to the first original file format, send a format conversion request to the server;
    接收所述服务器发送的根据所述格式转换请求对所述原始视频文件进行格式转换得到的待处理视频文件,以及所述待处理视频文件对应的第一文件格式和第二文件格式。Receiving a to-be-processed video file obtained by format conversion of the original video file according to the format conversion request sent by the server, and a first file format and a second file format corresponding to the to-be-processed video file.
  4. 根据权利要求1所述的方法,其特征在于,所述解析标识集合中包含按照解析性能排序的至少一个解析标识,所述从所述解析标识集合中获取解析性能最强的目标解析标识,包括:The method according to claim 1, wherein the set of analysis identifiers includes at least one analysis identifier sorted according to analysis performance, and obtaining the target analysis identifier with the strongest analysis performance from the set of analysis identifiers includes: :
    根据所述第二文件格式获取解析标识集合中包含的解析标识的第一排列顺序,按照所述第一排列顺序从所述解析标识集合中获取目标解析标识。Obtaining a first arrangement order of the analysis identifiers contained in the analysis identifier set according to the second file format, and obtaining a target analysis identifier from the analysis identifier set according to the first arrangement order.
  5. 根据权利要求4所述的方法,其特征在于,所述从所述解析标识集合中获取解析性能最强的目标解析标识,并通过所述目标解析标识对应的解析器对所述待处理视频文件进行解析处理,得到音视频流,包括:The method according to claim 4, wherein the target resolution identifier with the strongest resolution performance is obtained from the set of resolution identifiers, and the to-be-processed video file is processed by a parser corresponding to the target resolution identifier Analyze and get audio and video streams, including:
    按照所述第一排列排序从所述解析标识集合中获取第一目标解析标识,并通过所述第一目标解析标识对应的解析器对所述待处理视频文件进行第一解析处理;Obtaining a first target resolution identifier from the set of resolution identifiers according to the first sorting order, and performing first parsing processing on the to-be-processed video file through a parser corresponding to the first target resolution identifier;
    当所述第一解析处理报错时,获取所述第一解析处理过程中得到的第一报错数据,根据所述第一报错数据从所述解析标识集合中获取第二目标解析标识;When the first parsing process reports an error, obtain first error reporting data obtained during the first parsing process, and obtain a second target parsing identification from the parsing identification set according to the first error reporting data;
    通过所述第二目标解析标识对应的解析器对所述待处理视频文件进行第二解析处理,得到音视频流。Perform a second parsing process on the video file to be processed by a parser corresponding to the second target parsing identifier to obtain an audio and video stream.
  6. 根据权利要求5所述的方法,其特征在于,所述当所述第一解析处理报错时,获取所述第一解析处理过程中得到的第一报错数据,根据所述第一报错数据从所述解析标识集合中获取第二目标解析标识,包括:The method according to claim 5, wherein when the first parsing process reports an error, the first error reporting data obtained during the first parsing process is acquired, and the Obtaining the second target resolution identifier from the resolution identifier set includes:
    当所述第一解析处理报错时,统计在对所述待处理视频文件进行第一解析处理中的报错次数;When the first parsing process reports an error, count the number of error reports during the first parsing process on the video file to be processed;
    当所述报错次数小于或等于次数阈值时,返回执行所述按照所述第一排列排序从所述解析标识集合中获取第一目标解析标识,并通过所述第一目标解析标识对应的解析器对所述待处理视频文件进行第一解析处理步骤;When the number of error reports is less than or equal to the threshold number of times, return to execute the first target resolution identifier from the set of resolution identifiers according to the first sort order, and pass the parser corresponding to the first target resolution identifier Performing a first parsing process step on the to-be-processed video file;
    当所述报错次数大于所述次数阈值时,获取所述第一解析处理过程中得到的第一报错数据。When the number of error reports is greater than the threshold number of times, the first error report data obtained during the first parsing process is acquired.
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述解码标识集合中包含按照解码性能排序的至少一个解码标识,所述从所述解码标识集合中获取解码性能最强的目标解码标识,包括:The method according to any one of claims 1 to 6, wherein the set of decoding identifiers includes at least one decoding identifier sorted according to decoding performance, and the strongest decoding performance is obtained from the set of decoding identifiers The target decoding identifier, including:
    获取解码标识集合中包含的解码标识的第二排列顺序,按照所述第二排列顺序从所述解码标识集合中获取目标解码标识。Acquiring a second arrangement order of decoding identifiers included in the set of decoding identifiers, and obtaining a target decoding identifier from the set of decoding identifiers according to the second arrangement order.
  8. 根据权利要求7所述的方法,其特征在于,所述从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,包括:The method according to claim 7, wherein the target decoding identifier with the strongest decoding performance is obtained from the set of decoding identifiers, and the audio and video stream is processed by a decoder corresponding to the target decoding identifier Decoding process to get the decoded audio and video stream, including:
    按照所述第二排列顺序从所述解码标识集合中获取第一目标解码标识,并通过所述第一目标解码标识对应的解码器对所述音视频流进行第一解码处理;Acquiring a first target decoding identifier from the set of decoding identifiers according to the second arrangement order, and performing a first decoding process on the audio and video stream through a decoder corresponding to the first target decoding identifier;
    当所述第一解码处理报错时,获取所述第一解码处理过程中得到的第二报错数据,并根据所述第二报错数据从所述解码标识集合中获取第二目标解码标识;When the first decoding process reports an error, obtain second error reporting data obtained during the first decoding process, and obtain a second target decoding identifier from the decoding identification set according to the second error reporting data;
    通过所述第二目标解码标识对应的解码器对所述音视频流进行第二解码处理,得到解码后的音视频流。The decoder corresponding to the second target decoding identifier performs a second decoding process on the audio and video stream to obtain a decoded audio and video stream.
  9. 根据权利要求1至6中任一项所述的方法,其特征在于,所述音视频流包括音频流和视频流,所述第二文件格式包括音频流格式和视频流格式;The method according to any one of claims 1 to 6, wherein the audio and video stream includes an audio stream and a video stream, and the second file format includes an audio stream format and a video stream format;
    所述获取所述第二文件格式对应的解码标识集合,包括:The acquiring the set of decoding identifiers corresponding to the second file format includes:
    获取所述音频流格式对应的音频解码标识集合,并获取所述视频流格式对应的视频解码标识集合;Acquiring an audio decoding identifier set corresponding to the audio stream format, and acquiring a video decoding identifier set corresponding to the video stream format;
    所述从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,包括:Obtaining the target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and decoding the audio and video stream through a decoder corresponding to the target decoding identifier to obtain the decoded audio and video stream, including:
    从所述音频解码标识集合中获取音频解码性能最强的目标音频解码标识,并通过所述目标音频解码标识对应的音频解码器对所述音频流进行解码处理,得到解码后的音频流;及Obtaining the target audio decoding identifier with the strongest audio decoding performance from the set of audio decoding identifiers, and decoding the audio stream through an audio decoder corresponding to the target audio decoding identifier to obtain a decoded audio stream; and
    从所述视频解码标识集合中获取视频解码性能最强的目标视频解码标识,并通过所述目标视频解码标识对应的视频解码器对所述视频流进行解码处理,得到解码后的视频流。Obtain the target video decoding identifier with the strongest video decoding performance from the video decoding identifier set, and perform decoding processing on the video stream by a video decoder corresponding to the target video decoding identifier to obtain a decoded video stream.
  10. 一种视频解码装置,包括:A video decoding device, including:
    文件获取模块,用于获取待处理视频文件,并获取所述待处理视频文件对应的第一文件格式和第二文件格式,所述第一文件格式用于表示所述待处理视频文件的格式,所述第二文件格式用于表示所述待处理视频文件中的音视频流的格式;A file obtaining module, configured to obtain a to-be-processed video file, and obtain a first file format and a second file format corresponding to the to-be-processed video file, the first file format is used to represent the format of the to-be-processed video file, The second file format is used to represent the format of the audio and video stream in the video file to be processed;
    解析集合获取模块,用于获取所述第一文件格式对应的解析标识集合;A parsing set acquisition module, used to acquire a parsing identification set corresponding to the first file format;
    解析处理模块,用于从所述解析标识集合中获取解析性能最强的目标解析标识,并通过所述目标解析标识对应的解析器对所述待处理视频文件进行解析处理,得到音 视频流,其中,所述解析性能用于表示解析标识对应的解析器的性能;A parsing processing module, configured to obtain a target parsing identifier with the strongest parsing performance from the parsing identifier set, and parsing the to-be-processed video file through a parser corresponding to the target parsing identifier to obtain an audio and video stream Wherein, the parsing performance is used to indicate the performance of the parser corresponding to the parsing identifier;
    解码集合获取模块,用于获取所述第二文件格式对应的解码标识集合;及A decoding set acquisition module, for acquiring a decoding identification set corresponding to the second file format; and
    解码处理模块,用于从所述解码标识集合中获取解码性能最强的目标解码标识,并通过所述目标解码标识对应的解码器对所述音视频流进行解码处理,得到解码后的音视频流,其中,所述解码性能用于表示解码标识对应的解码器的性能。A decoding processing module, configured to obtain a target decoding identifier with the strongest decoding performance from the set of decoding identifiers, and perform decoding processing on the audio and video stream by a decoder corresponding to the target decoding identifier to obtain decoded audio and video Stream, where the decoding performance is used to indicate the performance of the decoder corresponding to the decoding identifier.
  11. 一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如权利要求1至9中任一项所述的方法的步骤。An electronic device includes a memory and a processor, and a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is executed as described in any one of claims 1 to 9. Steps of the method.
  12. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至9中任一项所述的方法的步骤。A computer-readable storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are realized.
PCT/CN2018/117478 2018-11-26 2018-11-26 Video decoding method and device, electronic apparatus, and computer-readable storage medium WO2020107168A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/117478 WO2020107168A1 (en) 2018-11-26 2018-11-26 Video decoding method and device, electronic apparatus, and computer-readable storage medium
CN201880098443.5A CN112823519B (en) 2018-11-26 2018-11-26 Video decoding method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/117478 WO2020107168A1 (en) 2018-11-26 2018-11-26 Video decoding method and device, electronic apparatus, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2020107168A1 true WO2020107168A1 (en) 2020-06-04

Family

ID=70854735

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/117478 WO2020107168A1 (en) 2018-11-26 2018-11-26 Video decoding method and device, electronic apparatus, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN112823519B (en)
WO (1) WO2020107168A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965776A (en) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114466246A (en) * 2022-02-14 2022-05-10 维沃移动通信有限公司 Video processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567206A (en) * 2009-05-26 2009-10-28 北京北纬通信科技股份有限公司 System for supporting self-adaption of decoding audio and video and method thereof
CN101771869A (en) * 2008-12-30 2010-07-07 深圳市万兴软件有限公司 AV (audio/video) encoding and decoding device and method
CN104683810A (en) * 2015-02-28 2015-06-03 武汉烽火众智数字技术有限责任公司 Dynamic decoding method and device based on characteristic analysis
CN108111874A (en) * 2016-11-16 2018-06-01 腾讯科技(深圳)有限公司 A kind of document handling method, terminal and server

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8687745B2 (en) * 2007-12-13 2014-04-01 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for blind decoding
CN102129370B (en) * 2011-01-12 2013-05-22 福州瑞芯微电子有限公司 Universal multimedia player frame
CN103488466B (en) * 2012-06-11 2017-02-08 联想(北京)有限公司 Method and device for executing application program
CN107888716A (en) * 2017-12-05 2018-04-06 广东欧珀移动通信有限公司 A kind of sort method of domain name resolution server, terminal device and storage medium
CN108259966B (en) * 2018-04-11 2020-02-18 大连理工大学 Multimedia large-screen synchronous playing method based on GPS time service

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771869A (en) * 2008-12-30 2010-07-07 深圳市万兴软件有限公司 AV (audio/video) encoding and decoding device and method
CN101567206A (en) * 2009-05-26 2009-10-28 北京北纬通信科技股份有限公司 System for supporting self-adaption of decoding audio and video and method thereof
CN104683810A (en) * 2015-02-28 2015-06-03 武汉烽火众智数字技术有限责任公司 Dynamic decoding method and device based on characteristic analysis
CN108111874A (en) * 2016-11-16 2018-06-01 腾讯科技(深圳)有限公司 A kind of document handling method, terminal and server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965776A (en) * 2021-10-20 2022-01-21 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system
CN113965776B (en) * 2021-10-20 2022-07-05 江下信息科技(惠州)有限公司 Multi-mode audio and video format high-speed conversion method and system

Also Published As

Publication number Publication date
CN112823519A (en) 2021-05-18
CN112823519B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
CN107995519B (en) Method, device and storage medium for playing multimedia file
WO2020078165A1 (en) Video processing method and apparatus, electronic device, and computer-readable medium
CN107368518B (en) Notification message management method, terminal and computer readable storage medium
CN103873883B (en) Video playing method and device and terminal equipment
CN103596017B (en) Video downloading method and system
CN103678605B (en) A kind of method of information transfer, device and terminal device
CN103678502B (en) Information collection method and device
EP3493113B1 (en) Image processing method, computer device, and computer readable storage medium
CN103365551A (en) Method for bookmark function applicable in messenger application and electronic apparatus
WO2018036352A1 (en) Video data coding and decoding methods, devices and systems, and storage medium
CN104618794A (en) Method and device for playing video
CN104965842A (en) Search recommending method and apparatus
CN111078986A (en) Data retrieval method, device and computer readable storage medium
WO2020107168A1 (en) Video decoding method and device, electronic apparatus, and computer-readable storage medium
CN106572241A (en) Method and device for displaying information
CN103687063A (en) Network connecting method, network connecting device and terminal equipment
CN108337533A (en) Video-frequency compression method and device
US10136115B2 (en) Video shooting method and apparatus
US11042587B2 (en) Performing behavior analysis on audio track data to obtain a name of an application
CN112689872B (en) Audio detection method, computer-readable storage medium and electronic device
CN110163051B (en) Text extraction method, device and storage medium
CN108549681B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN104038832A (en) Video playing method and device
US10834435B2 (en) Display apparatus and content display method thereof
CN110223221A (en) A kind of method and terminal device of dynamic image broadcasting

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18941787

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03.11.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18941787

Country of ref document: EP

Kind code of ref document: A1