A method, device, equipment and readable medium for decoding audio / video files

By receiving and decoding audio and video files in the local browser, using server-side plug-ins and the user's local CPU/GPU, the high cost problem caused by cloud dependence is solved, and low-cost, network-free audio and video file decoding is achieved, enriching the Use scenarios and control traffic.

CN114501149BActive Publication Date: 2024-09-24TIANMAI TUODAO (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210125659.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-10
Publication Date
2024-09-24
Estimated Expiration
2042-02-10

AI Technical Summary

Technical Problem

Existing audio and video decoding technology relies on cloud GPU server groups, resulting in high costs, and users need to deploy a large number of cloud resources, which limits the implementation of low-cost decoding solutions.

Method used

By receiving the file to be decoded, obtain its encoding information, determine whether the local browser supports decoding, if not, obtain the corresponding decoding plug-in from the server, and use the user's local CPU and GPU to decode to implement the decoding process.

Benefits of technology

There is no need to rely on cloud resources, which reduces costs. Users can decode audio and video files without being connected to the network, enriching usage scenarios, and completing decoding through the browser, avoiding client software installation and controlling traffic bandwidth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114501149B
    Figure CN114501149B
Patent Text Reader

Abstract

The embodiments of this specification disclose a method, apparatus, device and readable medium for decoding audio / video files, and the scheme includes: receiving a file to be decoded; obtaining encoding information of the file to be decoded, judging whether a local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result; if the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by a server; decoding the file to be decoded based on the decoding plug-in, and obtaining a decoding result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of audio / video file decoding, and in particular to a method, device, equipment and readable medium for decoding an audio / video file. Background Art

[0002] In the current audio and video decoding field, most online audio and video decoding adopts the method of centralized decoding on online cloud servers. The premise of this solution is to purchase and deploy a large number of GPU server groups in the early stage. Although the problem of unified conversion of user data is solved through the cloud method, its disadvantage is that the cost is extremely high. Any company that wants to provide online non-editing functions must spend a lot of money and manpower to deploy a large number of cloud GPU server groups.

[0003] Therefore, it is necessary to provide a low-cost method that can effectively decode the audio and video files to be decoded. Summary of the invention

[0004] The embodiments of the present specification provide a method, apparatus, device and readable medium for decoding an audio / video file, so as to decode the audio / video file to be decoded efficiently and at low cost.

[0005] To solve the above technical problems, the embodiments of this specification are implemented as follows:

[0006] An embodiment of the present specification provides a method for decoding an audio / video file, the method comprising:

[0007] Receive the file to be decoded;

[0008] Obtaining encoding information of the file to be decoded, and judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result;

[0009] If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server;

[0010] The file to be decoded is decoded based on the decoding plug-in to obtain a decoding result.

[0011] An audio / video file decoding device provided in an embodiment of the present specification includes:

[0012] A file receiving module, used for receiving a file to be decoded;

[0013] A judgment module, used for obtaining the encoding information of the file to be decoded, judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result;

[0014] A decoding module determination module, configured to receive a decoding plug-in corresponding to the encoding information sent by the server if the judgment result is no;

[0015] The decoding module is used to decode the file to be decoded based on the decoding plug-in to obtain a decoding result.

[0016] An audio / video file decoding device provided in an embodiment of the present specification includes:

[0017] at least one processor; and,

[0018] a memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0020] Receive the file to be decoded;

[0021] Obtaining encoding information of the file to be decoded, and judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result;

[0022] If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server;

[0023] The file to be decoded is decoded based on the decoding plug-in to obtain a decoding result.

[0024] An embodiment of the present specification provides a computer-readable medium on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement a method for decoding an audio / video file.

[0025] At least one embodiment provided in this specification can achieve the following beneficial effects:

[0026] When decoding the audio / video file to be decoded, the technical solution of this embodiment directly uses the CPU and GPU of the user's current computer device, concentrates local computing power, does not rely on the cloud, and can even complete the decoding of audio and video files in a completely disconnected state, thereby greatly enriching the use scenarios of terminal users, allowing users to complete transcoding non-editing work without network restrictions. Moreover, the decoding of audio and video files in the technical solution of this embodiment is completed through the browser, so there is no need to install any client software, which can minimize the installation cost of users. When the local browser does not support decoding the audio / video file to be decoded, it is possible to obtain a decoding plug-in corresponding to the encoding information of the audio / video file to be decoded from the server side, that is, when the local browser does not support decoding the audio / video file to be decoded, dynamically load the corresponding decoding plug-in, on the one hand, it can support the browser side to complete the decoding work, on the other hand, because the server side transmits only the decoding plug-in to the browser side, rather than the decoding control packaged by all the decoding plug-ins, the fine granularity is high and the traffic bandwidth is controllable. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0028] Figure 1 A flowchart of a method for decoding an audio / video file provided in an embodiment of this specification;

[0029] Figure 2 To correspond to Figure 1 A structural schematic diagram of an audio / video file decoding device;

[0030] Figure 3 A schematic diagram of parallel encoding of sub-files in a method for decoding an audio / video file provided in an embodiment of this specification;

[0031] Figure 4 A schematic diagram of the structure of a decoding device for an audio / video file provided in an embodiment of this specification. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this description, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.

[0033] Figure 1 The flowchart of a method for decoding an audio / video file provided in an embodiment of the present specification is as follows. From a program perspective, the execution subject of the flow can be a program installed on an application server or an application terminal.

[0034] like Figure 1 As shown, the process may include the following steps:

[0035] Step S102: receiving a file to be decoded.

[0036] In the technical solution of this embodiment, the browser receives the file to be decoded distributed by the server, and the file to be decoded can be an audio file or a video file. In a specific scenario, the file to be decoded can be an audio / video file selected by the user to play. The server can quickly and stably distribute the file to be decoded to the browser through the content distribution network.

[0037] Step S104: Obtain the encoding information of the file to be decoded, and determine whether the local browser supports decoding processing of the file to be decoded based on the encoding information to obtain a determination result.

[0038] Before transmitting audio / video files over the network, the audio / video files to be transmitted need to be encoded using specific compression technology, that is, converting audio / video files of a certain format into audio / video files of another format, and then transmitting the encoded audio / video files. For example, the most important encoding standards in video streaming transmission are H.261, H.263, H.264 of the ITU, M-JPEG of the Moving Picture Experts Group, and MPEG series standards of the International Organization for Standardization Moving Picture Experts Group. After obtaining the compressed audio / video files through the network, they need to be decoded for local playback.

[0039] Therefore, the encoding information in the technical solution of this embodiment may refer to the encoding method used in the encoding process of the file to be decoded, so as to facilitate the subsequent process to use the corresponding decoding method to decode the file to be decoded.

[0040] Existing commercial browsers generally support playing audio / video files of several encoding standards. Therefore, in this step, after obtaining the encoding information of the file to be decoded, it is possible to determine whether the local browser can decode the file to be decoded based on the encoding information of the file to be decoded to obtain a judgment result.

[0041] Step S106: If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server.

[0042] When the local browser does not support decoding of the file to be decoded, in the technical solution of the embodiment of the present invention, the browser side obtains the corresponding decoding plug-in from the server side, that is, the plug-in that can decode the file to be decoded. In the present invention, since the file to be decoded may be an audio file or a video file, and each browser has different decoding support for audio files or video files using different encoding standards, in the technical solution of the present invention, a decoding module can be extracted from the existing decoding software, and several decoding plug-ins can be constructed, and then stored independently, that is, these several decoding plug-ins are not encapsulated into a unified large decoding control. For example, as many decoding controls as possible are extracted from multiple decoding software such as ffmpeg, and a decoding plug-in library is constructed and pre-stored in the server.

[0043] In step S104, it is determined whether the browser can decode the file to be decoded. If the judgment result is no, that is, the local browser cannot decode the file to be decoded, a decoding plug-in corresponding to the encoding information sent by the server can be received to decode the file to be decoded.

[0044] Step S108: Decoding the file to be decoded based on the decoding plug-in to obtain a decoding result.

[0045] When decoding the audio / video file to be decoded, the technical solution of this embodiment directly uses the CPU and GPU of the user's current computer device, concentrates local computing power, does not rely on the cloud, and can even complete the decoding of audio and video files in a completely disconnected state, thereby greatly enriching the use scenarios of terminal users, allowing users to complete transcoding non-editing work without network restrictions. Moreover, the decoding of audio and video files in the technical solution of this embodiment is completed through the browser, so there is no need to install any client software, which can minimize the installation cost of users. When the local browser does not support decoding the audio / video file to be decoded, it is possible to obtain a decoding plug-in corresponding to the encoding information of the audio / video file to be decoded from the server side, that is, when the local browser does not support decoding the audio / video file to be decoded, dynamically load the corresponding decoding plug-in, on the one hand, it can support the browser side to complete the decoding work, on the other hand, because the server side transmits only the decoding plug-in to the browser side, rather than the decoding control packaged by all the decoding plug-ins, the fine granularity is high and the traffic bandwidth is controllable.

[0046] In an optional embodiment technical solution, before receiving the file to be decoded, the method includes: pre-constructing a coding information list of the coding supported by the local browser itself;

[0047] The decoding plug-in is pre-made by the server, and specifically includes:

[0048] Based on the existing decoding module, several decoding plug-ins are pre-made, and each of the several decoding plug-ins is independently stored in the server.

[0049] In an optional embodiment technical solution, before obtaining the encoding information of the file to be decoded, the process includes:

[0050] Construct a lock-free circular buffer data queue, set a first pointer and a second pointer, wherein the first pointer points to a position for next reading, and the second pointer points to a position for next writing, and use the lock-free circular buffer data queue to store the file to be decoded.

[0051] In an optional embodiment technical solution, the obtaining the encoding information of the file to be decoded specifically includes:

[0052] Based on the first pointer and the second pointer, the first pointer is pointed to the file header of the file to be decoded, and the second pointer is pointed to the file tail of the file to be decoded, and the decapsulation module is used to read the byte stream contained in the file header and / or the file tail of the file to be decoded, so as to obtain the encoding information of the file to be decoded; wherein, the file to be decoded is stored based on the lock-free ring buffer data team.

[0053] Because all audio files or video files are stored in binary form in the media, the files are mainly divided into three parts: file header, data body, and file tail (may not exist). Different files are identified by file header and tail. The file header and tail are a section of data located at the beginning or end of the file that undertakes certain tasks and records file attribute information. In the technical solution of the embodiment of the present invention, a pointer mapping mode is used to map to a specific media file offset position. Because the proportion of bytes occupied by the header and tail of the media file is relatively small, this method can effectively reduce the occupation of physical memory on the browser side and avoid memory loading of the entire media file.

[0054] In an optional embodiment technical solution, if the file to be decoded is a video file, decoding the file to be decoded based on the decoding plug-in to obtain a decoding result specifically includes:

[0055] Cutting the file to be decoded to obtain a plurality of video frame sequences;

[0056] For any one video frame in the plurality of video frame sequences, decoding in parallel the data points that can be decoded in parallel corresponding to the any one video frame; or,

[0057] The arbitrary video frame is processed as a GOP frame segment, and each thread processes a GOP frame segment in a multi-threaded manner, and the decoding is accelerated in parallel in segments.

[0058] In an optional embodiment technical solution, if the file to be decoded is an audio file,

[0059] After decoding the to-be-decoded file based on the decoding plug-in to obtain a decoding result, the method further includes: performing frequency conversion, speed conversion or audio mixing processing on the decoding result; or,

[0060] If the file to be decoded is a video file, after the file to be decoded is decoded by the decoding module and a decoding result is obtained, the method further includes: performing layering, filtering or transition processing on the video frames in the decoding result.

[0061] In an optional embodiment technical solution, after obtaining the decoding result, the step further includes encoding the audio / video file obtained after decoding, specifically including:

[0062] Cutting the decoded audio / video file to obtain a sub-file sequence, wherein any sub-file in the sub-file sequence contains a certain number of continuous byte streams;

[0063] For any two subfiles with consecutive serial numbers in the subfile sequence, the subfile with the smaller serial number is the first subfile, and the subfile with the larger serial number is the second subfile, and there are a certain number of overlapping byte streams at the tail of the first subfile and the head of the second subfile;

[0064] The first sub-file is decoded by a first sub-thread to obtain a first decoding result, and the second sub-file is decoded by a second sub-thread to obtain a second decoding result. The first sub-thread and the second sub-thread are operated in parallel.

[0065] For audio files, in the prior art, there is packet loss in the early stage of AAC encoding, so the prior art generally adopts linear encoding instead of parallel encoding scheme, because if the parallel encoding scheme is adopted, the encoding result may be incomplete due to the packet loss in the early stage. Therefore, the present invention designs the following Figure 2 The scheme shown in the figure first cuts the whole audio file to be encoded to obtain a subfile sequence, and uses two consecutive subfiles, namely the first subfile and the second subfile, to illustrate the parallel encoding scheme of the present invention. There is an overlapping part in the byte stream processed by the first thread and the second thread. Specifically, the second thread can redundantly have a certain number (more than 2*1024 bytes) of audio bytes to buffer the packet loss in the early stage of AAC encoding. This algorithm can accelerate encoding in parallel and ensure that key data is not lost, so that the first thread and the second thread can perform encoding processing in parallel, that is, the first thread processes the first subfile, and at the same time, the second thread processes the second subfile. After obtaining the encoding result, splicing can be performed. In the splicing process, since the position of the overlapping part of the first thread and the second thread is known in advance (from the perspective of the first subfile, the position of the overlapping part in the first subfile can be known, and from the perspective of the second subfile, the position of the overlapping part in the second subfile can also be known), splicing can be smoothly achieved according to the position of the overlapping part, which will not be repeated here.

[0066] For video files, shader scripts can be used to convert RGB format data into YUV format at the GPU layer, and then readPixels can be used to exchange the GPU layer data to the CPU layer memory. There are two solutions for video encoding. The first solution: YUV data can be encoded using the SIMD algorithm of h264, and multi-threaded mode is used during encoding. In actual tests, 1080P (1024*1920) video frame encoding can be close to 1x speed. The second solution uses the webcodec module provided by the browser kernel, and uses the encoding module inside the browser to accelerate encoding. This encoding module can make full use of the capabilities of the GPU encoder to achieve the effect of accelerated encoding.

[0067] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 3 The embodiments of this specification provide corresponding to Figure 1 A schematic diagram of the structure of a decoding device for an audio / video file. Figure 3 As shown, the device may include:

[0068] A file receiving module 302, used for receiving a file to be decoded;

[0069] The judgment module 304 is used to obtain the encoding information of the file to be decoded, and judge whether the local browser supports the decoding process of the file to be decoded based on the encoding information to obtain a judgment result;

[0070] The decoding module determination module 306 is used to receive a decoding plug-in corresponding to the encoding information sent by the server if the judgment result is no;

[0071] The decoding module 308 is used to decode the file to be decoded based on the decoding plug-in to obtain a decoding result.

[0072] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.

[0073] Figure 4 The embodiments of this specification provide corresponding to Figure 1 A structural diagram of a decoding device for an audio / video file. Figure 4 As shown, the device 400 may include:

[0074] at least one processor 410; and,

[0075] A memory 430 is communicatively connected to the at least one processor; wherein,

[0076] The memory 430 stores instructions 420 that can be executed by the at least one processor 410 , and the instructions are executed by the at least one processor 410 .

[0077] The instructions may enable the at least one processor 410 to:

[0078] Receive the file to be decoded;

[0079] Obtaining encoding information of the file to be decoded, and judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result;

[0080] If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server;

[0081] The file to be decoded is decoded based on the decoding plug-in to obtain a decoding result.

[0082] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0083] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0084] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0085] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0086] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

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

[0088] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0089] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0091] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0092] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0093] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

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

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

[0096] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

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

Claims

1. A method for decoding audio / video files, applied to the browser side, It is characterized in that include: Receive the file to be decoded; Obtaining encoding information of the file to be decoded, and judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result; If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server; Decoding the file to be decoded based on the decoding plug-in to obtain a decoding result; Before receiving the file to be decoded, the method includes: pre-constructing a list of encoding information of encodings supported by the local browser itself; The decoding plug-in is pre-made by the server, and specifically includes: Based on the existing decoding module, a plurality of decoding plug-ins are pre-made, and each of the plurality of decoding plug-ins is independently stored in the server end; Before obtaining the encoding information of the file to be decoded, the method includes: Constructing a lock-free circular buffer data queue, setting a first pointer and a second pointer, wherein the first pointer points to a position for next reading, and the second pointer points to a position for next writing, and using the lock-free circular buffer data queue to store the file to be decoded; The obtaining the encoding information of the file to be decoded specifically includes: Based on the first pointer and the second pointer, the first pointer is pointed to the file header of the file to be decoded, and the second pointer is pointed to the file tail of the file to be decoded, and the byte stream contained in the file header and / or the file tail of the file to be decoded is read by using a decapsulation module, so as to obtain the encoding information of the file to be decoded; wherein the file to be decoded is stored based on the lock-free ring buffer data queue; If the file to be decoded is a video file, decoding the file to be decoded based on the decoding plug-in to obtain a decoding result specifically includes: Cutting the file to be decoded to obtain a plurality of video frame sequences; For any one video frame in the plurality of video frame sequences, decoding in parallel the data points that can be decoded in parallel corresponding to the any one video frame; or, Processing any one of the video frames as GOP frame segments, processing one GOP frame segment per thread in a multi-threaded manner, and accelerating decoding in parallel in segments; If the file to be decoded is an audio file, after decoding the file to be decoded based on the decoding plug-in and obtaining the decoding result, the method further includes: performing frequency conversion, speed change or mixing processing on the decoding result; or, If the file to be decoded is a video file, after the decoding module is used to decode the file to be decoded and a decoding result is obtained, the method further includes: performing a layering, filtering or transition processing on the video frames in the decoding result; After obtaining the decoding result, the step further includes encoding the audio / video file obtained after decoding, specifically including: Cutting the decoded audio / video file to obtain a sub-file sequence, wherein any sub-file in the sub-file sequence contains a certain number of continuous byte streams; For any two subfiles with consecutive serial numbers in the subfile sequence, the subfile with the smaller serial number is the first subfile, and the subfile with the larger serial number is the second subfile, and there are a certain number of overlapping byte streams at the tail of the first subfile and the head of the second subfile; The first sub-file is decoded by a first sub-thread to obtain a first decoding result, and the second sub-file is decoded by a second sub-thread to obtain a second decoding result. The first sub-thread and the second sub-thread are operated in parallel.

2. A decoding device for audio / video files, It is characterized in that include: A file receiving module, used for receiving a file to be decoded; Before receiving the file to be decoded, the method includes: pre-constructing a list of encoding information of encodings supported by the local browser itself; A judgment module is used to obtain the encoding information of the file to be decoded, and judge whether the local browser supports the decoding process of the file to be decoded based on the encoding information to obtain a judgment result; Before obtaining the encoding information of the file to be decoded, it includes: constructing a lock-free ring buffer data queue, setting a first pointer and a second pointer, the first pointer points to the position of the next read, and the second pointer points to the position of the next write, and using the lock ring buffer data queue to store the file to be decoded; The obtaining the encoding information of the file to be decoded specifically includes: Based on the first pointer and the second pointer, the first pointer is pointed to the file header of the file to be decoded, and the second pointer is pointed to the file tail of the file to be decoded, and the byte stream contained in the file header and / or the file tail of the file to be decoded is read by using a decapsulation module, so as to obtain the encoding information of the file to be decoded; wherein the file to be decoded is stored based on the lock-free ring buffer data queue; A decoding module determination module is used to receive a decoding plug-in corresponding to the encoding information sent by the server side if the judgment result is no; the decoding plug-in is pre-made by the server side, specifically including: pre-making a plurality of decoding plug-ins based on the existing decoding module, and independently storing each of the plurality of decoding plug-ins in the server side; A decoding module is used to decode the file to be decoded based on the decoding plug-in to obtain a decoding result; if the file to be decoded is a video file, the decoding plug-in is used to decode the file to be decoded based on the decoding plug-in to obtain a decoding result, specifically including: Cutting the file to be decoded to obtain a plurality of video frame sequences; For any one video frame in the plurality of video frame sequences, decoding in parallel the data points that can be decoded in parallel corresponding to the any one video frame; or, Processing any one of the video frames as GOP frame segments, processing one GOP frame segment per thread in a multi-threaded manner, and accelerating decoding in parallel in segments; If the file to be decoded is an audio file, after decoding the file to be decoded based on the decoding plug-in and obtaining the decoding result, the method further includes: performing frequency conversion, speed change or mixing processing on the decoding result; or If the file to be decoded is a video file, after the decoding module is used to decode the file to be decoded and a decoding result is obtained, the method further includes: performing a layering, filtering or transition processing on the video frames in the decoding result; After obtaining the decoding result, the step further includes encoding the audio / video file obtained after decoding, specifically including: Cutting the decoded audio / video file to obtain a sub-file sequence, wherein any sub-file in the sub-file sequence contains a certain number of continuous byte streams; For any two subfiles with consecutive serial numbers in the subfile sequence, the subfile with the smaller serial number is the first subfile, and the subfile with the larger serial number is the second subfile, and there are a certain number of overlapping byte streams at the tail of the first subfile and the head of the second subfile; The first sub-file is decoded by a first sub-thread to obtain a first decoding result, and the second sub-file is decoded by a second sub-thread to obtain a second decoding result. The first sub-thread and the second sub-thread are operated in parallel.

3. A decoding device for audio / video files, include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Receive the file to be decoded; Obtaining encoding information of the file to be decoded, and judging whether the local browser supports decoding processing of the file to be decoded based on the encoding information, and obtaining a judgment result; If the judgment result is no, receiving a decoding plug-in corresponding to the encoding information sent by the server; Decoding the file to be decoded based on the decoding plug-in to obtain a decoding result; Before receiving the file to be decoded, the method includes: pre-constructing a list of encoding information of encodings supported by the local browser itself; The decoding plug-in is pre-made by the server, and specifically includes: Based on the existing decoding module, a plurality of decoding plug-ins are pre-made, and each of the plurality of decoding plug-ins is independently stored in the server end; Before obtaining the encoding information of the file to be decoded, the method includes: Constructing a lock-free circular buffer data queue, setting a first pointer and a second pointer, wherein the first pointer points to a position for next reading, and the second pointer points to a position for next writing, and using the lock-free circular buffer data queue to store the file to be decoded; The obtaining the encoding information of the file to be decoded specifically includes: Based on the first pointer and the second pointer, the first pointer is pointed to the file header of the file to be decoded, and the second pointer is pointed to the file tail of the file to be decoded, and the byte stream contained in the file header and / or the file tail of the file to be decoded is read by using a decapsulation module, so as to obtain the encoding information of the file to be decoded; wherein the file to be decoded is stored based on the lock-free ring buffer data queue; If the file to be decoded is a video file, decoding the file to be decoded based on the decoding plug-in to obtain a decoding result specifically includes: Cutting the file to be decoded to obtain a plurality of video frame sequences; For any one video frame in the plurality of video frame sequences, decoding in parallel the data points that can be decoded in parallel corresponding to the any one video frame; or, Processing any one of the video frames as GOP frame segments, processing one GOP frame segment per thread in a multi-threaded manner, and accelerating decoding in parallel in segments; If the file to be decoded is an audio file, after decoding the file to be decoded based on the decoding plug-in and obtaining the decoding result, the method further includes: performing frequency conversion, speed change or mixing processing on the decoding result; or If the file to be decoded is a video file, after the decoding module is used to decode the file to be decoded and a decoding result is obtained, the method further includes: performing a layering, filtering or transition processing on the video frames in the decoding result; After obtaining the decoding result, the step further includes encoding the audio / video file obtained after decoding, specifically including: Cutting the decoded audio / video file to obtain a sub-file sequence, wherein any sub-file in the sub-file sequence contains a certain number of continuous byte streams; For any two subfiles with consecutive serial numbers in the subfile sequence, the subfile with the smaller serial number is the first subfile, and the subfile with the larger serial number is the second subfile, and there are a certain number of overlapping byte streams at the tail of the first subfile and the head of the second subfile; The first sub-file is decoded by a first sub-thread to obtain a first decoding result, and the second sub-file is decoded by a second sub-thread to obtain a second decoding result. The first sub-thread and the second sub-thread are operated in parallel.

4. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the audio / video file decoding method according to claim 1.