Coding method, decoding method, coding and decoding device and medium

By merging audio frames and video frames and then encoding, the complex problems of video file transmission and decoding in the existing technology are solved, and simplified data stream transmission and decoding processes without time synchronization are achieved.

CN114025196BActive Publication Date: 2024-08-27MIGU CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111179290.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-09
Publication Date
2024-08-27
Estimated Expiration
2041-10-09

AI Technical Summary

Technical Problem

Existing audio and video encoding methods make the video file transmission and decoding process complicated, requiring audio and video data streams to be processed separately and requiring time synchronization.

Method used

By acquiring video frames and audio pulse coding modulation data, merging them into data frames, and encoding the data frames, the combined encoding of audio frames and video frames is achieved. Only one data stream is required for transmission, and no time synchronization is required during decoding.

Benefits of technology

It simplifies the video file transmission and decoding process, reduces business complexity, and avoids split transmission and time synchronization processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114025196B
    Figure CN114025196B
Patent Text Reader

Abstract

The present invention discloses an encoding method, a decoding method, an encoding and decoding device and a medium. The encoding method comprises: obtaining a video frame and audio pulse code modulation data corresponding to the video frame; merging the video frame and the audio pulse code modulation data to obtain a data frame; and encoding the data frame. The present invention aims to solve the problem that the subsequent video file transmission and decoding process are complicated due to the existing audio and video encoding method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of coding and decoding technology, and in particular to a coding method, a decoding method, a coding and decoding device and a medium. Background Art

[0002] In order to meet the needs of storage, people have set different video file formats (also called video packaging formats) to realize the packaging of video data and audio data in one file based on the video file format, so as to facilitate the simultaneous playback of video and audio. Such files are called video files.

[0003] Video file format is a specification for packaging video data and audio data into one file. Common video file formats are generally represented by different suffixes, such as: avi, rmvb, mp4, flv, mkv, etc.

[0004] The audio data and video data encapsulated in the video file are all compressed and encoded data. At present, different compression encoding technologies are often used to compress and encode audio data and video data respectively - for example, H265 or AVC (Advanced Video Coding) compression encoding technology is used to compress and encode video data, and ACC (Advanced Audio Coding) is used to compress and encode audio data - the compressed and encoded audio data and video data are encapsulated according to a certain video file format to generate a video file for storage.

[0005] The above encoding method causes the subsequent video file transmission and video file decoding to have complicated implementation process, which is manifested in the following aspects:

[0006] For video file transmission, please refer to Figure 1 Since audio data and video data are encoded and decoded separately and belong to different data streams, during the transmission of video files, the audio data and video data that are combined in the video file need to be separated and transmitted first, and then combined and packaged after the transmission is completed. This makes the business complexity of video file transmission high.

[0007] For decoding of video files, please refer to Figure 2 Since audio data and video data are different streams, the encoded audio data and video data need to be decoded separately during video decoding; at the same time, the audio data and video data need to be synchronized during playback and retrieval to ensure the unity of the audio data and video data in the time domain. This makes the business complexity of video file decoding also high. Summary of the invention

[0008] The main purpose of the present invention is to provide an encoding method, a decoding method, an encoding and decoding device and a medium, aiming to solve the problem of complicated subsequent video file transmission and decoding process caused by existing audio and video encoding methods.

[0009] To achieve the above object, the present invention provides a coding method, the coding method comprising:

[0010] Acquire video frames and audio pulse code modulation data corresponding to the video frames;

[0011] Merging the video frame and the audio pulse code modulation data to obtain a data frame;

[0012] The data frame is encoded.

[0013] In one embodiment, the step of combining the video frame and the audio pulse code modulation data to obtain a data frame includes:

[0014] Obtaining video parameters reflecting the size and format of the video frame;

[0015] Acquiring audio parameters reflecting the size and format of the audio pulse code modulation data;

[0016] Generate an information header according to the video parameters and the audio parameters, wherein the information header is used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame;

[0017] The video frame, the audio pulse code modulation data and the information header are spliced ​​in a preset format to obtain the data frame.

[0018] In one embodiment, after the step of encoding the data frame, the method further includes:

[0019] Obtaining playback timestamps of the plurality of encoded data frames;

[0020] splicing the plurality of encoded data frames in time sequence according to the playback timestamp to obtain a video file;

[0021] A preset number of data frames in the video file are set as key frames, wherein the number of the key frames is less than the number of the data frames.

[0022] In one embodiment, the step of encoding the data frame includes:

[0023] Obtaining a preset encoding algorithm, where the preset encoding algorithm includes at least one video encoding algorithm and one audio encoding algorithm;

[0024] The data frame is encoded using the preset encoding algorithm.

[0025] To achieve the above object, the present invention further provides a decoding method, the decoding method comprising:

[0026] Get the encoded data frame;

[0027] Decoding the encoded data frame;

[0028] The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the decoded data frame.

[0029] In one embodiment, the step of determining the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame includes:

[0030] Obtaining the decoded information header of the data frame;

[0031] The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the information header.

[0032] In one embodiment, the step of obtaining the encoded data frame includes:

[0033] Get the video file;

[0034] Obtaining the playback timestamp of each data frame in the video file;

[0035] The data frames are sequentially used as encoded data frames according to the playback timestamp.

[0036] In addition, to achieve the above object, the present invention further provides a coding and decoding device, the coding and decoding device includes a first acquisition module, a merging module and a coding module, wherein:

[0037] The first acquisition module is used to acquire video frames and audio pulse code modulation data corresponding to the video frames;

[0038] The merging module is used to merge the video frame and the audio pulse code modulation data to obtain a data frame;

[0039] The encoding module is used to encode the data frame; or,

[0040] The encoding and decoding device includes a second acquisition module, a decoding module and a determination module, wherein:

[0041] The second acquisition module is used to acquire the encoded data frame;

[0042] The decoding module is used to decode the encoded data frame;

[0043] The determination module is used to determine the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame.

[0044] In addition, to achieve the above-mentioned purpose, the present invention also provides a coding and decoding device, which includes a memory, a processor, and a coding and decoding program stored in the memory and executable on the processor, and when the coding and decoding program is executed by the processor, the steps of any one of the encoding methods or decoding methods described above are implemented.

[0045] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium, on which a coding and decoding program is stored, and when the coding and decoding program is executed by a processor, the steps of any of the above-mentioned encoding methods or decoding methods are implemented.

[0046] The present invention proposes an encoding method, a decoding method, an encoding and decoding device and a medium, which obtains a video frame and audio pulse code modulation data corresponding to the video frame, merges the video frame and the audio pulse code modulation data to obtain a data frame, and encodes the data frame. This solution merges the audio frame and the video frame into a data frame and then encodes it, without the need to encode the audio frame and the video frame separately. The subsequent video file only needs to be transmitted through one data stream instead of through a split stream transmission, and the audio frame and the video frame of the merged data frame are synchronized in time, so there is no need to perform a time synchronization processing operation after the video file is decoded, thereby solving the problem of the complicated subsequent video file transmission and decoding process caused by the existing audio and video encoding method. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is a first schematic diagram of an encoding process involved in an embodiment of the present invention;

[0048] Figure 2 is a first schematic diagram of a decoding process involved in an embodiment of the present invention;

[0049] Figure 3 Schematic diagram of the hardware architecture of the encoding and decoding device involved in the embodiment of the present invention;

[0050] Figure 4 is a schematic flow chart of a first embodiment of an encoding method of the present invention;

[0051] Figure 5 is a schematic flow chart of a second embodiment of the encoding method of the present invention;

[0052] Figure 6is a flowchart of a first embodiment of a decoding method of the present invention;

[0053] Figure 7 is a second schematic diagram of the encoding process involved in the embodiment of the present invention;

[0054] Figure 8 is a schematic diagram of a data frame involved in an embodiment of the present invention;

[0055] Fig. 9 is a second schematic diagram of a decoding process involved in an embodiment of the present invention;

[0056] Fig.10 It is a schematic diagram of the module structure of the encoding and decoding device involved in the embodiment of the present invention.

[0057] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0058] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0059] As an implementation, please refer to Figure 3 , Figure 3 Schematic diagram of the hardware architecture of the encoding and decoding device involved in the embodiment of the present invention. Figure 3 As shown, the coding and decoding device may include a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to realize connection and communication between these components.

[0060] The memory 102 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Figure 3 As shown, the memory 102 as a computer-readable storage medium may include a codec program; and the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0061] Acquire video frames and audio pulse code modulation data corresponding to the video frames;

[0062] Merging the video frame and the audio pulse code modulation data to obtain a data frame;

[0063] The data frame is encoded.

[0064] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0065] Obtaining video parameters reflecting the size and format of the video frame;

[0066] Acquiring audio parameters reflecting the size and format of the audio pulse code modulation data;

[0067] Generate an information header according to the video parameters and the audio parameters, wherein the information header is used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame;

[0068] The video frame, the audio pulse code modulation data and the information header are spliced ​​in a preset format to obtain the data frame.

[0069] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0070] Obtaining playback timestamps of the plurality of encoded data frames;

[0071] splicing the plurality of encoded data frames in time sequence according to the playback timestamp to obtain a video file;

[0072] A preset number of data frames in the video file are set as key frames, wherein the number of the key frames is less than the number of the data frames.

[0073] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0074] Obtaining a preset encoding algorithm, where the preset encoding algorithm includes at least one video encoding algorithm and one audio encoding algorithm;

[0075] The data frame is encoded using the preset encoding algorithm.

[0076] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0077] Get the encoded data frame;

[0078] Decoding the encoded data frame;

[0079] The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the decoded data frame.

[0080] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0081] Obtaining the decoded information header of the data frame;

[0082] The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the information header.

[0083] In one embodiment, the processor 101 may be used to call the codec program stored in the memory 102 and perform the following operations:

[0084] Get the video file;

[0085] Obtaining the playback timestamp of each data frame in the video file;

[0086] The data frames are sequentially used as encoded data frames according to the playback timestamp.

[0087] Based on the hardware architecture of the above encoding and decoding device, embodiments of the encoding method and the decoding method of the present invention are proposed.

[0088] Please refer to Figure 4 , Figure 4 : is a schematic flow chart of a first embodiment of an encoding method of the present invention, the encoding method comprising:

[0089] Step S10, obtaining a video frame and audio pulse code modulation data corresponding to the video frame;

[0090] In this embodiment, the executor of the data processing method is a codec device, wherein the codec device refers to a device that can encode and decode audio and video data. Optionally, the codec device can be a server or a terminal device. Of course, in other embodiments, the codec device can also be other devices that can encode and decode audio and video data, and this embodiment does not limit this.

[0091] The encoding and decoding device obtains a video frame and audio pulse code modulation data corresponding to the video frame, wherein the video frame refers to a single frame of video data collected by the data acquisition end, and optionally, the video data collected by the acquisition end may be RGB data or YUV data, for example, the video frame may be RGB data or YUV data with a playback duration of 25 milliseconds. It should be noted that the playback duration of the video frame may be determined according to the sampling rate of the video collected by the data acquisition end, and this embodiment does not limit this; the audio pulse code modulation data refers to the audio data collected by the data acquisition end, and optionally, the audio data may be PCM data, for example, the audio pulse code modulation data may be PCM data with a playback duration of 25 milliseconds, and the playback duration of the audio pulse code modulation data is the same as the playback duration of the video frame, that is, the video frame and the audio pulse code modulation data are synchronized in time, and the video frame and the audio pulse code modulation data have a one-to-one correspondence.

[0092] Optionally, the data acquisition end acquires video data and audio data corresponding to the video data, and determines the audio pulse code modulation data corresponding to each video frame in the video data in the audio data according to the sampling information of the video data and the audio data. After the data acquisition end acquires the audio data and the video data, the audio data and the video data are grouped and merged according to the sampling information of the audio data and the video data, so that the time range of the video frame and the corresponding audio pulse code modulation data is consistent. Optionally, the sampling information can be the sampling rate, number of channels and sampling format of the video data and the audio data. For example, the sampling rate of the high-definition audio data sampled by the data acquisition end is 48000HZ, dual-channel number, and the sampling format is 16 bytes. The sampling rate of the high-definition video data sampled by the data acquisition end is 40PFS. According to the sampling information of the audio data, the size of the audio data corresponding to one second of video can be calculated by sampling rate*number of channels*sampling format / 8, which is 192KB. According to the sampling rate of the video data, it can be known that the playback duration of one frame of video is 25 milliseconds, so the audio size corresponding to one frame of video is 4.8KB. The video frame and the audio pulse code modulation data corresponding to the video frame can be determined in the above manner.

[0093] After acquiring the video frame and the audio pulse code modulation data corresponding to the video frame, the data acquisition end sends the video frame and the audio pulse code modulation data corresponding to the video frame to the codec device, and the codec device receives the video frame and the audio pulse code modulation data corresponding to the video frame sent by the data acquisition end.

[0094] Step S20, merging the video frame and the audio pulse code modulation data to obtain a data frame;

[0095] Step S30: encode the data frame.

[0096] In this embodiment, please refer to Figure 7 , Figure 7 2 is a second schematic diagram of the encoding process involved in the embodiment of the present invention. Figure 7 As shown, after acquiring the video frame and the audio pulse code modulation data corresponding to the video frame, the encoding and decoding device merges the video frame with the audio pulse code modulation data corresponding to the video frame to obtain a data frame, and then encodes the merged data frame through the encoder to obtain an encoded data frame. The merging means that the video frame and the audio pulse code modulation data corresponding to the video frame are combined into a whole.

[0097] Optionally, after the codec device combines the acquired video frame and the audio pulse code modulation data corresponding to the video frame to obtain a data frame, it obtains a preset coding algorithm, the preset coding algorithm includes at least one video coding algorithm and one audio coding algorithm, and uses the preset coding algorithm to encode the data frame. Specifically, after the codec device obtains the data frame, it encodes the data frame, and the codec device can use the encoder to encode the data frame using the preset coding algorithm to obtain the encoded data frame. It should be noted that the encoder can use different coding algorithms to encode the audio pulse code modulation data and the video frame in the data frame to obtain the encoded data frame. For example, the encoder can use the MP4 coding algorithm or the AVC (Advanced Video Coding) coding algorithm to encode the video frame in the data frame, and use the ACC (Advanced Audio Coding) coding algorithm to encode the audio pulse code modulation data in the data frame. The encoder can also use the same coding algorithm to encode the audio pulse code modulation data and the video frame in the data frame to obtain the encoded data frame.

[0098] Optionally, after acquiring the encoded data frames, the encoding and decoding device may splice multiple encoded data frames in sequence to obtain a video file.

[0099] Optionally, the codec device may obtain the playback timestamps of multiple encoded data frames, and splice the multiple encoded data frames in chronological order according to the playback timestamps to obtain a video file. The playback timestamp refers to the playback time of the data frame, and the codec device may splice the obtained multiple encoded data frames in chronological order according to the playback timestamps to obtain a video file.

[0100] Optionally, after acquiring the video file, the codec device may set a preset number of data frames in the video file as key frames, wherein the number of key frames in the video file is less than the number of data frames in the video file. After setting the key frames, the codec device may store the video file in a storage module of the codec device, or send the video file to other devices for storage.

[0101] Optionally, after acquiring the encoded data frame, the encoding and decoding device may directly decode and play the encoded data frame, or may send the encoded data frame to the playback device for the playback device to decode and play.

[0102] In the technical solution provided by this embodiment, by acquiring the video frame and the audio pulse code modulation data corresponding to the video frame, merging the video frame and the audio pulse code modulation data to obtain the data frame, the data frame is encoded. This solution does not need to encode the audio frame and the video frame separately by merging the audio frame and the video frame into the data frame and then encoding. The subsequent video file transmission only needs to be transmitted through one data stream instead of through a split stream transmission. The audio frame and the video frame of the merged data frame are synchronized in time, and the video file decoding does not need to perform time synchronization processing operations, thereby solving the problem of the complicated subsequent video file transmission and decoding process caused by the existing audio and video encoding method.

[0103] Please refer to Figure 5 , Figure 5 is a flow chart of a second embodiment of the encoding method of the present invention. Based on the first embodiment, the step S20 includes:

[0104] Step S21, obtaining video parameters reflecting the size and format of the video frame;

[0105] Step S22, obtaining audio parameters reflecting the size and format of the audio pulse code modulation data;

[0106] In this embodiment, after the codec device obtains the video frame and the audio pulse code modulation data corresponding to the video frame, it obtains the video parameters reflecting the size and format of the video frame and the audio parameters reflecting the size and format of the audio pulse code modulation data. Optionally, the audio parameters may include but are not limited to information such as the number of bytes of the audio pulse code modulation data, and the video parameters may include but are not limited to information such as the number of bytes of the video frame. The audio parameters and the video parameters can achieve a one-to-one correspondence between the audio pulse code modulation data and the video frame.

[0107] Step S23, generating an information header according to the video parameters and the audio parameters, wherein the information header is used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame;

[0108] Step S24, splicing the video frame, audio pulse code modulation data and information header according to a preset format to obtain the data frame.

[0109] In this embodiment, after the encoding and decoding device obtains the audio parameters and video parameters, it generates an information header according to the audio parameters and video parameters, and splices the video frame, audio frame and information header according to a preset format to obtain a data frame. The information header is used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame.

[0110] For details, please refer to Figure 8 , Figure 8is a schematic diagram of a data frame involved in an embodiment of the present invention, such as Figure 8 As shown, the encoding and decoding device can splice the acquired information header, audio frame and video frame in the format of "information header-video frame-audio pulse code modulation data" to obtain a data frame. In other embodiments, the preset format can be set according to actual needs. For example, the preset format can also be "video frame-audio pulse code modulation data-information header", which is not limited in this embodiment.

[0111] In the technical solution provided by this embodiment, by obtaining the video parameters of the video frame and the audio parameters of the audio pulse code modulation data, an information header is generated according to the video parameters and the audio parameters. The video frame, the audio pulse code modulation data and the information header are spliced ​​in a preset format to obtain a data frame. This solution merges the video frame and the audio pulse code modulation data before encoding to obtain a data frame, thereby ensuring the time synchronization of the video frame and the audio pulse code modulation data, and then directly encoding the data frame without encoding the video frame and the audio pulse code modulation data separately, thereby reducing the business complexity of audio and video data processing.

[0112] Please refer to Figure 6 , Figure 6 : is a flowchart of a first embodiment of a decoding method of the present invention, the decoding method comprising:

[0113] Step S40, obtaining the encoded data frame;

[0114] In this embodiment, the encoding and decoding device obtains the encoded data frame to decode the encoded data frame.

[0115] Optionally, the encoding and decoding device may obtain a video file and obtain a play timestamp of each data frame in the video file, and use each data frame as an encoded data frame in sequence according to the play timestamp.

[0116] Optionally, the encoding and decoding device can obtain the video file by streaming or reading, and then obtain the playback timestamp of each data frame in the video file, and use the playback timestamps of each data frame in sequence as the encoded data frames.

[0117] Optionally, the codec device can obtain a target key frame in a video file. Specifically, when the codec device receives a search instruction, it determines the playback timestamp of the data frame to be searched according to the search instruction, and then obtains the playback timestamp of the key frame in the video file, and determines the key frame closest to the playback timestamp of the data frame to be searched as the target key frame. After the codec device obtains the target key frame, it obtains the playback timestamps of all data frames in the video file, determines the data frame whose playback timestamp is after the playback timestamp of the target key frame as the data frame to be decoded, and uses each data frame to be decoded as the encoded data frame in sequence according to the sequence of the playback timestamps of the data frame to be decoded. This embodiment obtains the target key frame in the video file, determines the data frame to be decoded according to the playback timestamp of the target key frame, and uses each data frame to be decoded as the encoded data frame in sequence according to the playback timestamp of the data frame to be decoded. After this solution searches for the target key frame during the data frame search, it can be directly decoded and played because the target key frame already contains audio pulse code modulation data and video frames, and the synchronization of audio and video is guaranteed. When searching, as long as the key frame is searched, it can be directly decoded and played. There is no need to obtain the audio and video and synchronization business logic separately, which reduces the business complexity of the video search function.

[0118] Step S50, decoding the encoded data frame;

[0119] Step S60: determining the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame.

[0120] In this embodiment, please refer to Fig. 9 , Fig. 9 FIG. 2 is a second schematic diagram of a decoding process involved in an embodiment of the present invention. Fig. 9 As shown, after acquiring the encoded data frame, the encoding and decoding device decodes the encoded data frame through a decoder to obtain a video frame and audio pulse code modulation data.

[0121] Optionally, the encoding and decoding device can decode the data frame by a decoder using a decoding algorithm to obtain a decoded data frame. It should be noted that the decoder can use different decoding algorithms to decode the audio part and the video part in the data frame respectively to obtain a decoded data frame. For example, the decoder can use the decoding algorithm corresponding to the MP4 encoding algorithm or the AVC encoding algorithm to decode the video part in the data frame, and use the decoding algorithm corresponding to the ACC encoding algorithm to decode the audio part in the data frame. The decoder can also use the same decoding algorithm to decode the data frame as a whole to obtain a decoded data frame. After obtaining the decoded data frame, the encoding and decoding device determines the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame.

[0122] Optionally, the encoding and decoding device may obtain an information header of the decoded data frame, and determine the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the information header.

[0123] Optionally, after the encoding and decoding device obtains the audio pulse code modulation data and the video frame of the data frame, it plays the video frame and the audio pulse code modulation data simultaneously.

[0124] In the technical solution provided by this embodiment, the encoded data frame is obtained, the encoded data frame is decoded, and the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the decoded data frame. This solution obtains the video frame and the audio pulse code modulation data by decoding the data frame. The decoded audio pulse code modulation data and the video frame are synchronized in time. Therefore, when playing the decoded audio pulse code modulation data and video frame, there is no need to specially design a solution to solve the problem of audio and video synchronization. It is only necessary to play the decoded audio pulse code modulation data and video frame at the same time to ensure the synchronization of the audio pulse code modulation data and the video frame in time during playback, thereby reducing the business complexity of audio and video data processing.

[0125] Reference Fig.10 The present invention also provides a coding and decoding device, which includes a first acquisition module 100, a merging module 200 and a coding module 300, wherein:

[0126] The first acquisition module 100 is used to acquire video frames and audio pulse code modulation data corresponding to the video frames;

[0127] The merging module 200 is used to merge the video frame and the audio pulse code modulation data to obtain a data frame;

[0128] The encoding module 300 is used to encode the data frame; or,

[0129] The encoding and decoding device includes a second acquisition module 400, a decoding module 500 and a determination module 600, wherein:

[0130] The second acquisition module 400 is used to acquire the encoded data frame;

[0131] The decoding module 500 is used to decode the encoded data frame;

[0132] The determination module 600 is used to determine the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame.

[0133] Based on the above embodiments, the present invention also provides a coding and decoding device, which may include a memory, a processor, and a coding and decoding program stored in the memory and executable on the processor. When the processor executes the coding and decoding program, it implements the steps of the encoding method or decoding method described in any of the above embodiments.

[0134] Based on the above embodiments, the present invention further provides a computer-readable storage medium on which a coding and decoding program is stored. When the coding and decoding program is executed by a processor, the steps of the coding method or the decoding method described in any of the above embodiments are implemented.

[0135] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0136] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0137] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a smart TV, mobile phone, computer, etc.) to execute the methods described in each embodiment of the present invention.

[0138] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A coding method, characterized in that: The encoding method comprises: Acquire video frames and audio pulse code modulation data corresponding to the video frames, wherein a data acquisition end acquires video data and audio data corresponding to the video data, determines audio pulse code modulation data corresponding to each video frame in the video data in the audio data according to sampling information of the video data and the audio data, and groups the audio data and the video data according to the sampling information of the audio data and the video data so that the time range of the video frame and the corresponding audio pulse code modulation data is consistent, and the sampling information includes sampling rate, number of channels and sampling format of the video data and the audio data; Merging the video frame and the audio pulse code modulation data to obtain a data frame, including: obtaining video parameters reflecting the size and format of the video frame; obtaining audio parameters reflecting the size and format of the audio pulse code modulation data; generating an information header according to the video parameters and the audio parameters, the information header being used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame; splicing the video frame, the audio pulse code modulation data and the information header according to a preset format to obtain the data frame, so as to ensure that the video frame is synchronized with the audio pulse code modulation data in time; Encoding the data frame includes: encoding the audio pulse modulation data and the video frame in the data frame using the same encoding algorithm.

2. The encoding method according to claim 1, characterized in that After the step of encoding the data frame, the method further comprises: Obtaining playback timestamps of the plurality of encoded data frames; splicing the plurality of encoded data frames in time sequence according to the playback timestamp to obtain a video file; A preset number of data frames in the video file are set as key frames, wherein the number of the key frames is less than the number of the data frames.

3. A decoding method, characterized in that: The decoding method comprises: Obtaining an encoded data frame, wherein the data frame is generated by the encoding method according to claim 1 or 2; Decoding the encoded data frame; The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the decoded data frame.

4. The decoding method according to claim 3, characterized in that: The step of determining the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame comprises: Obtaining the decoded information header of the data frame; The video frame included in the data frame and the audio pulse code modulation data corresponding to the video frame are determined according to the information header.

5. The decoding method according to claim 3, characterized in that: The step of obtaining the encoded data frame comprises: Get the video file; Obtaining the playback timestamp of each data frame in the video file; The data frames are sequentially used as encoded data frames according to the playback timestamp.

6. A coding and decoding device, characterized in that: The encoding and decoding device includes a first acquisition module, a merging module and a coding module, wherein: The first acquisition module is used to acquire video frames and audio pulse code modulation data corresponding to the video frames, wherein the data acquisition end acquires video data and audio data corresponding to the video data, determines the audio pulse code modulation data corresponding to each video frame in the video data in the audio data according to sampling information of the video data and the audio data, and groups the audio data and the video data according to the sampling information of the audio data and the video data so that the time range of the video frame and the corresponding audio pulse code modulation data is consistent, and the sampling information includes the sampling rate, number of channels and sampling format of the video data and the audio data; The merging module is used to merge the video frame and the audio pulse code modulation data to obtain a data frame, including: obtaining a video parameter reflecting the size and format of the video frame; obtaining an audio parameter reflecting the size and format of the audio pulse code modulation data; generating an information header according to the video parameter and the audio parameter, the information header being used to distinguish the video frame in the data frame and the audio pulse code modulation data corresponding to the video frame; splicing the video frame, the audio pulse code modulation data and the information header according to a preset format to obtain the data frame, so as to ensure that the video frame is synchronized with the audio pulse code modulation data in time; The encoding module is used to encode the data frame, including: using the same encoding algorithm to encode the audio pulse modulation data and the video frame in the data frame; The encoding and decoding device includes a second acquisition module, a decoding module and a determination module, wherein: The second acquisition module is used to acquire the encoded data frame; The decoding module is used to decode the encoded data frame; The determination module is used to determine the video frame contained in the data frame and the audio pulse code modulation data corresponding to the video frame according to the decoded data frame.

7. A coding and decoding device, characterized in that: The coding and decoding device includes a memory, a processor, and a coding and decoding program stored in the memory and executable on the processor. When the coding and decoding program is executed by the processor, the steps of the encoding method according to any one of claims 1 to 2 or the decoding method according to any one of claims 3 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a coding and decoding program, which, when executed by a processor, implements the steps of the coding method according to any one of claims 1 to 2 or the decoding method according to any one of claims 3 to 5.