CN117857811A - Video processing method and device and electronic equipment - Google Patents

Video processing method and device and electronic equipment Download PDF

Info

Publication number
CN117857811A
CN117857811A CN202311507434.6A CN202311507434A CN117857811A CN 117857811 A CN117857811 A CN 117857811A CN 202311507434 A CN202311507434 A CN 202311507434A CN 117857811 A CN117857811 A CN 117857811A
Authority
CN
China
Prior art keywords
file
video
encoded
files
subfiles
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311507434.6A
Other languages
Chinese (zh)
Inventor
王巧策
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202311507434.6A priority Critical patent/CN117857811A/en
Publication of CN117857811A publication Critical patent/CN117857811A/en
Pending legal-status Critical Current

Links

Abstract

The invention provides a video processing method, a video processing device and electronic equipment, wherein a video file is firstly acquired and divided into a plurality of subfiles; then, respectively encoding the plurality of subfiles to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser, wherein different threads are used for decoding different encoded files. In the method, the video file is divided into a plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing a plurality of threads during decoding.

Description

Video processing method and device and electronic equipment
Technical Field
The present invention relates to the field of video image processing technologies, and in particular, to a video processing method, a video processing device, and an electronic device.
Background
Transparent video generally refers to changing the background in the video to transparent, preserving the video effect of only foreground objects. Because the browser in the mobile terminal device cannot fully support the playing of the transparent video, in the related art, when the transparent video needs to be applied in the browser, the transparent sequence frame animation is usually used for replacing the transparent video, but the animation volume is huge, and the operation pressure of the mobile terminal is increased.
Disclosure of Invention
The invention aims to provide a video processing method, a video processing device and electronic equipment, so as to rapidly decode videos and reduce the operation pressure of a mobile terminal browser.
In a first aspect, the present invention provides a video processing method, the method comprising: acquiring a video file, and dividing the video file into a plurality of subfiles; encoding the plurality of subfiles respectively to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
In a second aspect, the present invention provides a video processing apparatus comprising: the file segmentation module is used for acquiring a video file and segmenting the video file into a plurality of subfiles; the file coding module is used for respectively coding the plurality of sub-files to obtain a plurality of coded files; the file decoding module is used for reading a plurality of coded files when the video files are played in the browser, and decoding the coded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the coded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
In a third aspect, the present invention provides an electronic device comprising a processor and a memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the video processing method described above.
In a fourth aspect, the present invention provides a computer readable storage medium storing computer executable instructions that, when invoked and executed by a processor, cause the processor to implement the video processing method described above.
The embodiment of the invention has the following beneficial effects:
the invention provides a video processing method, a device and electronic equipment, which are characterized in that firstly, a video file is obtained and divided into a plurality of subfiles; then, respectively encoding the plurality of subfiles to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files. In the method, the video file is divided into a plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing a plurality of threads during decoding.
Additional features and advantages of the invention will be set forth in the description which follows, or in part will be obvious from the description, or may be learned by practice of the invention.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a video processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another video processing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a video processing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Transparent video generally refers to changing the background in the video to transparent, preserving the video effect of only foreground objects. Since the browser in the mobile terminal device cannot fully support the playing of the transparent video, in the related art, when the transparent video needs to be applied in the browser, a transparent sequence frame animation is usually used to replace the transparent video, but this makes the animation relatively bulky. If webelementary is used to directly decode video, the mobile browser webelementary does not support multi-thread operation, and if the soft decoding capability is lower, the video size is larger, so that transparent video cannot be played.
Based on the above problems, the embodiments of the present invention provide a video processing method, apparatus, and electronic device, where the technology may be applied to a video playing scene of a browser, especially a playing scene of a transparent video.
In order to facilitate understanding of the embodiments of the present invention, first, a video processing method, apparatus and electronic device disclosed in the embodiments of the present invention are described in detail, as shown in fig. 1, where the method includes the following specific steps:
step S102, a video file is acquired and divided into a plurality of subfiles.
In a specific implementation, the video file may be a target video or a sequence frame animation, and specifically, the target video may be any video to be processed or a transparent video; the sequence frame animation may be a transparent sequence frame animation. The sequence frame animation is an animation form formed by multiple frames of pictures. After the video file is obtained, the video file can be divided into a plurality of subfiles according to the size of the video file and the region; the number of the video files can be determined according to user settings or research and development requirements. Each sub-file contains the content of a partial area in the video file, and the areas of the video files contained in different sub-files are different.
Step S104, respectively encoding the plurality of subfiles to obtain a plurality of encoded files.
After the video file is divided into a plurality of subfiles, each subfile is also required to be encoded, and the encoded file corresponding to each subfile is obtained. The sub-files are encoded, that is, the sub-files are converted into files with preset formats, that is, encoded files. The above-mentioned preset format can be determined according to the research and development requirements, specifically, if the video file is transparent video or transparent sequence frame animation, the preset format is required to support a transparent channel, the transparent channel is an alpha channel, and only the picture or video with the alpha channel has transparent background, and only the shape and the content of the transparent channel can be displayed.
Step S106, when the video file is played in the browser, reading a plurality of encoded files, and using a plurality of threads to decode the encoded files in parallel to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
After the encoded files corresponding to the plurality of subfiles are obtained, the encoded files are required to be written into the preset animation files according to the preset sequence, then when the video files are played in the browser, the plurality of encoded files are required to be sequentially read from the video files, then the plurality of encoded files are simultaneously decoded by utilizing a plurality of threads, and one thread decodes one encoded file. Specifically, the invention realizes parallel decoding by utilizing a plurality of worker threads of the browser, thereby solving the problem that the browser webassmbly cannot decode in a multithread manner.
In specific implementation, the method can realize video playing while decoding, namely, when a plurality of threads decode a plurality of encoded files simultaneously, the method combines the decoded videos corresponding to the plurality of encoded files decoded currently, and plays the decoded video combined currently as the current playing video, so that the operation pressure of a browser can be reduced.
The video processing method provided by the embodiment of the invention comprises the steps of firstly, obtaining a video file and dividing the video file into a plurality of subfiles; then, respectively encoding the plurality of subfiles to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files. In the method, the video file is divided into a plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing a plurality of threads during decoding.
The following preferred embodiments are used to describe the manner in which video files and encoded files are partitioned.
Specifically, the specific process of obtaining a video file and dividing the video file into a plurality of subfiles may include: acquiring a video file and determining the size of the video file; determining a segmentation size according to the size and the segmentation number of the video file; the video file is divided into a plurality of subfiles according to the division size.
In specific implementation, after the video file is obtained, the size of the video file needs to be determined, then the video file is divided into a plurality of areas according to the size of the video file, the division size corresponding to each area is the same, and each area corresponds to part of the content of the video file, namely, the part of the content is a sub-file of the video file. Specifically, the above-mentioned division size is determined according to the size of the video file and the number of divisions, for example, the video file has a height th, a width tw, and a number of divisions of 4, and then the division size is th/4 of the height of each area, and the width tw/4. Then the video file is divided into 4 subfiles according to the dividing size, and the specific method is as follows:
an area of x=0 (x represents a coordinate value in the x-axis direction), y=0 (Y represents a coordinate value in the Y-axis direction), w=tw/2 (w represents an area width), and h=th/2 (h represents an area height) in the clip video file is subfile 1; the region of x=tw/2, y= 0,w =tw/2,h =th/2 in the clip video file is sub-file 2; the region of x=0, y=th/2,w =tw/2,h =th/2 in the clip video file is subfile 3; the region of the clip video file where x=tw/2, y=th/2,w =tw/2,h =th/2 is sub-file 4. Coordinate values corresponding to the upper right corner position of each subfile indicated by (x, y) above.
The above steps are to divide the video file into 4 subfiles. The video file may be divided into an even number of subfiles, such as 6 or 8. Since the video cannot be of an odd size, if an odd number is encountered in calculating the division size at the time of division, the value-1 is set to an even number.
Further, the video file comprises transparent video or transparent sequence frame animation; the video file comprises transparent information of transparent video or transparent sequence frame animation; the specific process of encoding the plurality of subfiles to obtain the plurality of encoded files may include: aiming at each sub-file in the plurality of sub-files, converting the current sub-file into a coded file in a preset format; wherein, the preset format supports the preservation of transparent information of the video file.
The transparent information is a transparent channel, and pictures or videos with the transparent channel are displayed, and the background is transparent, so that only foreground objects of the pictures or videos are displayed. In a specific implementation, each sub-file in the video file needs to be a current sub-file once, and the current sub-file needs to be converted into a coded file in a preset format, and the preset format needs to support a transparent channel. For example, the preset format may be libvp9x format, or may be another encoding format supporting a transparent channel.
In the mode, the transparent video or the transparent sequence frame animation is divided into a plurality of areas, and then the subfiles corresponding to each area are encoded, so that the subsequent multi-thread decoding of the encoded files is facilitated, and the decoding speed of the browser is improved.
Corresponding to the method embodiment, the embodiment of the invention also provides another video processing method, which is realized on the basis of the method embodiment, the method embodiment mainly describes reading a plurality of encoded files, and uses a plurality of threads to decode the plurality of encoded files in parallel to obtain decoded videos corresponding to the plurality of encoded files; the specific process of combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser (which is implemented through the following steps S210-S220) is shown in fig. 2, and the method comprises the following specific steps:
step S202, a video file is acquired and divided into a plurality of subfiles.
Step S204, writing coordinate information corresponding to the plurality of subfiles into a preset animation file; wherein the coordinate information includes: position coordinates of the target position in the subfile, and size information of the video area contained in the subfile.
Before the video file is acquired, an animation file needs to be defined, and the animation file is a defined file in a full new format and is also an empty file so as to write the content later. In a specific implementation, since the video file is divided into a plurality of subfiles according to the region by the pre-processing, and the video file needs to be rendered according to the divided subfiles in the post-rendering, after the video file is divided into a plurality of subfiles, coordinate information corresponding to each subfile needs to be written into the animation file so as to correctly render the divided subfiles at corresponding positions.
Specifically, one sub-file contains coordinate information (x, y, w, h) of one region, which is generated at the time of division, wherein (x, y) represents the position coordinates of the target position in the sub-file, w represents the width of the video region contained in the sub-file, and h represents the height of the video region contained in the sub-file. The target position may be determined according to the development requirement, for example, the target position may be an upper left corner position, a lower right corner position, or the like of the subfiles.
Step S206, encoding the plurality of subfiles respectively to obtain a plurality of encoded files.
Step S208, writing a plurality of coding files into the animation file; the method comprises the steps of storing a coded file in an animation file in association with coordinate information of a sub-file corresponding to the coded file, and dividing the coded file in the animation file into a plurality of data blocks with fixed sizes.
In a specific implementation, file contents and file sizes of a plurality of encoded files may be sequentially written into the animation file. In the process of writing the content of the encoded file, the video file needs to be written into the animation file in turn according to the fixed data block size (corresponding to the fixed size), and the encoded file in the animation file is associated with the coordinate information of the sub-file corresponding to the encoded file for storage. Specifically, the size of each data block is fixed, that is, the data block size is a fixed size, and the size of the fixed size can be determined according to the development requirements.
Step S210 reads the target data block in each of the plurality of encoded files from the driven file.
When the video file is played in the browser, the first data block in each encoded file is read from the video file, and at the moment, the first data block is the target data block; and then respectively reading the second data block in each video file, wherein the second data block is the target data block, and so on until the last data block in each video file is read.
Step S212, performing parallel decoding on target data blocks in a plurality of encoded files by using a plurality of threads to obtain a decoded video corresponding to each target data block; wherein different threads are used to decode different blocks of data.
After the target data blocks corresponding to each coded file are read respectively, the target data blocks in the multiple coded files are required to be decoded in parallel by utilizing multiple threads, so that decoded video corresponding to each target data block is obtained; wherein one thread decodes one target data block to achieve parallel decoding of the data blocks. The method can reduce the large-size video into the small-size video and then decode the small-size video in different threads, so that the problem that the browser webassmbly cannot decode the multi-threads is solved, and the threads can be browser worker threads.
Step S214, according to the coordinate information stored in the animation file, combining the decoded video corresponding to each target data block to obtain the current playing video of the browser.
According to the coordinate information corresponding to each target data block, the decoded videos corresponding to a plurality of target data blocks can be combined into the video to be played currently by the browser, so that the mode of playing the video while decoding is realized, namely, when decoding, after reading one data block corresponding to each encoded file each time, the data block is decoded, then the decoded videos corresponding to each data block are combined, and the combined video is played in the browser.
Step S216, judging whether the target data block is the last data block in the encoded file, if yes, executing step S218, otherwise, executing step S210.
After decoding the target data block to obtain the current playing video of the browser, judging whether the target data block is the last data block in the encoded file, if so, decoding is completed, and reading the subfiles from the driven file is not needed.
In step S218, the decoding is completed.
Step S220, taking the next data block of the target data block in the encoded file as a new target data block, and continuing to execute step S210.
If the target data block is not the last data block in the encoded file, the next data block of the target data block in the encoded file is required to be used as a new target data block, the target data block in each encoded file in a plurality of encoded files is continuously read from the driven file, the target data blocks in the plurality of encoded files are decoded in parallel by utilizing a plurality of threads to obtain a decoded video corresponding to each target data block, and then the decoded video corresponding to each target data block is combined according to the coordinate information stored in the animation file to obtain the current playing video of the browser.
In the mode, the video or the sequence frame animation is divided into a plurality of areas, and the browser worker is utilized to decode the plurality of areas simultaneously during decoding, so that the problem that webempty cannot be multithreaded is solved. In practical application, compared with the technical scheme in the prior art, the scheme can save more than 98% of volume for the same animation, and greatly reduces the running pressure of the browser, so that the transparent video can be applied to the browser.
For the above method embodiment, the embodiment of the present invention further provides a video processing apparatus, as shown in fig. 3, where the apparatus includes:
the file dividing module 30 is configured to obtain a video file and divide the video file into a plurality of subfiles.
The file encoding module 31 is configured to encode the plurality of subfiles respectively to obtain a plurality of encoded files.
The file decoding module 32 is configured to read a plurality of encoded files when the video file is played in the browser, and decode the plurality of encoded files in parallel by using a plurality of threads to obtain decoded videos corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
The video processing device firstly acquires a video file and divides the video file into a plurality of subfiles; then, respectively encoding the plurality of subfiles to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files. In the method, the video file is divided into a plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing a plurality of threads during decoding.
Specifically, the file splitting module 30 is configured to: acquiring a video file and determining the size of the video file; determining a segmentation size according to the size and the segmentation number of the video file; the video file is divided into a plurality of subfiles according to the division size.
In specific implementation, the video file includes transparent video or transparent sequence frame animation; the video file includes transparent information for transparent video or transparent sequence frame animation. The file encoding module 31 is configured to: aiming at each sub-file in the plurality of sub-files, converting the current sub-file into a coded file in a preset format; wherein, the preset format supports the preservation of transparent information of the video file.
Further, the device further comprises an information writing module for: after a video file is acquired and divided into a plurality of subfiles, coordinate information corresponding to the subfiles is written into a preset animation file; wherein the coordinate information includes: position coordinates of the target position in the subfile, and size information of the video area contained in the subfile.
Further, the device further comprises a file storage module for: after the step of respectively encoding the plurality of subfiles to obtain a plurality of encoded files, writing the plurality of encoded files into the animation file; the coding files in the animation files are stored in association with the coordinate information of the subfiles corresponding to the coding files.
In a specific implementation, the encoded file in the animation file is divided into a plurality of fixed-size data blocks.
Further, the file decoding module 32 is configured to: reading target data blocks in each of a plurality of encoded files from an animal file; the method comprises the steps of performing parallel decoding on target data blocks in a plurality of coding files by utilizing a plurality of threads to obtain a decoded video corresponding to each target data block; wherein different threads are used to decode different blocks of data; combining the decoded video corresponding to each target data block according to the coordinate information stored in the animation file to obtain the current playing video of the browser; and in response to the target data block not being the last data block in the encoded file, taking the next data block of the target data block in the encoded file as a new target data block, continuing to execute the step of reading the target data block in each of the plurality of encoded files from the driven file until the target data block is the last data block in the encoded file.
The video processing device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiment, and for brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment is not mentioned.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, where the electronic device includes a processor and a memory, where the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the video processing method described above.
Specifically, the specific process of the video processing method may include: acquiring a video file, and dividing the video file into a plurality of subfiles; encoding the plurality of subfiles respectively to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
In the video processing method, the video file is divided into the plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing the plurality of threads during decoding.
In an alternative embodiment, the step of obtaining the video file and dividing the video file into a plurality of subfiles includes: acquiring a video file and determining the size of the video file; determining a segmentation size according to the size and the segmentation number of the video file; the video file is divided into a plurality of subfiles according to the division size.
In an alternative embodiment, the video file includes transparent video or transparent sequence frame animation; the video file comprises transparent information of transparent video or transparent sequence frame animation; the step of encoding the plurality of subfiles to obtain a plurality of encoded files includes: aiming at each sub-file in the plurality of sub-files, converting the current sub-file into a coded file in a preset format; wherein, the preset format supports the preservation of transparent information of the video file.
In an alternative embodiment, after the steps of obtaining the video file and dividing the video file into a plurality of subfiles, the method includes: writing coordinate information corresponding to the plurality of subfiles into a preset animation file; wherein the coordinate information includes: position coordinates of the target position in the subfile, and size information of the video area contained in the subfile.
In an alternative embodiment, after the step of encoding the plurality of subfiles respectively to obtain a plurality of encoded files, the method further includes: writing a plurality of coded files into the animation file; the coding files in the animation files are stored in association with the coordinate information of the subfiles corresponding to the coding files.
In an alternative embodiment, the encoded file in the animation file is divided into a plurality of fixed-size data blocks.
In an alternative embodiment, the above-mentioned method includes reading a plurality of encoded files, and using a plurality of threads to decode the plurality of encoded files in parallel to obtain decoded video corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser, wherein the step comprises the following steps: reading target data blocks in each of a plurality of encoded files from an animal file; the method comprises the steps of performing parallel decoding on target data blocks in a plurality of coding files by utilizing a plurality of threads to obtain a decoded video corresponding to each target data block; wherein different threads are used to decode different blocks of data; combining the decoded video corresponding to each target data block according to the coordinate information stored in the animation file to obtain the current playing video of the browser; and in response to the target data block not being the last data block in the encoded file, taking the next data block of the target data block in the encoded file as a new target data block, continuing to execute the step of reading the target data block in each of the plurality of encoded files from the driven file until the target data block is the last data block in the encoded file.
Further, the electronic device shown in fig. 4 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
The memory 100 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 103 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc. Bus 102 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 4, but not only one bus or type of bus.
The processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 101 or instructions in the form of software. The processor 101 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 100 and the processor 101 reads information in the memory 100 and in combination with its hardware performs the steps of the method of the previous embodiments.
The embodiment of the invention also provides a computer readable storage medium, which stores computer executable instructions that, when being called and executed by a processor, cause the processor to implement the video processing method, and the specific implementation can be referred to the method embodiment and will not be described herein.
Specifically, the specific process of the video processing method may include: acquiring a video file, and dividing the video file into a plurality of subfiles; encoding the plurality of subfiles respectively to obtain a plurality of encoded files; when a video file is played in a browser, reading a plurality of encoded files, and decoding the encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser; wherein different threads are used to decode different encoded files.
In the video processing method, the video file is divided into the plurality of subfiles, the subfiles are respectively encoded to obtain the encoded file, and then the encoded files corresponding to the subfiles are simultaneously decoded by utilizing the plurality of threads during decoding.
In an alternative embodiment, the step of obtaining the video file and dividing the video file into a plurality of subfiles includes: acquiring a video file and determining the size of the video file; determining a segmentation size according to the size and the segmentation number of the video file; the video file is divided into a plurality of subfiles according to the division size.
In an alternative embodiment, the video file includes transparent video or transparent sequence frame animation; the video file comprises transparent information of transparent video or transparent sequence frame animation; the step of encoding the plurality of subfiles to obtain a plurality of encoded files includes: aiming at each sub-file in the plurality of sub-files, converting the current sub-file into a coded file in a preset format; wherein, the preset format supports the preservation of transparent information of the video file.
In an alternative embodiment, after the steps of obtaining the video file and dividing the video file into a plurality of subfiles, the method includes: writing coordinate information corresponding to the plurality of subfiles into a preset animation file; wherein the coordinate information includes: position coordinates of the target position in the subfile, and size information of the video area contained in the subfile.
In an alternative embodiment, after the step of encoding the plurality of subfiles respectively to obtain a plurality of encoded files, the method further includes: writing a plurality of coded files into the animation file; the coding files in the animation files are stored in association with the coordinate information of the subfiles corresponding to the coding files.
In an alternative embodiment, the encoded file in the animation file is divided into a plurality of fixed-size data blocks.
In an alternative embodiment, the above-mentioned method includes reading a plurality of encoded files, and using a plurality of threads to decode the plurality of encoded files in parallel to obtain decoded video corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser, wherein the step comprises the following steps: reading target data blocks in each of a plurality of encoded files from an animal file; the method comprises the steps of performing parallel decoding on target data blocks in a plurality of coding files by utilizing a plurality of threads to obtain a decoded video corresponding to each target data block; wherein different threads are used to decode different blocks of data; combining the decoded video corresponding to each target data block according to the coordinate information stored in the animation file to obtain the current playing video of the browser; and in response to the target data block not being the last data block in the encoded file, taking the next data block of the target data block in the encoded file as a new target data block, continuing to execute the step of reading the target data block in each of the plurality of encoded files from the driven file until the target data block is the last data block in the encoded file.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of video processing, the method comprising:
acquiring a video file and dividing the video file into a plurality of subfiles;
encoding the plurality of subfiles respectively to obtain a plurality of encoded files;
when the video file is played in a browser, reading the plurality of encoded files, and decoding the plurality of encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain a current playing video of the browser; wherein different threads are used to decode different ones of the encoded files.
2. The method of claim 1, wherein the step of obtaining a video file and dividing the video file into a plurality of subfiles comprises:
acquiring a video file and determining the size of the video file;
determining a segmentation size according to the size and the segmentation number of the video file;
and dividing the video file into a plurality of subfiles according to the dividing size.
3. The method of claim 1, wherein the video file includes transparent video or transparent sequence frame animation therein; the video file comprises transparent information of the transparent video or the transparent sequence frame animation; the step of encoding the plurality of subfiles to obtain a plurality of encoded files respectively includes:
converting the current subfile into a coding file in a preset format aiming at each subfile in the plurality of subfiles; wherein, the preset format supports the reservation of transparent information of the video file.
4. The method of claim 1, wherein after the step of obtaining a video file and dividing the video file into a plurality of subfiles, the method comprises:
writing the coordinate information corresponding to the plurality of subfiles into a preset animation file; wherein the coordinate information includes: and the position coordinates of the target position in the subfile and the size information of the video area contained in the subfile.
5. The method of claim 4, wherein after the step of encoding the plurality of subfiles, respectively, to obtain a plurality of encoded files, the method further comprises:
writing the plurality of encoded files into the animation file; and the coded file in the animation file is stored in association with the coordinate information of the subfiles corresponding to the coded file.
6. The method of claim 5, wherein the encoded file in the animation file is divided into a plurality of fixed-size data blocks.
7. The method of claim 6, wherein the reading the plurality of encoded files and decoding the plurality of encoded files in parallel using a plurality of threads results in decoded video corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain the current playing video of the browser, wherein the step comprises the following steps:
reading target data blocks in each of the plurality of encoded files from the animation file;
the target data blocks in the plurality of coding files are decoded in parallel by utilizing a plurality of threads, and decoding video corresponding to each target data block is obtained; wherein different threads are used to decode different blocks of data;
combining the decoded video corresponding to each target data block according to the coordinate information stored in the animation file to obtain the current playing video of the browser;
and in response to the target data block not being the last data block in the encoded file, taking the next data block of the target data block in the encoded file as a new target data block, continuing to execute the step of reading the target data block in each of the plurality of encoded files from the animation file until the target data block is the last data block in the encoded file.
8. A video processing apparatus, the apparatus comprising:
the file segmentation module is used for acquiring a video file and segmenting the video file into a plurality of subfiles;
the file coding module is used for respectively coding the plurality of subfiles to obtain a plurality of coded files;
the file decoding module is used for reading the plurality of encoded files when the video files are played in the browser, and decoding the plurality of encoded files in parallel by utilizing a plurality of threads to obtain decoded videos corresponding to the plurality of encoded files; combining the decoded videos corresponding to the plurality of encoded files to obtain a current playing video of the browser; wherein different threads are used to decode different ones of the encoded files.
9. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the video processing method of any one of claims 1 to 7.
10. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the video processing method of any one of claims 1 to 7.
CN202311507434.6A 2023-11-13 2023-11-13 Video processing method and device and electronic equipment Pending CN117857811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311507434.6A CN117857811A (en) 2023-11-13 2023-11-13 Video processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311507434.6A CN117857811A (en) 2023-11-13 2023-11-13 Video processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117857811A true CN117857811A (en) 2024-04-09

Family

ID=90546543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311507434.6A Pending CN117857811A (en) 2023-11-13 2023-11-13 Video processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117857811A (en)

Similar Documents

Publication Publication Date Title
CN107886560B (en) Animation resource processing method and device
JP7165272B2 (en) Video data encoding/decoding method, device, program and computer device
US20190246117A1 (en) Encoding data arrays
CN113709554A (en) Animation video generation method and device, and animation video playing method and device in live broadcast room
CN115134629A (en) Video transmission method, system, device and storage medium
JP7067655B2 (en) Image coding equipment, image decoding equipment, and image processing equipment
CN117857811A (en) Video processing method and device and electronic equipment
CN112714338A (en) Video transmission method, video playing method, video transmission device, video playing device, computer equipment and storage medium
US20230209052A1 (en) Systems and methods for block division in video processing
CN102768755B (en) Obtain the method and apparatus of the thumbnail of picture
WO2023083213A1 (en) Data decoding method and apparatus, electronic device and readable storage medium
JP2017192080A (en) Image compression device, image decoding device, image compression method, and image compression program
CN106293542B (en) Method and device for decompressing file
CN110933418B (en) Video data processing method, device, medium and apparatus
US9307259B2 (en) Image decoding methods and image decoding devices
US10277912B2 (en) Methods and apparatus for storing data related to video decoding
CN112367521A (en) Display screen content sharing method and device, computer equipment and storage medium
CN117763251A (en) Animation playing method and device in webpage and electronic equipment
CN111338740A (en) Page element display method and device and electronic equipment
US11539980B1 (en) Image slice transforming method and electronic device
US11968374B2 (en) Method and device for coding and decoding
CN117579875B (en) Video high-speed playback method, device, server and computer readable storage medium
TW201907714A (en) Image transcoding method, computational apparatus, and storage medium
CN113422963B (en) Video decoding method and decoder
US10582207B2 (en) Video processing systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination