A video stream protocol conversion method, system, terminal and storage medium

Through the video stream protocol conversion method, the problem of mismatch in the video stream format or protocol in the browser is solved, and the normal playback of the video stream on multiple devices and browsers is realized. Video is transferred through reading, decoding, conversion and packaging processing. Streams are converted to multiple formats.

CN118695031BActive Publication Date: 2024-12-06深圳开鸿数字产业发展有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411171658.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-06
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

In the prior art, video streams cannot be played normally due to mismatch in formats or protocols when playing in a browser.

Method used

Through video stream protocol conversion methods, including video stream reading, decoding, protocol conversion and encapsulation processing, the target video stream is converted into multiple formats to match the requirements of different players and browsers.

Benefits of technology

Multi-format conversion of video streams of any protocol is realized, ensuring that the video stream can be played normally on multiple players and browsers, and supporting the playback of video streams on multiple devices or browsers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118695031B_ABST
    Figure CN118695031B_ABST
Patent Text Reader

Abstract

The present invention discloses a video stream protocol conversion method, system, terminal and storage medium, the method comprising: determining a target video stream, and performing video stream reading processing on the target video stream to obtain multiple video stream unit packets; decoding processing on multiple video stream unit packets to obtain multiple video stream basic data; performing protocol conversion processing on multiple video stream basic data to obtain multiple converted compressed video streams; encapsulating processing on multiple converted compressed video streams to obtain multiple encapsulated video streams, determining a target encapsulated video stream in the multiple encapsulated video streams, and playing the target encapsulated video stream. The present invention can convert a video stream of any protocol into multiple encapsulation formats by performing video stream reading, decoding processing, protocol conversion and encapsulation processing on the target video stream, thereby realizing normal playback of any video on multiple players and browsers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video stream processing, and in particular to a video stream protocol conversion method, system, terminal and computer-readable storage medium. Background Art

[0002] Traditional video streaming is played according to the video streaming protocol provided by the video device itself, such as the RTSP protocol (Real Time Streaming Protocol) or the RTMP protocol (Real Time Messaging Protocol), and can only be played through a corresponding protocol player, such as VLC player (cross-platform multimedia player).

[0003] However, in current technology, when a video stream needs to be played in a browser, different browsers have different corresponding playback conditions, and the video stream cannot be played because it does not match the format or data stream protocol corresponding to each browser.

[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0005] The main purpose of the present invention is to provide a video stream protocol conversion method, system, terminal and computer-readable storage medium, aiming to solve the problem in the prior art that when a video stream needs to be played in a browser, the video stream cannot be played normally because the format or data stream protocol corresponding to the video stream and the browser does not match.

[0006] To achieve the above object, the present invention provides a video stream protocol conversion method, the video stream protocol conversion method comprising the following steps:

[0007] Determine a target video stream, and perform video stream reading processing on the target video stream to obtain a plurality of video stream unit packets;

[0008] Decoding the plurality of video stream unit packets to obtain a plurality of video stream basic data;

[0009] Performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams;

[0010] The plurality of converted compressed video streams are encapsulated to obtain a plurality of encapsulated video streams, a target encapsulated video stream is determined among the plurality of encapsulated video streams, and the target encapsulated video stream is played.

[0011] Optionally, the video stream protocol conversion method, wherein the determining of the target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets, specifically comprises:

[0012] When receiving a video stream playing instruction, determining a target video stream according to the video stream playing instruction, and establishing a connection with the target video stream;

[0013] A video stream protocol corresponding to the target video stream is obtained, and a video stream reading process is performed on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets.

[0014] Optionally, in the video stream protocol conversion method, the video stream protocol includes a first video stream protocol and a second video stream protocol; the video stream unit packet includes a first video stream unit packet and a second video stream unit packet;

[0015] The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets specifically includes:

[0016] Obtaining a video stream protocol corresponding to the target video stream;

[0017] If the video stream protocol corresponding to the target video stream is the first video stream protocol, performing first video stream reading processing on the target video stream according to the first video stream protocol to obtain a plurality of first video stream unit packets;

[0018] If the video stream protocol corresponding to the target video stream is the second video stream protocol, a second video stream reading process is performed on the target video stream according to the second video stream protocol to obtain a plurality of second video stream unit packets.

[0019] Optionally, the video stream protocol conversion method, wherein the step of obtaining the video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol, further comprises:

[0020] During the video stream reading process, detecting the byte output of the target video stream at preset intervals;

[0021] If the target video stream does not output video stream bytes for more than a first preset time, it is determined that the target video stream is in a paused playback state, and the target video stream is paused for reading;

[0022] If the target video stream does not output video stream bytes for more than a second preset time, it is determined that the target video stream is in a stop playing state, and the reading connection with the target video stream is disconnected;

[0023] Wherein, the first preset time is shorter than the second preset time.

[0024] Optionally, the video stream protocol conversion method, wherein the decoding process of the plurality of video stream unit packets to obtain a plurality of video stream basic data, specifically comprises:

[0025] Obtaining a first compression encoding format corresponding to the first video stream protocol, and decoding a plurality of first video stream unit packets according to the first compression encoding format to obtain a plurality of first video stream basic data;

[0026] Or obtain a second compression coding format corresponding to the second video stream protocol, and decode multiple second video stream unit packets according to the second compression coding format to obtain multiple second video stream basic data.

[0027] Optionally, the video stream protocol conversion method, wherein the performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams, specifically comprises:

[0028] Performing encoding processing on the plurality of first video stream basic data to obtain a plurality of first encoded data streams, and performing protocol conversion processing on the plurality of first encoded data streams using a preset protocol conversion tool to obtain a plurality of first converted compressed video streams;

[0029] Or encoding processing is performed on multiple second video stream basic data to obtain multiple second encoded data streams, and a preset protocol conversion tool is used to perform protocol conversion processing on multiple second encoded data streams to obtain multiple second converted compressed video streams.

[0030] Optionally, the video stream protocol conversion method, wherein the encapsulating the multiple converted compressed video streams to obtain multiple encapsulated video streams, determining a target encapsulated video stream among the multiple encapsulated video streams, and playing the target encapsulated video stream, specifically comprises:

[0031] Encapsulating the plurality of the first converted compressed video streams according to a preset arrangement rule to obtain first encapsulated video streams in multiple formats;

[0032] or encapsulating a plurality of the second converted compressed video streams according to a preset arrangement rule to obtain second encapsulated video streams in multiple formats;

[0033] Determine the playback format corresponding to the target player or target browser, and search in the first encapsulated video stream or the second encapsulated video stream according to the playback format to obtain a target encapsulated video stream that matches the playback format, and play the target encapsulated video stream on the target player or target browser.

[0034] In addition, to achieve the above object, the present invention also provides a video stream protocol conversion system, wherein the video stream protocol conversion system comprises:

[0035] A video stream reading module, used for determining a target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets;

[0036] A decoding processing module, used for decoding a plurality of the video stream unit packets to obtain a plurality of video stream basic data;

[0037] A protocol conversion module, used for performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams;

[0038] The encapsulation processing module is used to encapsulate the multiple converted compressed video streams to obtain multiple encapsulated video streams, determine a target encapsulated video stream among the multiple encapsulated video streams, and play the target encapsulated video stream.

[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a video stream protocol conversion program stored in the memory and executable on the processor, and when the video stream protocol conversion program is executed by the processor, the steps of the video stream protocol conversion method described above are implemented.

[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a video stream protocol conversion program, and when the video stream protocol conversion program is executed by a processor, the steps of the video stream protocol conversion method described above are implemented.

[0041] In the present invention, a target video stream is determined, and a video stream reading process is performed on the target video stream to obtain a plurality of video stream unit packets; a plurality of the video stream unit packets are decoded to obtain a plurality of video stream basic data; a plurality of the video stream basic data are subjected to protocol conversion processing to obtain a plurality of converted compressed video streams; a plurality of the converted compressed video streams are encapsulated to obtain a plurality of encapsulated video streams, a target encapsulated video stream is determined among the plurality of encapsulated video streams, and the target encapsulated video stream is played. The present invention can convert a video stream of any protocol into a plurality of encapsulation formats and can play normally on a plurality of players and browsers by performing video stream reading processing, decoding processing, protocol conversion processing and encapsulation processing on the target video stream; at the same time, through the video stream conversion capability, the effect of playing a video on multiple devices or browsers can also be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a flow chart of a preferred embodiment of the video stream protocol conversion method of the present invention;

[0043] Figure 2 It is a schematic diagram of the overall architecture of video stream protocol conversion of a preferred embodiment of the video stream protocol conversion method of the present invention;

[0044] Figure 3 It is a structural diagram of a preferred embodiment of the video stream protocol conversion system of the present invention;

[0045] Figure 4 It is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. 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.

[0047] Traditional video streaming playback on the cloud is based on the video streaming protocol provided by the video device itself, such as RTSP (Real Time Streaming Protocol, an application layer protocol in the TCP / IP protocol system) or RTMP (Real Time Messaging Protocol, an application layer protocol used to solve the multiplexing and packetizing problems of multimedia data transmission streams. The RTMP protocol is an application layer protocol and requires the underlying reliable transport layer protocol (usually TCP) to ensure the reliability of information transmission). It can only be played through the corresponding protocol player such as VLC player (cross-platform multimedia player). If it needs to be played in the browser, it is also necessary to convert the encapsulation format to mp4, http-flv, HLS and other protocols supported by the browser before it can be played.

[0048] The video stream protocol conversion method described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the video stream protocol conversion method comprises the following steps:

[0049] Step S10: determine a target video stream, and perform video stream reading processing on the target video stream to obtain a plurality of video stream unit packets.

[0050] like Figure 2 As shown, in the video stream protocol conversion system provided in the present invention, it is mainly divided into five modules, including a video stream reading module, a decoding module, a conversion module, a packaging module and an output module.

[0051] like Figure 2 As shown, the video stream protocol corresponding to the target video stream can be determined by inputting the target video stream into the reading module, and the target video stream can be split according to the corresponding video stream protocol to obtain multiple video stream unit packets, wherein the video stream unit packet includes a first video stream unit packet and a second video stream unit packet.

[0052] Specifically, when a video stream playback instruction is received, the target video stream is determined according to the video stream playback instruction, and a connection with the target video stream is established; the video stream protocol corresponding to the target video stream is obtained; if the video stream protocol corresponding to the target video stream is a first video stream protocol, the first video stream reading process is performed on the target video stream according to the first video stream protocol to obtain multiple first video stream unit packets; if the video stream protocol corresponding to the target video stream is a second video stream protocol, the second video stream reading process is performed on the target video stream according to the second video stream protocol to obtain multiple second video stream unit packets.

[0053] like Figure 2 As shown, the present invention is provided with a reading module: the target video stream is read according to the video stream protocol (referring to RTSP or RTMP, in the present invention, the first video stream protocol can be set to RTSP, and the second video stream protocol can be set to RTMP), the minimum unit of RTSP is the RTP packet (that is, the first video stream unit packet in the present invention), and the minimum unit of RTMP is the Chunk packet (that is, the second video stream unit packet in the present invention), by caching the obtained minimum unit packet (when caching, it does not wait until all the minimum unit packets are read and then processed, but first reads a part for caching, and then processes. This cache is configurable, and the default cache size is generally 1M. Afterwards, the cached packets are transmitted in and out through a pipeline (a queue data structure at the code level) to the decoding module.

[0054] It is understandable that after the target video stream is divided into RTP packets or Chunk packets for caching, a cache timestamp is generated, and then the RTP packets or Chunk packets with the same cache timestamp are classified into the same data packet. Afterwards, the missing video data in the RTP packets or Chunk packets are repaired according to the corresponding cache timestamp to eliminate transmission jitter.

[0055] Among them, the RTP packets or Chunk packets with the same cache timestamp are respectively combined as a data packet (the same timestamp means the data of the same frame of video). The integrity of the data may be destroyed during the transmission process, so it is necessary to restore the missing data blocks according to the data corresponding to the same timestamp, so as to eliminate the jitter phenomenon in the transmission. When the data is damaged too much, it is necessary to sort according to the size of the data frame, take the data frame with the largest data volume as the reference frame, and repair and deduplicate other data. The specific implementation process can be: divide the target video stream into several RTP packets or Chunk packets, and add a preset byte in front of each RTP packet or Chunk packet; wherein the preset byte constitutes an integer, which is used to represent the size of the RTP packet or Chunk packet. The RTP packet or Chunk packet after adding the preset byte is cached according to the preset byte order. When reading the RTP packet or Chunk packet, first read the preset byte, obtain the size of the RTP packet or Chunk packet, and allocate resources according to the size of the RTP packet or Chunk packet.

[0056] Furthermore, during the video stream reading process, the byte output status of the target video stream is detected at every preset time interval; if the target video stream fails to output video stream bytes for more than a first preset time, the target video stream is determined to be in a paused playback state, and the target video stream is paused for reading; if the target video stream fails to output video stream bytes for more than a second preset time, the target video stream is determined to be in a stopped playback state, and the reading connection with the target video stream is disconnected; wherein the first preset time is less than the second preset time.

[0057] In addition, the reading module also has pause reading (when it is detected that the output bytes of the video stream have not been output for a certain period of time, the default is to count once every 5 seconds and the output bytes are the same, it is considered that the player has paused the playback, then the reading of the video stream is paused. The pause here means that the connection information and cache have not been cleared, and the user may continue to play. When the output bytes of the video stream have not been played for more than 30 seconds, it is considered that the video stream is no longer needed, and the connection with the video stream is disconnected internally, and the cache is released), disconnect and reconnect (there are two ways to disconnect and reconnect, one is that the input video stream is disconnected; the other is that the player actively disconnects, such as directly turning off the player) and disconnect the video stream.

[0058] Step S20: Decode the plurality of video stream unit packets to obtain a plurality of video stream basic data.

[0059] Before performing protocol conversion on the target video stream, it needs to be decoded first. After the target video stream passes through the reading module, multiple first video stream unit packets and multiple second video stream unit packets are obtained. The decoding module will decode the multiple first video stream unit packets and the multiple second video stream unit packets to obtain the decoded video stream basic data.

[0060] Specifically, a first compression coding format corresponding to the first video stream protocol is obtained, and multiple first video stream unit packets are decoded and processed according to the first compression coding format to obtain multiple first video stream basic data; or a second compression coding format corresponding to the second video stream protocol is obtained, and multiple second video stream unit packets are decoded and processed according to the second compression coding format to obtain multiple second video stream basic data.

[0061] The RTP packet is decoded according to the encoding format of the RTSP protocol request response (both the RTSP protocol and the RTMP protocol are request-response protocols. When connected, they will inform which compression encoding method (H264 or H265) the current video stream is. Then decode according to the encoding format. For example, when a compressed file comes over, the corresponding tool is used for decompression. The specific decoding process is completed by the protocol tool). Common compression encoding formats are H264 and H265. The present invention decodes the video stream unit packet according to the encoding format in the decoding module to generate video stream metadata, also called basic data (a video file is essentially divided into three layers, including basic data, encoding and encapsulation process).

[0062] The present invention uses WebWorker to create a multi-threaded task, and decodes the received byte stream data by calling WebAssembly through JavaScript. WebWorker is JavaScript running in the background, independent of other scripts, and will not affect the performance of the page. After decoding, the video frame YUV data corresponding to the target video stream is obtained, and then the YUV is converted into the corresponding RGB value through a formula, and finally the original graphic data of the current video frame obtained is copied and transmitted to the web page end.

[0063] Step S30: Perform protocol conversion processing on the multiple video stream basic data to obtain multiple converted compressed video streams.

[0064] After the target video stream passes through the decoding module, the conversion module can implement the protocol conversion processing and encoding processing of the target video stream, so as to compress the target video stream.

[0065] Specifically, multiple first video stream basic data are encoded to obtain multiple first encoded data streams, and a preset protocol conversion tool is used to perform protocol conversion on the multiple first encoded data streams to obtain multiple first converted compressed video streams; or multiple second video stream basic data are encoded to obtain multiple second encoded data streams, and a preset protocol conversion tool is used to perform protocol conversion on the multiple second encoded data streams to obtain multiple second converted compressed video streams.

[0066] like Figure 2 As shown, the present invention is provided with a conversion module: the basic data is re-encoded (the re-encoding is also performed through a tool, for example, an RTSP video stream comes, which is encoded through H264, and the conversion module is responsible for splitting it, and then the conversion module encapsulates it into two encoded video streams, H264 and H265, wherein H265 has a higher compression ratio, a smaller file, and a faster transmission), there are two encoding formats H264 and H265, and the original video stream of a certain encoding format is converted into video streams of two encoding formats through the conversion module (the protocol tool ws.schild.jave-core.jar package and ws.schild.jave-nativ.jar two java packages are used for conversion), which can cope with more playback scenarios according to the business, and is suitable for scenarios with limited bandwidth and low picture requirements.

[0067] Step S40: encapsulate the plurality of converted compressed video streams to obtain a plurality of encapsulated video streams, determine a target encapsulated video stream among the plurality of encapsulated video streams, and play the target encapsulated video stream.

[0068] In the present invention, after the target video stream is converted and compressed by the compression module, it needs to be input into the encapsulation module to obtain data stream types of different formats. When the target data stream needs to be played on the target player or the target browser, the converted target encapsulated video stream can be directly called to meet the playback requirements of the target player or the target browser, and normal playback on the target player or the target browser is achieved.

[0069] Specifically, multiple first converted compressed video streams are encapsulated according to preset arrangement rules to obtain first encapsulated video streams in multiple formats; or multiple second converted compressed video streams are encapsulated according to preset arrangement rules to obtain second encapsulated video streams in multiple formats; the playback format corresponding to the target player or target browser is determined, and the first encapsulated video stream or the second encapsulated video stream is searched according to the playback format to obtain a target encapsulated video stream matching the playback format, and the target encapsulated video stream is played on the target player or target browser.

[0070] like Figure 2 As shown, the present invention is provided with an encapsulation module: the compressed video stream after protocol conversion is encapsulated again. In short, encapsulation is to arrange audio data, video data, basic information and other data into files according to certain structural rules. The encapsulated formats are MP4, http-flv and HLS (wherein the encapsulation process is also converted by tools) to cope with different players and browsers.

[0071] like Figure 2 As shown, the present invention is provided with an output module: the encapsulated byte packets are cached, and when there are bytes output (bytes are monitored), the reading module is notified to read the video stream, and when there are no bytes output, the reading is notified to pause, and the video stream connection is disconnected after a certain period of time (corresponding to the previous reading module).

[0072] The present invention is a method for converting a video stream protocol into multiple protocols. By using this method, a video stream of any protocol can be converted into multiple encapsulation formats, and at the same time, the video can be played on multiple players and browsers.

[0073] In addition, through a video stream conversion method provided in the present invention, the camera video stream RTSP or RTMP can be pushed to a cloud browser page for playback, a handheld tablet for playback, an Unreal Engine for playback, and a mobile phone for playback, thereby realizing a video playback and operation in multiple locations.

[0074] Furthermore, if Figure 3 As shown, based on the above-mentioned video stream protocol conversion method, the present invention also provides a video stream protocol conversion system accordingly, wherein the video stream protocol conversion system comprises:

[0075] A video stream reading module 51 is used to determine a target video stream and perform video stream reading processing on the target video stream to obtain a plurality of video stream unit packets;

[0076] A decoding processing module 52, used for decoding the plurality of video stream unit packets to obtain a plurality of video stream basic data;

[0077] The protocol conversion module 53 is used to perform protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams;

[0078] The encapsulation processing module 54 is used to encapsulate the multiple converted compressed video streams to obtain multiple encapsulated video streams, determine a target encapsulated video stream among the multiple encapsulated video streams, and play the target encapsulated video stream.

[0079] Furthermore, if Figure 4As shown, based on the above-mentioned video stream protocol conversion method and system, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 4 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0080] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as program codes of the installation terminal, etc. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a video stream protocol conversion program 40 is stored on the memory 20, and the video stream protocol conversion program 40 can be executed by the processor 10, thereby realizing the video stream protocol conversion method in the present application.

[0081] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run the program code or process data stored in the memory 20, such as executing the video stream protocol conversion method.

[0082] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.

[0083] In one embodiment, when the processor 10 executes the video stream protocol conversion program 40 in the memory 20, the following steps are implemented:

[0084] Determine a target video stream, and perform video stream reading processing on the target video stream to obtain a plurality of video stream unit packets;

[0085] Decoding the plurality of video stream unit packets to obtain a plurality of video stream basic data;

[0086] Performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams;

[0087] The plurality of converted compressed video streams are encapsulated to obtain a plurality of encapsulated video streams, a target encapsulated video stream is determined among the plurality of encapsulated video streams, and the target encapsulated video stream is played.

[0088] The step of determining a target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets specifically includes:

[0089] When receiving a video stream playing instruction, determining a target video stream according to the video stream playing instruction, and establishing a connection with the target video stream;

[0090] A video stream protocol corresponding to the target video stream is obtained, and a video stream reading process is performed on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets.

[0091] Wherein, the video stream protocol includes a first video stream protocol and a second video stream protocol; the video stream unit packet includes a first video stream unit packet and a second video stream unit packet;

[0092] The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets specifically includes:

[0093] Obtaining a video stream protocol corresponding to the target video stream;

[0094] If the video stream protocol corresponding to the target video stream is the first video stream protocol, performing first video stream reading processing on the target video stream according to the first video stream protocol to obtain a plurality of first video stream unit packets;

[0095] If the video stream protocol corresponding to the target video stream is the second video stream protocol, a second video stream reading process is performed on the target video stream according to the second video stream protocol to obtain a plurality of second video stream unit packets.

[0096] The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol further includes:

[0097] During the video stream reading process, detecting the byte output of the target video stream at preset intervals;

[0098] If the target video stream does not output video stream bytes for more than a first preset time, it is determined that the target video stream is in a paused playback state, and the target video stream is paused for reading;

[0099] If the target video stream does not output video stream bytes within a second preset time, the target video stream is determined to be in a stop playback state, and the reading connection with the target video stream is disconnected; wherein the first preset time is less than the second preset time.

[0100] The decoding process of the plurality of video stream unit packets to obtain a plurality of video stream basic data specifically includes:

[0101] Obtaining a first compression encoding format corresponding to the first video stream protocol, and decoding a plurality of first video stream unit packets according to the first compression encoding format to obtain a plurality of first video stream basic data;

[0102] Or obtain a second compression coding format corresponding to the second video stream protocol, and decode multiple second video stream unit packets according to the second compression coding format to obtain multiple second video stream basic data.

[0103] The step of performing protocol conversion on the plurality of video stream basic data to obtain a plurality of converted compressed video streams specifically includes:

[0104] Performing encoding processing on the plurality of first video stream basic data to obtain a plurality of first encoded data streams, and performing protocol conversion processing on the plurality of first encoded data streams using a preset protocol conversion tool to obtain a plurality of first converted compressed video streams;

[0105] Or encoding processing is performed on multiple second video stream basic data to obtain multiple second encoded data streams, and a preset protocol conversion tool is used to perform protocol conversion processing on multiple second encoded data streams to obtain multiple second converted compressed video streams.

[0106] The encapsulating the plurality of converted compressed video streams to obtain a plurality of encapsulated video streams, determining a target encapsulated video stream from the plurality of encapsulated video streams, and playing the target encapsulated video stream specifically includes:

[0107] Encapsulating the plurality of the first converted compressed video streams according to a preset arrangement rule to obtain first encapsulated video streams in multiple formats;

[0108] or encapsulating a plurality of the second converted compressed video streams according to a preset arrangement rule to obtain second encapsulated video streams in multiple formats;

[0109] Determine the playback format corresponding to the target player or target browser, and search in the first encapsulated video stream or the second encapsulated video stream according to the playback format to obtain a target encapsulated video stream that matches the playback format, and play the target encapsulated video stream on the target player or target browser.

[0110] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a video stream protocol conversion program, and when the video stream protocol conversion program is executed by a processor, the steps of the video stream protocol conversion method described above are implemented.

[0111] In summary, the present invention provides a video stream protocol conversion method, system, terminal and computer-readable storage medium, the method comprising: determining a target video stream, and performing video stream reading processing on the target video stream to obtain multiple video stream unit packets; decoding the multiple video stream unit packets to obtain multiple video stream basic data; performing protocol conversion processing on the multiple video stream basic data to obtain multiple converted compressed video streams; encapsulating the multiple converted compressed video streams to obtain multiple encapsulated video streams, determining a target encapsulated video stream among the multiple encapsulated video streams, and playing the target encapsulated video stream. The present invention can convert a video stream of any protocol into multiple encapsulation formats by performing video stream reading processing, decoding processing, protocol conversion processing and encapsulation processing on the target video stream, and can play it normally on multiple players and browsers; at the same time, through the video stream conversion capability, it can also achieve the effect of a video being played on multiple devices or browsers.

[0112] 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 terminal 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 terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.

[0113] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.

[0114] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A video stream protocol conversion method, It is characterized in that The video stream protocol conversion method comprises: Determine a target video stream, and perform video stream reading processing on the target video stream to obtain a plurality of video stream unit packets; The step of determining a target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets specifically includes: When receiving a video stream playing instruction, determining a target video stream according to the video stream playing instruction, and establishing a connection with the target video stream; Acquire a video stream protocol corresponding to the target video stream, and perform video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets; The video stream protocol includes a first video stream protocol and a second video stream protocol; the video stream unit packet includes a first video stream unit packet and a second video stream unit packet; The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets specifically includes: Obtaining a video stream protocol corresponding to the target video stream; If the video stream protocol corresponding to the target video stream is the first video stream protocol, performing first video stream reading processing on the target video stream according to the first video stream protocol to obtain a plurality of first video stream unit packets; If the video stream protocol corresponding to the target video stream is a second video stream protocol, performing a second video stream reading process on the target video stream according to the second video stream protocol to obtain a plurality of second video stream unit packets; The first video stream protocol is RTSP, the second video stream protocol is RTMP, the first video stream unit packet is an RTP packet, and the second video stream unit packet is a Chunk packet; The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol further includes: During the video stream reading process, detecting the byte output of the target video stream at preset intervals; If the target video stream does not output video stream bytes for more than a first preset time, it is determined that the target video stream is in a paused playback state, and the target video stream is paused for reading; If the target video stream does not output video stream bytes for more than a second preset time, it is determined that the target video stream is in a stop playing state, and the reading connection with the target video stream is disconnected; Wherein, the first preset time is less than the second preset time; Decoding the plurality of video stream unit packets to obtain a plurality of video stream basic data; Performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams; The plurality of converted compressed video streams are encapsulated to obtain a plurality of encapsulated video streams, a target encapsulated video stream is determined among the plurality of encapsulated video streams, and the target encapsulated video stream is played.

2. The video stream protocol conversion method according to claim 1, It is characterized in that The decoding process of the plurality of video stream unit packets to obtain a plurality of video stream basic data specifically includes: Obtaining a first compression encoding format corresponding to the first video stream protocol, and decoding a plurality of first video stream unit packets according to the first compression encoding format to obtain a plurality of first video stream basic data; Or obtain a second compression coding format corresponding to the second video stream protocol, and decode multiple second video stream unit packets according to the second compression coding format to obtain multiple second video stream basic data.

3. The video stream protocol conversion method according to claim 2, It is characterized in that The performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams specifically includes: Performing encoding processing on the plurality of first video stream basic data to obtain a plurality of first encoded data streams, and performing protocol conversion processing on the plurality of first encoded data streams using a preset protocol conversion tool to obtain a plurality of first converted compressed video streams; Or encoding processing is performed on multiple second video stream basic data to obtain multiple second encoded data streams, and a preset protocol conversion tool is used to perform protocol conversion processing on multiple second encoded data streams to obtain multiple second converted compressed video streams.

4. The video stream protocol conversion method according to claim 3, It is characterized in that The encapsulating the plurality of converted compressed video streams to obtain a plurality of encapsulated video streams, determining a target encapsulated video stream among the plurality of encapsulated video streams, and playing the target encapsulated video stream specifically includes: Encapsulating the plurality of the first converted compressed video streams according to a preset arrangement rule to obtain first encapsulated video streams in multiple formats; or encapsulating a plurality of the second converted compressed video streams according to a preset arrangement rule to obtain second encapsulated video streams in multiple formats; Determine the playback format corresponding to the target player or target browser, and search in the first encapsulated video stream or the second encapsulated video stream according to the playback format to obtain a target encapsulated video stream that matches the playback format, and play the target encapsulated video stream on the target player or target browser.

5. A video stream protocol conversion system, It is characterized in that The video stream protocol conversion system comprises: A video stream reading module, used for determining a target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets; The step of determining a target video stream and performing video stream reading processing on the target video stream to obtain a plurality of video stream unit packets specifically includes: When receiving a video stream playing instruction, determining a target video stream according to the video stream playing instruction, and establishing a connection with the target video stream; Acquire a video stream protocol corresponding to the target video stream, and perform video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets; The video stream protocol includes a first video stream protocol and a second video stream protocol; the video stream unit packet includes a first video stream unit packet and a second video stream unit packet; The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol to obtain a plurality of video stream unit packets specifically includes: Obtaining a video stream protocol corresponding to the target video stream; If the video stream protocol corresponding to the target video stream is the first video stream protocol, performing first video stream reading processing on the target video stream according to the first video stream protocol to obtain a plurality of first video stream unit packets; If the video stream protocol corresponding to the target video stream is a second video stream protocol, performing a second video stream reading process on the target video stream according to the second video stream protocol to obtain a plurality of second video stream unit packets; The first video stream protocol is RTSP, the second video stream protocol is RTMP, the first video stream unit packet is an RTP packet, and the second video stream unit packet is a Chunk packet; The step of obtaining a video stream protocol corresponding to the target video stream and performing video stream reading processing on the target video stream according to the video stream protocol further includes: During the video stream reading process, detecting the byte output of the target video stream at preset intervals; If the target video stream does not output video stream bytes for more than a first preset time, it is determined that the target video stream is in a paused playback state, and the target video stream is paused for reading; If the target video stream does not output video stream bytes for more than a second preset time, it is determined that the target video stream is in a stop playing state, and the reading connection with the target video stream is disconnected; Wherein, the first preset time is less than the second preset time; A decoding processing module, used for decoding a plurality of the video stream unit packets to obtain a plurality of video stream basic data; A protocol conversion module, used for performing protocol conversion processing on the plurality of video stream basic data to obtain a plurality of converted compressed video streams; The encapsulation processing module is used to encapsulate the multiple converted compressed video streams to obtain multiple encapsulated video streams, determine a target encapsulated video stream among the multiple encapsulated video streams, and play the target encapsulated video stream.

6. A terminal, It is characterized in that The terminal includes: a memory, a processor, and a video stream protocol conversion program stored in the memory and executable on the processor. When the video stream protocol conversion program is executed by the processor, the steps of the video stream protocol conversion method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a video stream protocol conversion program, and when the video stream protocol conversion program is executed by a processor, the steps of the video stream protocol conversion method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Live video display method, device and equipment and storage medium

    CN110858910A

  • Solution for no plug-in of national standard stream

    CN115865872A

  • Video playing method and device, computer equipment and storage medium

    CN115866294A

  • Network camera access method and platform capable of intelligently accessing multiple protocols

    CN116156105A

  • Audio and video transcoding device and method, equipment, medium and product

    CN117097907A