Video stream playback method and apparatus, electronic device, and storage medium
By acquiring and formatting the in-stream video stream data, the jumping and lag problems during video stream switching in the prior art are solved, and seamless switching of multiple video streams and improved user experience are achieved.
Patent Information
- Application Number
- PCT/CN2024/119618
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-01
- Filing Date
- 2024-09-19
- Publication Date
- 2025-06-05
AI Technical Summary
The prior art has problems of jumping and lag in switching playback screens when switching player instances, which affects the user experience.
By obtaining the interstack video stream data to be played, determining the data format according to its encapsulation format, and when the format is identified inconsistent, the interstack video stream data format is converted into the format of the main video stream data to achieve seamless switching.
It realizes seamless switching of multiple video streams in different data formats in the player, improving the user's visual experience and avoiding the playback screen lag and jumping.
Smart Images

Figure CN2024119618_05062025_PF_FP_ABST
Abstract
Description
Video stream playback method, device, electronic device and storage medium
[0001] This application claims priority to Chinese patent application filed on December 1, 2023, with application number 202311647811.6, and application name “A video stream playback method, device, electronic device and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] The present application relates to the field of video processing technology, and in particular to a video stream playback method, device, electronic device, and storage medium. Background Art
[0003] With the development of multimedia, video playback devices have increasingly higher requirements for seamless switching.
[0004] Most existing seamless switching solutions use dual players. That is, the current player plays the first video source, and when the user clicks to switch, the app background starts another player instance to load the second video source. Technical issues
[0005] When switching player instances, there is a jumpy feeling in the playback screen switching. In addition, it takes a certain amount of time to switch to another player instance, resulting in lag in the playback screen when playing multiple video streams, affecting the user experience. Technical Solutions
[0006] The embodiments of the present application provide a video stream playback method, device, electronic device and storage medium, which can realize seamless switching of multiple video streams in different data formats in a player, achieve seamless playback during video playback, and enhance the user's visual experience.
[0007] In a first aspect, an embodiment of the present application provides a method for playing a video stream, wherein the method is applied to an electronic device, the electronic device including a player, including:
[0008] Get the interstitial video stream data to be played;
[0009] Determining a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data;
[0010] When it is recognized that the first data format is inconsistent with the second data format, the first data format of the interstitial video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player;
[0011] The inserted video stream data after data format conversion is played by the player.
[0012] In a second aspect, an embodiment of the present application further provides a video stream playback device, comprising:
[0013] The interstitial video stream data acquisition module is used to obtain the interstitial video stream data to be played;
[0014] A first data format determining module, configured to determine a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data;
[0015] a format conversion module, configured to, when identifying that the first data format is inconsistent with the second data format, convert the first data format of the interstitial video stream data into the second data format, wherein the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player;
[0016] The playing module is used to play the inserted video stream data after data format conversion through the player.
[0017] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; the processor loads instructions from the memory to execute the steps of any one of the video stream playback methods provided in the embodiments of the present application.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the steps of any one of the video stream playback methods provided in the embodiment of the present application.
[0019] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program or instructions, which, when executed by a processor, implements the steps of any one of the video stream playback methods provided in the embodiments of the present application. Beneficial effects
[0020] By adopting the scheme of the embodiment of the application, it is possible to obtain the interstitial video stream data to be played; determine the first data format of the interstitial video stream data according to the encapsulation format of the interstitial video stream data; when it is recognized that the first data format is inconsistent with the second data format, convert the first data format of the interstitial video stream data into the second data format, the second data format being the data format of the main video stream data, the interstitial video stream data and the main video stream data are played adjacent to each other in the player; and play the interstitial video stream data after the data format conversion through the player. Thus, when it is recognized that the first data format is inconsistent with the second data format, by converting the first data format of the interstitial video stream data into the second data format of the main video stream data, seamless switching of multiple video streams of different data formats in the player is achieved, achieving seamless playback during video playback and enhancing the user's visual experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0022] FIG1 is a schematic diagram of a player using the video stream playback method provided in an embodiment of the present application;
[0023] FIG2 is a flow chart of an embodiment of a method for playing a video stream provided in an embodiment of the present application;
[0024] FIG3 is a flow chart of a specific embodiment of a method for playing a video stream provided in an embodiment of the present application;
[0025] FIG4 is a schematic diagram of a data chain diagram showing the composition of the main video stream data and the interstitial video stream data provided in an embodiment of the present application;
[0026] FIG5 is a schematic structural diagram of a video stream playback device provided in an embodiment of the present application;
[0027] FIG6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. Modes for Carrying Out the Invention
[0028] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0029] At the same time, in the description of the embodiments of this application, the terms "first", "second", etc. are used only to distinguish the description and should not be understood as indicating or implying relative importance. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0030] To address the technical issues of black screens and freezes caused by multimedia players switching between media resources, embodiments of the present application provide a method, apparatus, electronic device, and computer-readable storage medium for video stream playback. Through embodiments of the present application, data acquisition, parsing, and decoding can be performed on video stream data in different encapsulation formats and encoding protocols before playback, achieving seamless rendering of the playback screen and enhancing the user's visual experience.
[0031] The video stream playback method provided in the embodiments of the present application can be applied to an electronic device, wherein the electronic device includes a player. Referring to FIG. 1 , as shown in FIG. 1 , the player 100 includes a playback control module 101 , a media resource module 102 , a network data module 103 , a parsing module 104 , a decoding module 105 , and a display module 106 .
[0032] The playback control module 101 is used to control the playback state of the video stream data. For example, the playback control module 101 controls the playback of the video stream data. For another example, the playback control module 101 controls the pause of the video stream data. For another example, the playback control module 101 controls the switching playback of the video stream data.
[0033] The media resource module 102 is used for media resource management. The functions implemented by the media resource module 102 include but are not limited to setting the data source of video stream data and managing the storage of video stream data in different data formats.
[0034] The network data module 103 is used to obtain video stream data from the network. Through the data source of the video stream data set in the media resource module 102, the network data module 103 is controlled to obtain the video stream data from the data source of the video stream data on the network.
[0035] It is understandable that the network data acquired by the network data module 103 is ultimately transmitted to the terminal in the form of binary data.
[0036] The parsing module 104 is used to parse the video stream data acquired by the network data module 103. The parsing module 104 can parse the video stream data into audio data and video data.
[0037] It is understandable that a video stream data is multimedia data, and each video stream data includes audio data and video data, and the audio data and video data have a corresponding relationship in time sequence. That is, at the same time, each video stream data includes audio data and video data.
[0038] The decoding module 105 is used to decode the audio data and video data parsed by the parsing module 104 .
[0039] The display module 106 is used to display the data decoded by the decoding module 105 .
[0040] It is understandable that the decoded audio data and video data are data that can be directly displayed on the display module 106. Exemplarily, the decoded audio data is PCM data, and the decoded video data is YUV data. The decoding module 105 transmits the decoded PCM data to the audio display module in the display module 106, and the expression form of the audio display module includes but is not limited to a sound card. The audio display module enables the speaker of the player to emit sound corresponding to the PCM data. The decoding module 105 transmits the decoded YUV data to the video display module in the display module 106, and the expression form of the video display module includes but is not limited to a graphics card. Through the video display module, the display in the player can display the picture.
[0041] In the embodiment of the present application, the video stream data is YUV data when it is transmitted to the video display module, and PCM data when it is transmitted to the audio display module. That is, in the present application, the video stream data (including all packaging formats and encoding formats) will eventually be replaced by YUV data and PCM data.
[0042] In the embodiment of the present application, the video stream data (including all encapsulation formats) needs to be split into audio code stream and video code stream, and the audio code stream and video code stream are decoded separately.
[0043] In the embodiment of the present application, the terminal device is used as a carrier and network media data is used as a basis to perform processes such as acquisition, parsing, and decoding of streaming media, thereby realizing seamless switching of streaming media data under different packaging formats and different encoding formats, achieving seamless playback during video playback, and prompting the user's visual experience.
[0044] It should be noted that the video stream playback method provided in the embodiment of the present application is executed in an electronic device, and accordingly, the video stream playback device is provided in the electronic device.
[0045] The following is a detailed description of the embodiments described in conjunction with the accompanying drawings. In this embodiment, the execution subject is an electronic device capable of playing a video stream, and the electronic device includes a player. It should be noted that the order in which the following embodiments are described does not limit the preferred order of the embodiments. Although the flowcharts show a logical order, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0046] Referring to FIG. 2 , the specific process of the video stream playing method may include steps 201 to 204, wherein:
[0047] Step 201: Obtain the interstitial video stream data to be played.
[0048] In the embodiment of the present application, the interleaved video stream data refers to another video stream data inserted into the main video stream data and played by the player. The main video stream data refers to the video stream data played by the player.
[0049] In the embodiments of the present application, one channel of interstitial video stream data can be obtained, or multiple channels of interstitial video stream data can be obtained. That is, one channel of video stream data can be inserted into the main video stream data, or multiple channels of video stream data can be inserted into the main video stream data. The number of interstitial video stream data can be adjusted according to actual conditions and is not specifically limited in the embodiments of the present application.
[0050] In an embodiment of the present application, data can be set in the media resource module of the player, and interstitial video stream data can be retrieved from the server to the local computer based on the data set in the media resource module. For example, if the media resource module of the player is set with first interstitial video stream data and second interstitial video stream data, the first interstitial video stream data and the second interstitial video stream data can be retrieved.
[0051] In an embodiment of the present application, in response to a user's video stream switching operation on the player, interstitial video stream data corresponding to the video stream switching operation can be obtained.
[0052] It is understandable that the method of obtaining the interstitial video stream data can be adjusted according to actual conditions, and the embodiments of the present application do not limit it.
[0053] In an embodiment of the present application, the main video stream data may be obtained before obtaining the interstitial video stream data to be played, or while obtaining the interstitial video stream data to be played, or after obtaining the interstitial video stream data to be played.
[0054] In an embodiment of the present application, the obtained interstitial video stream data and main video stream data can be allocated to independent list spaces for storage according to a streaming media protocol. A streaming media protocol refers to a protocol that must be followed for communication between an electronic device and a server. The above-mentioned streaming media protocols include but are not limited to the HTTP protocol (Hypertext Transfer Protocol) and the RTMP protocol (Real Time Message Protocol).
[0055] It is understandable that when the protocols of the interstitial video stream data and the main video stream data are consistent, they can also be allocated to the same list space for storage.
[0056] Step 202: Determine the first data format of the inter-cast video stream data based on the encapsulation format of the inter-cast video stream data. In an embodiment of the present application, the encapsulation format is used to store the video stream and the audio stream in the video stream data according to a certain data format. It can be understood that a video stream data includes a video stream and an audio stream. Encapsulation formats include but are not limited to MP4 (MPEG-4 Part 14), MKV (Matroska Video), FLV (Flash Video) and AVI (Audio Video Interleave). In an embodiment of the present application, the first data format includes the data format of the first video stream and the data format of the first audio stream. The data format of the first video stream is used to characterize the data format of the video stream in the inter-cast video stream data. The data format of the first audio stream is used to characterize the data format of the audio stream in the inter-cast video stream data.
[0057] In an embodiment of the present application, a parsing result can be obtained by parsing the header information of the encapsulation format of the interstitial video stream; and the first data format of the interstitial video stream data is determined based on the parsing result.
[0058] The header information of the encapsulation format includes the data format of the video stream and the data format of the audio stream.
[0059] Furthermore, in an embodiment of the present application, by parsing the header information of the encapsulation format of the interstitial video stream, the first video code stream and the first audio code stream are extracted from the interstitial video stream, and the data format of the first video code stream and the data format of the first audio code stream are determined based on the parsing results.
[0060] In the embodiment of the present application, the first data format of the interstitial video stream data may also be determined by configuring the video stream data in the media resource module of the player.
[0061] The configuration parameters include the data format of the video stream and the data format of the audio stream.
[0062] Furthermore, in an embodiment of the present application, the data format of the first video code stream and the data format of the first audio code stream are configured by setting the configuration parameters of the video stream data in the media resource module of the player, and the data format of the first video code stream and the data format of the first audio code stream can be determined according to the configuration parameters.
[0063] Step 203: When it is identified that the first data format is inconsistent with the second data format, the first data format of the interstitial video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacent to each other in the player.
[0064] In this embodiment of the present application, the second data format includes the data format of the second video stream and the data format of the second audio stream. The data format of the second video stream is used to represent the data format of the video stream in the primary video stream data. The data format of the second audio stream is used to represent the data format of the audio stream in the primary video stream data.
[0065] In an embodiment of the present application, the first data format of the interstitial video stream data and the second data format of the main video stream data may be the same, or the first data format of the interstitial video stream data and the second data format of the main video stream data may be different.
[0066] It can be understood that the first data format of the interstitial video stream data and the second data format of the main video stream data are the same means that the data format of the first video code stream in the interstitial video stream data and the data format of the second video code stream in the main video stream data are the same, and the data format of the first audio code stream in the interstitial video stream data and the data format of the second audio code stream in the main video stream data are the same.
[0067] The first data format of the interstitial video stream data and the second data format of the main video stream data are different, which means that the data format of the first video code stream in the interstitial video stream data and the data format of the second video code stream in the main video stream data are different, or the data format of the first audio code stream in the interstitial video stream data and the data format of the second audio code stream in the main video stream data are different.
[0068] In an embodiment of the present application, when it is identified that the first data format of the interstitial video stream data is the same as the second data format of the main video stream data, there is no need to convert the first data format of the interstitial video stream data into the second data format, and the interstitial video stream data is played through the player.
[0069] It is understandable that in the existing technical solution, the first data format of the interstitial video stream data played by the player and the second data format of the main video stream data need to be the same. If the first data format of the interstitial video stream data and the second data format of the main video stream data are different, the interstitial video stream data needs to be converted on the server to be consistent with the data format of the main video stream data. However, the conversion operation on the server will cause black screen and freeze problems when the player switches media resources.
[0070] In an embodiment of the present application, interstitial video stream data is obtained and uploaded to an electronic device. When it is identified that the first data format of the interstitial video stream data and the second data format of the main video stream data are inconsistent, the first data format of the interstitial video stream data is converted into the second data format on the electronic device. The second data format is the data format of the main video stream data, thereby realizing seamless switching of multiple video streams of different data formats in the player, achieving seamless playback during video playback, and enhancing the user's visual experience.
[0071] In an embodiment of the present application, the second data format can be determined by parsing the header information of the main video stream data; based on the interstitial video stream data, stream data corresponding to the second data format is generated; based on the stream data, the first data format of the interstitial video stream data is converted into the second data format.
[0072] The header information includes the data format of the video stream and the data format of the audio stream.
[0073] Furthermore, in an embodiment of the present application, the second video code stream and the second audio code stream are extracted from the main video stream by parsing the header information of the main video stream data.
[0074] If only the data format of the first video code stream in the inserted video stream data and the data format of the second video code stream in the main video stream data are identified to be different, then based on the specific content of the first video code stream of the inserted video stream data, stream data corresponding to the data format of the second video code stream is generated, and the position of the stream data in the first video code stream is changed, and the first video code stream of the inserted video stream data is replaced with the generated stream data of the second data format.
[0075] If only the data format of the first audio code stream in the inserted video stream data and the data format of the second audio code stream in the main video stream data are identified to be different, then based on the specific content of the first audio code stream of the inserted video stream data, stream data corresponding to the data format of the second audio code stream is generated, and the position of the stream data in the first audio code stream is changed, and the first audio code stream of the inserted video stream data is replaced with the generated stream data of the second data format.
[0076] If it is identified that the data format of the first video code stream in the inserted video stream data is different from the data format of the second video code stream in the main video stream data, and the data format of the first audio code stream is different from the data format of the second audio code stream in the main video stream data, then based on the specific content of the first video code stream of the inserted video stream data, video stream data corresponding to the data format of the second video code stream is generated, the position of the video stream data in the first video code stream is changed, and the first video code stream of the inserted video stream data is replaced with the generated video stream data of the second data format. Based on the specific content of the first audio code stream of the inserted video stream data, audio stream data corresponding to the data format of the second audio code stream is generated, the position of the audio stream data in the first audio code stream is changed, and the first audio code stream of the inserted video stream data is replaced with the generated audio stream data of the second data format. In an embodiment of the present application, the encapsulation data format is extracted from the data layer, thereby solving the problems of player reset, black screen, etc. caused by different encapsulation formats and encoding formats at the data level, realizing seamless switching of multiple video streams of different data formats in the player, achieving seamless playback during video playback, and improving the user's visual experience.
[0077] Step 204: Play the inserted video stream data after data format conversion through the player.
[0078] In an embodiment of the present application, the player can also play the interstitial video stream data that has not been converted into a data format, and the player can also play the main video stream data.
[0079] In an embodiment of the present application, the interstitial video stream data after data format conversion is replaced with display stream data supported by the player; and the display stream data is played by the player.
[0080] In the embodiment of the present application, display streaming data refers to streaming data that can be directly displayed by a player.
[0081] It is understood that the data format of the video stream that the player can directly display is YUV data, and the data format of the audio stream that the player can directly display is PCM data. That is, the first video stream in the interstitial video stream data after data format conversion is replaced with YUV data, and the first audio stream in the interstitial video stream data after data format conversion is replaced with PCM data.
[0082] In this example, PCM data can be played directly in the audio display module, and YUV data can be displayed directly in the video display module of the player, achieving smooth display of PCM data and YUV data, and realizing seamless switching of multiple video streams of different data formats in the player, achieving seamless playback during video playback and improving the user's visual experience. In an embodiment of the present application, by converting the first data format of the interstitial video stream data into the second data format of the main video stream data, seamless switching of multiple video streams of different data formats in the player is achieved, achieving seamless playback during video playback and improving the user's visual experience.
[0083] In an optional embodiment, the player is configured with a conversion buffer and a display buffer, and the video stream playback method further includes:
[0084] The acquired interstitial video stream data is stored in the conversion buffer.
[0085] The converting the first data format of the interstitial video stream data into the second data format includes:
[0086] In the conversion buffer, the first data format of the inter-cast video stream data is converted into the second data format, and the inter-cast video stream data after the data format conversion is stored in the display buffer.
[0087] The player plays the inserted video stream data after the data format conversion, including:
[0088] The interstitial video stream data after data format conversion in the display buffer is played by the player.
[0089] In the embodiment of the present application, the conversion buffer is used to store the interstitial video stream data that needs to be converted into a data format. That is, when it is identified that the first data format is inconsistent with the second data format, the obtained interstitial video stream data is stored in the conversion buffer.
[0090] A buffer is a temporary storage area used to transfer data between two different devices or processes. It provides a mechanism for copying data from one location to another and acts as a buffer when data transfer speeds don't match. Buffers are often used to balance the speed differences between generating and processing data.
[0091] In an embodiment of the present application, in the conversion buffer, the data format of the first video code stream in the interstitial video stream data is converted into the data format of the second video code stream. Alternatively, in the conversion buffer, the data format of the first audio code stream in the interstitial video stream data is converted into the data format of the second audio code stream. Alternatively, in the conversion buffer, the data format of the first video code stream in the interstitial video stream data is converted into the data format of the second video code stream, and the data format of the first audio code stream in the interstitial video stream data is simultaneously converted into the data format of the second audio code stream.
[0092] In the embodiment of the present application, the display buffer is used to store the video stream data to be played. The display buffer can be used to store the video stream data itself, or to store the display stream data corresponding to the video stream data.
[0093] In an embodiment of the present application, the interstitial video stream data after data format conversion can be parsed to obtain a parsing result; based on the parsing result, the interstitial video stream data is replaced with display stream data; and the display stream data is stored in the display buffer.
[0094] Furthermore, during the parsing process, the interstitial video stream data, after data format conversion, is replaced with display stream data that can be directly displayed by the player. Simultaneously, during the parsing process of the main video stream data, the main video stream data is also replaced with display stream data that can be directly displayed by the player. Based on the playback time of the main video stream data and the interstitial video stream data, the display stream data corresponding to the interstitial video stream data and the display stream data corresponding to the main video stream data are sorted, and the sorted display stream data are stored in the display buffer.
[0095] In an embodiment of the present application, the interstitial video stream data after data format conversion can be decoded to obtain a decoding result; based on the decoding result, the interstitial video stream data is replaced with display stream data; and the display stream data is stored in the display buffer.
[0096] Furthermore, during the decoding process, the inter-stream video data after data format conversion is replaced with display stream data that can be directly displayed by the player. Simultaneously, during the decoding process of the main video stream data, the main video stream data is also replaced with display stream data that can be directly displayed by the player. Based on the playback time of the main video stream data and the inter-stream video stream data, the display stream data corresponding to the inter-stream video stream data and the display stream data corresponding to the main video stream data are sorted, and the sorted display stream data are stored in the display buffer.
[0097] Furthermore, during the decoding process, the interstitial video stream data and the main video stream data can be sorted according to their respective play times, and then the interstitial video stream data after data format conversion can be replaced with display stream data that can be directly displayed by the player. Simultaneously, the main video stream data is replaced with display stream data that can be directly displayed by the player, and the display stream data corresponding to the interstitial video stream data and the display stream data corresponding to the main video stream data are stored in the display buffer according to the pre-arranged order.
[0098] In an embodiment of the present application, in the process of obtaining the interstitial video stream data, the interstitial video stream data can be replaced with the display stream data corresponding to the interstitial video stream data; in the process of obtaining the main video stream data, the main video stream data can be replaced with the display stream data corresponding to the main video stream data, and the display stream data can be stored in the display buffer.
[0099] In an embodiment of the present application, when obtaining the interstitial video stream data, the interstitial video stream data can be replaced by the second interstitial video stream data by parsing the interstitial video stream data; and storing the parsed interstitial video stream data in the conversion buffer. In an embodiment of the present application, the display stream data in the display buffer is played by the player.
[0100] 3 and 4 , FIG3 is a flow chart of a specific embodiment of the video stream playback method, and FIG4 is a schematic diagram of a data chain consisting of main video stream data and interstitial video stream data. The video stream playback method is explained in conjunction with FIG3 and FIG4 .
[0101] As shown in Figure 3, the player includes a playback control module, a media resource module, a network data module, a parsing module, a decoding module, and a display module. The playback control module retrieves the main video stream data and the interstitial video stream data from the network data module. The retrieved main video stream data and the interstitial video stream data are sequentially input into the parsing module for parsing. After parsing, a continuous data linked list is formed in the memory space. This data linked list is input into the decoding module for decoding. The decoded first and second audio streams are replaced with PCM data, and the decoded first and second video streams are replaced with YUV data. In Figure 3, PCM1, PCM2, and PCM5 are the display stream data corresponding to the second audio stream, PCM3 and PCM4 are the display stream data corresponding to the first audio stream, YUV1, YUV2, and YUV5 are the display stream data corresponding to the second video stream, and YUV3 and YUV4 are the display stream data corresponding to the first video stream. Finally, the corresponding display stream data is directly displayed via the audio display module and video display module in the display module.
[0102] In this embodiment of the present application, the data linked list is input to the decoding module for decoding. Based on the encoder configuration information in the header information of the audio stream and the actual compressed data of the audio stream, an audio decoder supported by the terminal device is generated. The audio stream is decoded based on the audio decoder. Based on the encoder configuration information in the header information of the video stream and the actual compressed data of the video stream, a video decoder supported by the terminal device is generated. The video stream is decoded based on the video decoder.
[0103] As shown in Figure 4, when parsing the main video stream data and the interstitial stream data, the main video stream data is parsed, and the audio code stream and video code stream corresponding to the main video stream data are extracted. According to each audio code stream and video code stream, the second parsed data is constructed. The interstitial video stream data is parsed, and the audio code stream and video code stream corresponding to the interstitial video stream data are extracted. According to each audio code stream and video code stream, the first parsed data is constructed. As shown in Figure 4, when the player plays the second parsed data of the main video stream data and reaches the interstitial time point, the next playback object in the data linked list is pointed to the first parsed data of the interstitial video stream data, and the interstitial stream data is played by the player. It should be understood that Figure 4 is a continuous data linked list formed in the memory space after the two videos have been parsed and encapsulated.
[0104] It can be understood that each parsing process requires matching the interstitial video stream data with the playback time point corresponding to the main video stream data. When the interstitial time point corresponding to the interstitial video stream data is reached, the pointer object of the parsed data is pointed to the storage space of the interstitial video stream data, and the current playback time of the main video stream data is saved. After the playback of the interstitial video stream data is completed, the pointer object of the parsed data is pointed to the memory address after the main video stream data with the current playback time saved, and the main video stream data continues to be played.
[0105] In an embodiment of the present application, PCM data can be played directly in the audio display module, and YUV data can be displayed directly in the video display module of the player, thereby achieving smooth display of PCM data and YUV data, and realizing seamless switching of multiple video streams of different data formats in the player, achieving seamless playback during video playback, and enhancing the user's visual experience.
[0106] This embodiment further provides a video stream playback device, which can be integrated into an electronic device, such as a computer device. The computer device can be a terminal or other device. The electronic device includes a player, and this embodiment has no limitation on this.
[0107] For example, as shown in FIG5 , the video stream playing device may include:
[0108] The interstitial video stream data acquisition module 301 is used to acquire interstitial video stream data to be played.
[0109] The first data format determining module 302 is configured to determine a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data.
[0110] The format conversion module 303 is used to convert the first data format of the interstitial video stream data into the second data format when it is identified that the first data format is inconsistent with the second data format. The second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacent to each other in the player.
[0111] The playing module 304 is configured to play the inserted video stream data after data format conversion through the player.
[0112] Optionally, in the apparatus of the embodiment of the present application, in the format conversion module 303, the player playing the in-stream video stream data after the data format conversion includes:
[0113] The first replacing unit is used to replace the inserted video stream data after data format conversion with display stream data supported by the player.
[0114] The first playing unit is configured to play the display stream data through the player.
[0115] Optionally, in the apparatus of the embodiment of the present application, the player is configured with a conversion buffer and a display buffer, and the apparatus further includes:
[0116] The first storage unit is configured to store the acquired interstitial video stream data in the conversion buffer.
[0117] Optionally, in the apparatus of the embodiment of the present application, in the format conversion module 303, converting the first data format of the interstitial video stream data into the second data format includes:
[0118] The conversion unit is configured to convert the first data format of the interstitial video stream data into the second data format in the conversion buffer, and store the interstitial video stream data after data format conversion in the display buffer.
[0119] Optionally, in the apparatus of the embodiment of the present application, in the playing module 304, playing the interstitial video stream data after the data format conversion by the player includes:
[0120] The second playing unit is configured to play the interstitial video stream data after the data format is converted in the display buffer through the player.
[0121] Optionally, in the apparatus of the embodiment of the present application, in the conversion unit, storing the interstitial video stream data after data format conversion into the display buffer includes:
[0122] The parsing unit is used to parse the interstitial video stream data after data format conversion to obtain a parsing result.
[0123] A second replacing unit, configured to replace the interstitial video stream data with display stream data based on the parsing result;
[0124] The second storage unit is configured to store the display stream data in the display buffer.
[0125] Optionally, in the apparatus of the embodiment of the present application, in the conversion unit, storing the interstitial video stream data after data format conversion in the display buffer includes:
[0126] The decoding unit is used to decode the interstitial video stream data after data format conversion to obtain a decoding result.
[0127] a third replacing unit, configured to replace the interstitial video stream data with display stream data based on the decoding result;
[0128] The third storage unit is configured to store the display stream data in the display buffer.
[0129] Optionally, in the apparatus of the embodiment of the present application, in the second playback unit, playing the interstitial video stream data after the data format conversion in the display buffer by the player includes:
[0130] The third playing unit is configured to play the display stream data in the display buffer through the player.
[0131] Optionally, in the apparatus of the embodiment of the present application, the first data format determining module 302 determines the first data format of the interstitial video stream data according to the encapsulation format of the interstitial video stream data, including:
[0132] The parsing unit is used to parse the header information of the encapsulation format of the interstitial video stream to obtain a parsing result.
[0133] The data format determination unit is used to determine the first data format of the inter-cast video stream data according to the analysis result. In the device of the embodiment of the present application, in the inter-cast video stream data, the acquisition module obtains the inter-cast video stream data to be played; in the first data format determination module, the first data format of the inter-cast video stream data is determined according to the encapsulation format of the inter-cast video stream data; in the format conversion module, when it is identified that the first data format is inconsistent with the second data format, the first data format of the inter-cast video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the inter-cast video stream data and the main video stream data are played adjacent to each other in the player; in the playback module, the inter-cast video stream data after data format conversion is played by the player. Therefore, by converting the first data format of the inter-cast video stream data into the second data format of the main video stream data, seamless switching of multiple video streams of different data formats in the player is realized, so as to achieve seamless playback during video playback and enhance the user's visual experience. Accordingly, an embodiment of the present application also provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices.
[0134] As shown in Figure 6, Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and capable of running on the processor. Among them, the processor 401 is electrically connected to the memory 402. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange components differently. The processor 401 is the control center of the electronic device 400, and utilizes various interfaces and lines to connect the various parts of the entire electronic device 400, and executes various functions and processes data of the electronic device 400 by running or loading software programs and / or units stored in the memory 402, and calling data stored in the memory 402. The processor 401 can be a processor CPU, a graphics processor GPU, a network processor (NP), etc., and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0135] In the embodiment of the present application, the processor 401 in the electronic device 400 loads instructions corresponding to one or more application processes into the memory 402 according to the following steps, and the processor 401 runs the application stored in the memory 402 to implement various functions, such as:
[0136] Get the interstitial video stream data to be played;
[0137] Determining a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data;
[0138] When it is recognized that the first data format is inconsistent with the second data format, the first data format of the interstitial video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player;
[0139] The inserted video stream data after data format conversion is played by the player.
[0140] Furthermore, various functions implemented by running the application stored in the memory 402 can also be described in the aforementioned embodiments and will not be repeated here.
[0141] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0142] Optionally, as shown in FIG6 , electronic device 400 further includes: a touch screen display 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch screen display 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407, respectively. Those skilled in the art will appreciate that the electronic device structure shown in FIG6 does not limit the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0143] The touchscreen display 403 can be used to display a graphical user interface and receive user commands generated by the graphical user interface. The touchscreen display 403 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, videos, or any combination thereof. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch direction and detects the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 401. It can also receive and execute commands sent by the processor 401. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits it to the processor 401 to determine the type of touch event. The processor 401 then provides a corresponding visual output on the display panel based on the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touchscreen display 403 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to implement input and output functions. That is, the touch display screen 403 can also be used as a part of the input unit 406 to implement the input function.
[0144] The radio frequency circuit 404 may be used to transmit and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to transmit and receive signals with the network device or other electronic devices.
[0145] Audio circuit 405 can be used to provide an audio interface between the user and the electronic device through a speaker and microphone. Audio circuit 405 can convert received audio data into electrical signals and transmit them to the speaker, which then converts them into sound signals for output. On the other hand, the microphone converts the collected sound signals into electrical signals, which are then received by audio circuit 405 and converted into audio data. The audio data is then output to processor 401 for processing, and then sent to, for example, another electronic device via RF circuit 404. Alternatively, the audio data is output to memory 402 for further processing. Audio circuit 405 may also include an earphone jack to provide communication between external headphones and the electronic device.
[0146] The input unit 406 may be configured to receive parameters of the configured interstitial video stream data (eg, the source of the interstitial video stream data, the interstitial duration of the interstitial video stream data).
[0147] Power supply 407 is used to supply power to various components of electronic device 400. Optionally, power supply 407 can be logically connected to processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. Power supply 407 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0148] Although not shown in FIG. 6 , the electronic device 400 may further include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0149] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0150] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0151] To this end, an embodiment of the present application provides a computer-readable storage medium storing a plurality of computer programs, which can be loaded by a processor to execute any of the video stream playback methods provided in the embodiments of the present application. For example, the computer program can execute the following steps of the video stream playback method:
[0152] Get the interstitial video stream data to be played;
[0153] Determining a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data;
[0154] When it is recognized that the first data format is inconsistent with the second data format, the first data format of the interstitial video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player;
[0155] The inserted video stream data after data format conversion is played by the player.
[0156] Further, the detailed steps of the above method steps can also refer to the description in the above embodiments, which will not be repeated here. The specific implementation of the above operations can refer to the above embodiments, which will not be repeated here.
[0157] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0158] Since the computer program stored in the computer-readable storage medium can execute any of the video stream playback methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the video stream playback methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0159] According to one aspect of the present application, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in various optional implementations of the above embodiments.
[0160] In the above-described embodiments of the video stream playback device, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different emphases. For portions not described in detail in a particular embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for ease and brevity of description, the specific operating processes and beneficial effects of the above-described video stream playback device, computer-readable storage medium, computer program product, electronic device, and their corresponding units can be referred to in the description of the video stream playback method in the above embodiments, and the details will not be repeated here.
[0161] The above is a detailed introduction to a video stream playback method, device, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A video stream playback method, wherein: The video stream playing method is applied to an electronic device, wherein the electronic device comprises a player, including: Get the interstitial video stream data to be played; Determining a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data; When it is identified that the first data format is inconsistent with the second data format, the first data format of the interstitial video stream data is converted into the second data format, the second data format is the data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player; The inserted video stream data after data format conversion is played by the player.
2. The video stream playback method according to claim 1, wherein: The player plays the inserted video stream data after the data format is converted, including: Replacing the inserted video stream data after data format conversion with display stream data supported by the player; The display stream data is played through the player.
3. The video stream playback method according to claim 2, wherein: The player is configured with a conversion buffer and a display buffer, and the method further comprises: The acquired interstitial video stream data is stored in the conversion buffer.
4. The video stream playback method according to claim 3, wherein: The converting the first data format of the interstitial video stream data into the second data format includes: In the conversion buffer, the first data format of the interstitial video stream data is converted into The second data format is used, and the inserted video stream data after the data format conversion is stored in the display buffer.
5. The video stream playback method according to claim 4, wherein: The player plays the inserted video stream data after the data format is converted, including: The interstitial video stream data after the data format conversion in the display buffer is played by the player.
6. The video stream playback method according to claim 5, wherein: The step of storing the inserted video stream data after data format conversion into the display buffer includes: Parsing the inserted video stream data after data format conversion to obtain a parsing result; Based on the analysis result, the interstitial video stream data is replaced with display stream data; The display stream data is stored in the display buffer.
7. The video stream playing method according to claim 5, wherein: The step of storing the inserted video stream data after data format conversion into the display buffer comprises: Decoding the inserted video stream data after data format conversion to obtain a decoding result; Based on the decoding result, replacing the interstitial video stream data with display stream data; The display stream data is stored in the display buffer.
8. The video stream playing method according to claim 5, wherein: The step of playing the interstitial video stream data after the data format conversion in the display buffer by the player includes: The display stream data in the display buffer is played by the player.
9. The video stream playback method according to any one of claims 1 to 8, wherein: The determining, according to the encapsulation format of the interstitial video stream data, the first data format of the interstitial video stream data comprises: Parsing the header information of the encapsulation format of the interstitial video stream to obtain a parsing result; According to the analysis result, a first data format of the interstitial video stream data is determined.
10. The video stream playing method according to claim 1, wherein: The interstitial video stream data includes another channel of video stream data which is interstitial in the main video stream data and played by a player; The main video stream data refers to a channel of video stream data played by a player.
11. The video stream playing method according to claim 9, wherein: The header information includes the data format of the video code stream and the data format of the audio code stream.
12. The video stream playing method according to claim 4, wherein: In the conversion buffer, the data format of the first video code stream in the interstitial video stream data is converted into the data format of the second video code stream; and / or, in the conversion buffer, the data format of the first audio code stream in the interstitial video stream data is converted into the data format of the second audio code stream; and / or, in the conversion buffer, the data format of the first video code stream in the interstitial video stream data is converted into the data format of the second video code stream, and at the same time, the data format of the first audio code stream in the interstitial video stream data is converted into the data format of the second audio code stream.
13. The video stream playing method according to claim 4, wherein: During the parsing process, the interstitial video stream data after data format conversion is replaced with display stream data that can be directly displayed by the player; and / or, during the parsing process of the main video stream data, the main video stream data is replaced with display stream data that can be directly displayed by the player.
14. The video stream playing method according to claim 13, wherein: When the interstitial video stream data is replaced with display stream data that can be directly displayed by the player, and the main video stream data is replaced with display stream data that can be directly displayed by the player, the display stream data corresponding to the interstitial video stream data and the display stream data corresponding to the main video stream data are sorted according to the playback time of the main video stream data and the interstitial video stream data, and the sorted display stream data are stored in the display buffer.
15. A video stream playback device, wherein: include: The interstitial video stream data acquisition module is used to acquire the interstitial video stream data to be played; A first data format determining module, configured to determine a first data format of the interstitial video stream data according to an encapsulation format of the interstitial video stream data; A format conversion module, configured to convert the first data format of the interstitial video stream data into the second data format when it is identified that the first data format is inconsistent with the second data format, wherein the second data format is a data format of the main video stream data, and the interstitial video stream data and the main video stream data are played adjacently in the player; The playing module is used to play the inserted video stream data after data format conversion through the player.
16. The video stream playback device according to claim 15, wherein: The player plays the inserted video stream data after the data format is converted, including: Replacing the inserted video stream data after data format conversion with display stream data supported by the player; The display stream data is played through the player.
17. The video stream playback device according to claim 16, wherein: The player is configured with a conversion buffer and a display buffer, and the method further comprises: The acquired interstitial video stream data is stored in the conversion buffer.
18. The video stream playback device according to claim 17, wherein: The converting the first data format of the interstitial video stream data into the second data format includes: In the conversion buffer, the first data format of the interstitial video stream data is converted into the second data format, and the interstitial video stream data after the data format conversion is stored in the display buffer.
19. An electronic device, wherein: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the video stream playing method according to any one of claims 1 to 14.
20. A computer-readable storage medium, wherein: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the video stream playing method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Method and device for rapidly inserting video in portable video terminal
CN101616288A
Audio playing method and device, electronic equipment and storage medium
CN110083328A
Video playing method and device, electronic equipment and computer readable storage medium
CN116347158A
Video processing method and device, electronic equipment and storage medium
CN116506633A
Video stream playing method and device, electronic equipment and storage medium
CN117615209A