CN105451071B - Video stream processing method, device and system - Google Patents
Video stream processing method, device and system Download PDFInfo
- Publication number
- CN105451071B CN105451071B CN201510802323.7A CN201510802323A CN105451071B CN 105451071 B CN105451071 B CN 105451071B CN 201510802323 A CN201510802323 A CN 201510802323A CN 105451071 B CN105451071 B CN 105451071B
- Authority
- CN
- China
- Prior art keywords
- video stream
- video
- media server
- rtsp
- acquiring
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
- H04N21/44204—Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/437—Interfacing the upstream path of the transmission network, e.g. for transmitting client requests to a VOD server
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
- H04N21/44209—Monitoring of downstream path of the transmission network originating from a server, e.g. bandwidth variations of a wireless network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
- H04N21/44213—Monitoring of end-user related data
- H04N21/44222—Analytics of user selections, e.g. selection of programs or purchase activity
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47217—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/60—Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client
- H04N21/63—Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
- H04N21/643—Communication protocols
- H04N21/6437—Real-time Transport Protocol [RTP]
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Social Psychology (AREA)
- Human Computer Interaction (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The embodiment of the invention discloses a method, a device and a system for processing video streams; the method comprises the steps that after a video playing request carrying a video stream identification is received, the video stream is obtained from a media server according to the video stream identification, when the video stream is determined to be abnormal, whether the number of attempts for obtaining the video stream is lower than a preset value is judged, if yes, the step of obtaining the video stream from the media server is returned, and if not, error reporting processing is carried out; the scheme can improve the stability and the fluency when the video is played.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, and a system for processing a video stream.
Background
With the development of internet technology and the popularization of mobile terminals, video has become the most mainstream application on the internet.
Currently, users watch live videos using mobile clients, which are implemented based on Streaming Media (Streaming Media) protocols. The streaming media refers to a media format that realizes online playing by adopting a streaming transmission mode. When the video website operator is implemented specifically, the video website operator can package the program into data packets through the video transmission server and transmit the data packets to the network, and when a user needs to watch the video, the data packets can be decompressed and played through the decompression client. Currently, the common Streaming media protocols mainly include a hypertext transfer Protocol (HTTP Live Streaming) Protocol and a Real Time Streaming Protocol (RTSP) Protocol. Among them, RTSP is a relatively general real-time streaming media protocol, which can implement the live broadcast function of video, and requires a special media player (media player) and a media server (media server). In the process of playing RTSP video, it is often encountered that video stream cannot be normally downloaded occasionally due to network instability or media server instability, and for this situation or other similar abnormal playing situations, the existing scheme generally adopts a direct error reporting manner to process, for example, pause or cancel video playing, report error information, and so on, which results in interruption of video playing.
In the process of research and practice of the prior art, the inventor of the present invention finds that the processing manner of directly reporting errors in the existing scheme is not favorable for the playing stability and fluency of the RTSP video.
Disclosure of Invention
The embodiment of the invention provides a method, a device and a system for processing a video stream, which can improve the stability and the fluency when the video is played.
The embodiment of the invention provides a method for processing a video stream, which comprises the following steps:
receiving a video playing request, wherein the video playing request carries a video stream identifier;
acquiring a video stream from a media server according to the video stream identifier;
when the video stream is determined to be abnormal, judging whether the number of attempts to acquire the video stream is lower than a preset value;
if yes, returning to the step of acquiring the video stream from the media server;
if not, error reporting processing is carried out.
Correspondingly, an embodiment of the present invention further provides a device for processing a video stream, including:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a video playing request which carries a video stream identifier;
the acquisition unit is used for acquiring the video stream from a media server according to the video stream identification;
the processing unit is used for judging whether the attempt times of acquiring the video stream are lower than a preset value or not when the abnormal acquisition of the video stream is determined; if yes, triggering an acquisition unit to execute the operation of acquiring the video stream from the media server; if not, error reporting processing is carried out.
In addition, an embodiment of the present invention further provides a system for processing a video stream, including a media server and any one of the video stream processing apparatuses provided in the embodiments of the present invention;
the media server is used for providing the video stream to the processing device of the video stream.
The embodiment of the invention adopts the steps that after a video playing request carrying a video stream identification is received, the video stream is obtained from a media server according to the video stream identification, when the video stream is determined to be abnormal, whether the trial frequency of obtaining the video stream is lower than a preset value is judged, if so, the step of obtaining the video stream from the media server is returned to be executed, otherwise, if not, error reporting processing is carried out; because the scheme can provide corresponding abnormal trial operation when the video stream is abnormal, and can ensure that the video can be continuously played to the maximum extent, compared with the scheme of directly reporting an error when the video stream is abnormal in the prior art, the scheme can improve the stability and the fluency when the video is played.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1a is a schematic view of a scene of a system for processing a video stream according to an embodiment of the present invention;
fig. 1b is a flowchart of a method for processing a video stream according to an embodiment of the present invention;
fig. 2 is another flowchart of a method for processing a video stream according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a device for processing a video stream according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a method, a device and a system for processing a video stream.
Referring to fig. 1a, the processing system of the video stream may include any one of the processing apparatuses of the video stream provided by the embodiments of the present invention, the processing apparatus of the video stream may be integrated in a terminal, and the processing system of the video stream may further include a media server for providing the video stream to the terminal.
When a user needs to watch a video, a video playing request can be triggered by clicking or selecting a playing trigger key, wherein the video playing request carries a video stream identifier, after the terminal receives the video playing request, a video stream can be acquired from a media server according to the video stream identifier, for example, a downloading request of the video stream is sent to the media server according to the video stream identifier, then the video stream returned by the media server according to the downloading request is received, and the like, then the video stream can be locally played at the terminal, in the process, if the terminal determines that the video stream is abnormal, an abnormal trying process can be started, for example, whether the number of trying times for acquiring the video stream is lower than a preset value or not is judged, if yes, the step of acquiring the video stream from the media server is returned, otherwise, if the number of trying times is higher than the preset value, for example, 3 times, an error reporting process is performed, such as releasing the video stream resource, stopping the RTSP session, and prompting a play error message, etc.
The details will be described below separately.
The first embodiment,
The present embodiment will be described from the viewpoint of a processing apparatus of a video stream, which may be specifically integrated in a terminal or the like. The video stream processing apparatus may be integrated in a terminal or other devices as a functional module, or may be installed in the terminal or other devices in a software form, which is not described herein again.
A method of processing a video stream, comprising: receiving a video playing request, wherein the video playing request carries a video stream identifier; acquiring a video stream from a media server according to the video stream identifier; when the video stream is determined to be abnormal, judging whether the number of attempts to acquire the video stream is lower than a preset value; if yes, returning to the step of acquiring the video stream from the media server; if not, error reporting processing is carried out.
As shown in fig. 1b, the specific flow of the video stream processing method may be as follows:
101. and receiving a video playing request.
For example, a video play request triggered by a user clicking a video play key or a video link address may be received, and so on.
The video play request may carry information such as a video stream identifier, which is used to identify the video stream, for example, the video stream identifier may be a name, a number, or a link address of the video stream.
The video stream may specifically be an RTSP video stream or a live video stream in other formats.
102. And acquiring the video stream from the media server according to the video stream identification. For example, the following may be specifically mentioned:
(1) and determining the link address of the video stream according to the video stream identification.
The link address indicates a storage location of the video stream in the media server.
(2) Creating a video player according to the link address, and initializing the video player;
for example, after a video player is created according to the link address, the player interface, the playing engine, the decoder, and the cache module may be respectively initialized as follows:
A. initializing a player interface;
a player interface is created, including configuration of the Layout (Layout) of the Activity (Activity) component, initialization of menus such as the sideslip menu (SlidingMenu), initialization of the underlying information bar, and initialization of the action bar, among others.
B. Initializing a playing engine;
the play engine mainly packages and compiles media resources, namely related functions of video stream play, into a dynamic link library so as to realize functions of demultiplexing, decoding, outputting and playing of the media resources, provide control interfaces of playing, pausing, fast forwarding, fast rewinding and the like, provide play information of decoding delay, audio and video formats, resolution, screen scanning modes, code rates, frame rates and the like, and realize the packaging performance and reusability of the media resource play function. Therefore, the parameters related to the above task of the play engine are mainly set at this time.
C. Initializing a decoder;
the decoder, i.e. the video decoder, refers to a program capable of compressing or decompressing digital video, and the initialization refers to configuring relevant parameters of the decoder.
D. Initializing a cache module;
the cache module is used for storing downloaded cache files in a memory mode, and is generally applied to scenes with small cache length, releasing after use and high reading speed requirement. In the embodiment of the invention, the RTSP video stream is downloaded to the cache module in a fragment form and is managed by using a memory cache mode.
Initializing the cache module includes creating and initializing the cache module, and specific creating and initializing methods may refer to the prior art and are not described herein again.
(3) And acquiring the video stream from the media server through the initialized video player according to the link address.
For example, a transport protocol type of the video stream may be determined according to the link address, a transport parameter (i.e., initialization of transport) may be configured according to the transport protocol type so that the media server allocates a video stream resource according to the transport parameter, and an RTSP session is started, and then the video stream is acquired from the media server based on the video stream resource and the RTSP session.
The Transmission Protocol type may include a Transmission Control Protocol (TCP), a User Datagram Protocol (UDP), and the like.
For example, taking the video stream as an RTSP video stream as an example, if the link address of the video stream starts with "RTSP", it may be determined that the transport protocol type of the video stream is TCP, and therefore, the transport parameters may be configured according to the TCP protocol, for example, when in transmission, the control layer may use the TCP protocol to transmit control information, and what network protocol should be used by the transport layer; if the link address of the video stream does not start with "rtsp", it may be determined that the transport protocol type of the video stream is UDP, and then, the transport parameters may be configured by using UDP protocol, for example, during transport, the control layer may use UDP protocol to transport control information, and what network protocol should be used by the transport layer, and so on.
After configuring the transmission parameters, after the transmission is initialized, the media server may allocate the video stream resources according to the transmission parameters, and start an RTSP session, so as to start data transmission of the video stream, for example, at this time, the terminal may send a request for downloading the video stream to the media server based on the video stream resources and the RTSP session, and then receive the video stream returned by the media server.
After the terminal downloads the video stream, the video stream may be cached in the memory by the cache module, so as to be called by the play engine and the decoder, and played.
103. When the video stream is determined to be abnormal, judging whether the number of attempts to acquire the video stream is lower than a preset value, if so, returning to the step of acquiring the video stream from the media server, for example, returning to the step of acquiring the video stream from the media server through the initialized video player according to the link address; otherwise, if not, go to step 104.
For example, whether the "number of attempts to acquire a video stream" is lower than a preset value may be determined through two layers, as follows:
judging whether the number of attempts of the transmission layer network protocol is lower than a preset first threshold value or not;
if the video stream resource is lower than the first threshold, returning to execute the step of acquiring the video stream from the media server based on the video stream resource and the RTSP session (see the description in the step 102);
if not, determining whether the number of RTSP session attempts is lower than a preset second threshold, if so, releasing the video stream resource, stopping the RTSP session, and returning to the step of configuring the transmission parameters according to the type of the transmission protocol (see description in step 102); if not, go to step 104.
The preset value, the first threshold value and the second threshold value may be set according to requirements of practical applications, for example, the first threshold value and the second threshold value may be set for 3 times, which is not described herein again.
The abnormal acquisition of the video stream refers to a situation that the video stream cannot be normally downloaded due to unstable network, unstable media server, or other reasons.
104. And when the number of attempts of acquiring the video stream is not lower than a preset value, carrying out error reporting processing.
For example, the video stream resource may be released, and the RTSP session may be stopped and a play error message may be prompted.
Optionally, after the error reporting process is performed, in order to save resources, the corresponding space may be released, for example, the cache module is released.
In addition, if the video stream is not abnormal, the video stream can be continuously downloaded until the user quits the video player. After exiting the video player, the buffer module, decoder, etc. may likewise be released to free up resources.
As can be seen from the above, in the embodiment, after a video playing request carrying a video stream identifier is received, a video stream is acquired from a media server according to the video stream identifier, when it is determined that the acquisition of the video stream is abnormal, whether the number of attempts to acquire the video stream is lower than a preset value is determined, if so, the step of acquiring the video stream from the media server is returned to be executed, and otherwise, if not, an error reporting process is performed; because the scheme can provide corresponding abnormal trying operation when the video stream is abnormal, and can ensure that the video can be continuously played to the maximum extent, compared with the scheme that the error is directly reported when the video stream is abnormal in the prior art, the scheme can provide the scheme for improving the stability and the fluency when the video is played, such as the RTSP video, and greatly improves the user experience.
Example II,
The method described in the first embodiment is further illustrated by way of example.
In this embodiment, a description will be given taking an example in which the processing device of the video stream is specifically integrated in the terminal, and the video stream is specifically an RTSP video stream.
As shown in fig. 2, a specific flow of a method for processing a video stream may be as follows:
201. and the terminal receives a video playing request triggered by a user.
For example, the terminal may receive a video play request triggered by a user clicking a video play key or a video link address, and so on.
The video play request may carry information such as an RTSP video stream identifier, where the video stream identifier is used to identify a video stream, and for example, the video stream identifier may be a name, a number, or a link address of the video stream.
202. And the terminal determines the link address of the RTSP video stream according to the RTSP video stream identifier.
The link address indicates a storage location of the RTSP video stream in the media server, such as a Uniform Resource Locator (URL) or the like.
203. The terminal creates a video player according to the link address, and initializes a player interface, a playing engine, a decoder and a cache module respectively, as follows:
(1) initializing a player interface;
a player interface is created, including configuration of the Layout of the Activity component, initialization of menus such as slidedingmenu, initialization of underlying information bars, and initialization of actionbars, among others.
(2) Initializing a playing engine;
the play engine mainly packages and compiles media resources, namely related functions of RTSP video stream play, into a dynamic link library so as to realize functions of demultiplexing, decoding, output play and the like of the media resources, provide control interfaces of play, pause, fast forward, fast backward and the like, provide play information of decoding delay, audio and video formats, resolution, screen scanning modes, code rates, frame rates and the like, and realize the packaging performance and reusability of the media resource play function. Therefore, at this time, the parameters related to the task of the play engine are mainly set, for example, part of the video stream information may be read from the video memory cache of the cache module to initialize the video play engine.
(3) Initializing a decoder;
the decoder, i.e. the video decoder, refers to a program capable of compressing or decompressing digital video, and the initialization refers to configuring relevant parameters of the decoder, for example, part of video stream information may be read from a video memory buffer of the buffer module to initialize the decoder.
(4) Initializing a cache module;
the cache module is used for storing downloaded cache files in a memory mode, and is generally applied to scenes with small cache length, releasing after use and high reading speed requirement. In the embodiment of the invention, the RTSP video stream is downloaded from the network in the form of video clips and is managed in a memory cache mode.
Initializing the cache module includes creating and initializing the cache module, and specific creating and initializing methods may refer to the prior art and are not described herein again.
204. The terminal determines whether a link address of the RTSP video stream, such as a URL, starts with "RTSP", if so, configures the transmission parameter according to the TCP protocol, and if not, configures the transmission parameter by using the UDP protocol, which may specifically be as follows:
the terminal determines whether the link address of the RTSP video stream starts with "RTSP", and if so, the transmission protocol type of the RTSP video stream may be determined to be TCP, so that the transmission parameters may be configured according to the TCP protocol, for example, when transmitting, the control layer may transmit control information by using the TCP protocol and use a specified port number, and transmit the control information with the media server through the control layer, so as to negotiate which network protocol the transport layer (for the player and the server to transfer control streaming media data) uses, for example, use UDP, RDP, or TCP, etc.; if the link address of the RTSP video stream does not start with "RTSP", it may be determined that the transport protocol type of the video stream is UDP, and then, a UDP protocol may be used to configure the transport parameters, for example, during transport, the control layer may use the UDP protocol to transport control information and use a specified port number, and transport the control information with the media server through the control layer, so as to negotiate which network protocol the transport layer (for the player and the server to transfer control stream media data) uses, for example, use UDP, RDP, or TCP.
Note that if the port number is empty or unspecified, the 554 port may be used.
The process in which the media server negotiates which network protocol the transport layer uses may also be referred to as transport initialization.
205. The media server allocates the video stream resource according to the transmission parameter, and starts the RTSP session, and further starts the data transmission of the RTSP video stream.
206. The terminal obtains the RTSP video stream from the media server based on the video stream resource and the RTSP session, such as downloading the RTSP video stream.
For example, the terminal may send a download request of the RTSP video stream to the media server based on the video stream resource and the RTSP session, and then receive the RTSP video stream returned by the media server.
For example, the RTSP video stream may be downloaded from the media server by using the transport layer network protocol (e.g., UDP, RDP, or TCP) determined in step 204, and the downloaded RTSP video stream is stored in the memory for being called and played by the video playing engine and the decoder.
Wherein, at most, how much RTSP video stream is buffered is determined by the negotiation between the video player in the terminal and the media server.
207. The terminal plays the RTSP video stream through the video player, which may specifically be as follows:
the playing engine of the video player drives to play the RTSP video stream segment, for example, the RTSP video stream data may be read from the memory buffer of the buffer module, and the decoder is used to decode, render, and output the picture and sound. The played memory buffer is released immediately, and then the buffer is driven to continue to buffer the following RTSP video stream data.
The playing engine needs to communicate with the cache module to coordinate to ensure that the video player can always play the RTSP video stream normally.
208. The terminal determines whether the RTSP video stream is abnormal, if so, step 209 is executed, and if not, step 212 is executed.
The abnormal acquisition of the RTSP video stream refers to a situation that the RTSP video stream cannot be normally downloaded due to unstable network, unstable media server, or other reasons.
209. When the terminal determines that the RTSP video stream is abnormally acquired, it determines whether the number of attempts of the transport layer network protocol is lower than a preset first threshold, if so, the terminal attempts to download the RTSP video stream again by using the original transport layer network protocol, that is, returns to step 206, otherwise, if not, the terminal indicates that the RTSP video stream is not successfully downloaded after multiple attempts (the first threshold), and thus step 210 is performed.
The first threshold may be set according to the requirement of the actual application, for example, may be set to 3 times, and is not described herein again.
210. The terminal judges whether the number of times of the RTSP session attempt is lower than a preset second threshold, if so, the RTSP video stream resource is released, the RTSP session is stopped, the transmission parameter is attempted to be reconfigured so as to download the video stream again, namely, the step of configuring the transmission parameter in the step 204 is returned to; otherwise, if not lower than the second threshold, it indicates that the downloading has not been successful after multiple consecutive attempts (the second threshold), and then step 211 is executed.
The second threshold may be set according to the requirement of the actual application, for example, may be set to 3 times, and is not described herein again.
211. The terminal performs error reporting processing, for example, may release the video stream resource, stop the RTSP session, and prompt to play error information.
Optionally, after the error reporting processing is performed, in order to save resources, the corresponding space may be released, for example, the cache module is released, and the process ends.
212. If the RTSP video stream is not abnormal, the terminal judges whether the user quits the video player, if so, the cache module, the decoder and the like are released to release resources and the like, and the process is ended; otherwise, if the video player is not exited, the next video stream is downloaded continuously, i.e. the process returns to step 206.
As can be seen from the above, in the embodiment, after a video playing request carrying an RTSP video stream identifier is received, the RTSP video stream is acquired from the media server according to the RTSP video stream identifier, when it is determined that the RTSP video stream acquisition is abnormal, it is determined whether the number of attempts of a transport layer network protocol is lower than a first threshold, and when it is not lower than the first threshold, it is further determined whether the number of attempts of an RTSP session is lower than a preset second threshold, so as to determine whether to perform a corresponding abnormal attempt operation, and after the corresponding abnormal attempt operation is performed, an error reporting process is performed; because this scheme can provide corresponding unusual attempt operation when the video stream appears unusually, and the at utmost ensures that the video can continue playing, consequently, the scheme that just reports the mistake directly when meetting the anomaly in prior art can provide stability and the smoothness when improving the broadcast RTSP video, improves user experience greatly.
Example III,
In order to better implement the above method, an embodiment of the present invention further provides a processing apparatus for a video stream, which may include a receiving unit 301, an obtaining unit 302, and a processing unit 303, as shown in fig. 3, as follows:
(1) a receiving unit 301;
the receiving unit 301 is configured to receive a video playing request.
For example, the receiving unit 301 may be configured to receive a video playing request triggered by a user clicking a video playing key or a video link address, and the like.
The video play request may carry information such as a video stream identifier, which is used to identify the video stream, for example, the video stream identifier may be a name, a number, or a link address of the video stream.
The video stream may specifically be an RTSP video stream or a live video stream in other formats.
(2) An acquisition unit 302;
an obtaining unit 302, configured to obtain the video stream from the media server according to the video stream identifier.
(3) A processing unit 303;
the processing unit 303 is configured to determine whether the number of attempts to acquire the video stream is lower than a preset value when it is determined that the acquisition of the video stream is abnormal; if yes, triggering the obtaining unit 302 to execute the operation of obtaining the video stream from the media server; if not, error reporting processing is carried out. For example, the following may be used:
judging whether the number of attempts of the transmission layer network protocol is lower than a preset first threshold value or not;
if the RTSP is lower than the first threshold value, returning to trigger the acquiring subunit to execute the operation of acquiring the video stream from the media server based on the video stream resource and the RTSP session;
if the RTSP session is not lower than the first threshold, judging whether the number of times of the RTSP session attempts is lower than a preset second threshold, if so, releasing the video stream resource, stopping the RTSP session, and triggering an acquisition subunit to execute the operation of configuring the transmission parameters according to the type of the transmission protocol; and if the threshold value is not lower than the second threshold value, carrying out error reporting processing.
For example, the video stream resource may be released, the RTSP session may be stopped, and a play error message may be prompted, that is:
the processing unit 303 may be specifically configured to release the video stream resource, stop the RTSP session, and prompt to play an error message when it is determined that the number of RTSP session attempts is not lower than a preset second threshold.
The abnormal video stream refers to a situation that the video stream cannot be normally downloaded due to unstable network, unstable media server, or other reasons.
Optionally, after the error reporting process is performed, in order to save resources, the corresponding space may be released, for example, the cache module is released.
In addition, if the video stream is not obtained abnormally, the obtaining unit 302 may continue to download the video stream until the user exits the video player. After exiting the video player, the buffer module, decoder, etc. may likewise be released to free up resources.
The obtaining unit 302 may include a determining subunit, a creating subunit, and an obtaining subunit, as follows:
the determining subunit is configured to determine a link address of the video stream according to the video stream identifier.
And the creating subunit is used for creating a video player according to the link address and initializing the video player.
For example, after the video player is created according to the link address, the creating subunit may initialize the player interface, the playing engine, the decoder, the cache module, and the like, respectively, which is detailed in the foregoing embodiments and is not described herein again.
And the acquisition subunit is used for acquiring the video stream from the media server through the initialized video player according to the link address.
For example, the obtaining sub-unit may be specifically configured to determine a transport protocol type of the video stream according to the link address, configure a transport parameter according to the transport protocol type, so that the media server allocates a video stream resource according to the transport parameter, and start an RTSP session, and then obtain the video stream from the media server based on the video stream resource and the RTSP session.
At this time, the processing unit 303 may be specifically configured to determine whether the number of attempts to acquire the video stream is lower than a preset value when the acquisition of the video stream is abnormal; if yes, triggering the obtaining subunit to execute the operation of obtaining the video stream from the media server through the initialized video player according to the link address, and if not, performing error reporting processing.
The Transmission Protocol type may include a Transmission Control Protocol (TCP), a User Datagram Protocol (UDP), and the like.
For example, taking the video stream as an RTSP video stream as an example, if the link address of the video stream starts with "RTSP", the obtaining subunit may determine that the transport protocol type of the video stream is TCP, and thus, may configure the transport parameters according to the TCP protocol, for example, when transmitting, the control layer may use the TCP protocol to transmit the control information, and what network protocol should be used by the transport layer, and the like; if the link address of the video stream does not start with "rtsp", the acquiring subunit may determine that the transport protocol type of the video stream is UDP, and may configure the transport parameters by using the UDP protocol, for example, during transport, the control layer may use the UDP protocol to transport the control information, and what network protocol should be used by the transport layer, and so on.
After configuring the transmission parameters, after the transmission is initialized, the media server may allocate the video stream resources according to the transmission parameters, and start an RTSP session, so as to start data transmission of the video stream, for example, at this time, the acquiring sub-unit may send a download request of the video stream to the media server based on the video stream resources and the RTSP session, and then receive the video stream returned by the media server.
After the acquiring subunit downloads the video stream, the caching module may cache the video stream in a memory for a playback engine, a decoder, and the like to call and play.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
The video stream processing apparatus may be specifically integrated in a terminal or the like. The terminal may specifically be a mobile phone, a tablet computer, or a notebook computer.
As can be seen from the above, in the processing apparatus for video stream of this embodiment, after receiving the video playing request carrying the video stream identifier, the obtaining unit 301 obtains the video stream from the media server according to the video stream identifier, and when determining that the obtaining of the video stream is abnormal, the processing unit 303 determines whether the number of attempts to obtain the video stream is lower than a preset value, if so, the obtaining unit 302 is triggered to execute the operation of obtaining the video stream from the media server, otherwise, if not, the error reporting processing is performed; because the scheme can provide corresponding abnormal trying operation when the video stream is abnormal, and can ensure that the video can be continuously played to the maximum extent, compared with the scheme that the error is directly reported when the video stream is abnormal in the prior art, the scheme can provide the scheme for improving the stability and the fluency when the video is played, such as the RTSP video, and greatly improves the user experience.
Example four,
Correspondingly, an embodiment of the present invention further provides a system for processing a video stream, which may include any one of the processing apparatuses for a video stream provided in the embodiment of the present invention, which is described in detail in the third embodiment, wherein the processing apparatus for a video stream may be integrated in a device such as a terminal, and for example, the processing apparatus for a video stream may be as follows:
the processing device of the video stream, is used for receiving the video and broadcasting the request, the video broadcasts the request and carries the video stream label; acquiring a video stream from a media server according to the video stream identifier; when the video stream is determined to be abnormal, judging whether the number of attempts to acquire the video stream is lower than a preset value; if yes, returning to the step of acquiring the video stream from the media server; if not, error reporting processing is carried out.
For example, the processing apparatus for the video stream may be specifically configured to determine a link address of the video stream according to the video stream identifier, create a video player according to the link address, initialize the video player, and obtain the video stream from the media server through the initialized video player according to the link address; judging whether the number of attempts of the transmission layer network protocol is lower than a preset first threshold value or not; if the RTSP is lower than the first threshold value, returning to execute the operation of acquiring the video stream from the media server based on the video stream resource and the RTSP session; if the RTSP session is not lower than the first threshold, judging whether the number of times of the RTSP session attempts is lower than a preset second threshold, if so, releasing the video stream resource, stopping the RTSP session, and returning to execute the operation of configuring the transmission parameters according to the type of the transmission protocol; and if the threshold value is not lower than the second threshold value, carrying out error reporting processing.
The first threshold and the second threshold may be set according to requirements of practical applications, for example, the first threshold and the second threshold may be set for 3 times, which is not described herein again.
The video stream processing system may further include other devices, for example, a media server, as follows:
the media server is used for providing the video stream to the video stream processing device.
The specific implementation of each device can be referred to the previous embodiment, and is not described herein again.
Since the processing system for video stream may include any video stream processing apparatus provided in the embodiment of the present invention, beneficial effects that can be achieved by any video stream processing apparatus provided in the embodiment of the present invention can be achieved, for details, see the foregoing embodiment, and are not described herein again.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The foregoing describes in detail a method, an apparatus, and a system for processing a video stream according to an embodiment of the present invention, and a specific example is applied in the description to explain the principles and implementations of the present invention, and the description of the foregoing embodiments is only used to help understand the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A method for processing a video stream, comprising:
receiving a video playing request, wherein the video playing request carries a video stream identifier;
acquiring a video stream from a media server according to the video stream identifier;
when the video stream is determined to be abnormal, judging whether the number of attempts to acquire the video stream is lower than a preset value;
if yes, returning to the step of acquiring the video stream from the media server;
if not, performing error reporting processing;
wherein the step of obtaining the video stream from the media server according to the video stream identification comprises:
determining a link address of the video stream according to the video stream identification;
determining the transmission protocol type of the video stream according to the link address;
configuring transmission parameters according to the type of the transmission protocol so that the media server allocates video stream resources according to the transmission parameters and starts a real-time streaming protocol (RTSP) session;
acquiring a video stream from a media server based on the video stream resource and the RTSP session;
judging whether the number of attempts to acquire the video stream is lower than a preset value or not, if so, returning to the step of acquiring the video stream from the media server; if not, performing error reporting processing, including:
judging whether the number of attempts of the transmission layer network protocol is lower than a preset first threshold value or not; wherein the step of determining a transport layer network protocol is a step of determining a transport protocol type of the video stream;
if the current value is lower than the preset first threshold value, returning to execute the step of acquiring the video stream from the media server based on the video stream resource and the RTSP session;
if the RTSP conversation is not lower than a preset first threshold, judging whether the number of times of RTSP conversation attempts is lower than a preset second threshold, if the RTSP conversation attempts is lower than the preset second threshold, releasing the video stream resource, stopping the RTSP conversation, and returning to the step of executing the configuration of transmission parameters according to the type of the transmission protocol; if the value is not lower than the preset second threshold value, error reporting processing is carried out; the step of judging the RTSP conversation is a step of acquiring a video stream from a media server based on the video stream resource and the RTSP conversation.
2. The method of claim 1, wherein obtaining the video stream from the media server according to the video stream identifier comprises:
determining a link address of the video stream according to the video stream identification;
creating a video player according to the link address, and initializing the video player;
acquiring a video stream from a media server through an initialized video player according to the link address;
the step of returning and executing the video stream acquired from the media server specifically comprises: and returning to execute the step of acquiring the video stream from the media server through the initialized video player according to the link address.
3. The method of claim 2, wherein initializing the video player comprises:
and respectively initializing the player interface, the playing engine, the decoder and the cache module.
4. The method of claim 1, wherein the performing error handling comprises:
and releasing the video stream resource, stopping the RTSP session, and prompting to play error information.
5. A device for processing a video stream, comprising:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a video playing request which carries a video stream identifier;
the acquisition unit is used for acquiring the video stream from a media server according to the video stream identification;
the processing unit is used for judging whether the attempt times of acquiring the video stream are lower than a preset value or not when the abnormal acquisition of the video stream is determined; if yes, triggering an acquisition unit to execute the operation of acquiring the video stream from the media server; if not, performing error reporting processing;
the acquiring unit is specifically configured to determine a link address of the video stream according to the video stream identifier;
determining the transmission protocol type of the video stream according to the link address;
configuring transmission parameters according to the type of the transmission protocol so that the media server allocates video stream resources according to the transmission parameters and starts a real-time streaming protocol (RTSP) session;
acquiring a video stream from a media server based on the video stream resource and the RTSP session;
the processing unit judges whether the number of attempts to acquire the video stream is lower than a preset value or not, and if so, returns to the step of acquiring the video stream from the media server; if not, the step of performing error reporting processing comprises the following steps:
judging whether the number of attempts of the transmission layer network protocol is lower than a preset first threshold value or not; wherein the step of determining a transport layer network protocol is a step of determining a transport protocol type of the video stream;
if the current value is lower than the preset first threshold value, returning to execute the step of acquiring the video stream from the media server based on the video stream resource and the RTSP session;
if the RTSP conversation is not lower than a preset first threshold, judging whether the number of times of RTSP conversation attempts is lower than a preset second threshold, if the RTSP conversation attempts is lower than the preset second threshold, releasing the video stream resource, stopping the RTSP conversation, and returning to the step of executing the configuration of transmission parameters according to the type of the transmission protocol; if the value is not lower than the preset second threshold value, error reporting processing is carried out; the step of judging the RTSP conversation is a step of acquiring a video stream from a media server based on the video stream resource and the RTSP conversation.
6. The apparatus of claim 5, wherein the obtaining unit comprises a determining subunit, a creating subunit, and an obtaining subunit;
the determining subunit is configured to determine a link address of the video stream according to the video stream identifier;
the creating subunit is used for creating a video player according to the link address and initializing the video player;
the obtaining subunit is used for obtaining the video stream from the media server through the initialized video player according to the link address;
the processing unit is specifically configured to determine whether the number of attempts to acquire the video stream is lower than a preset value when it is determined that the acquisition of the video stream is abnormal; if yes, triggering the obtaining subunit to execute the operation of obtaining the video stream from the media server through the initialized video player according to the link address, and if not, performing error reporting processing.
7. The apparatus of claim 6,
the creating subunit is specifically configured to create a video player according to the link address, and initialize a player interface, a play engine, a decoder, and a cache module, respectively.
8. The apparatus of claim 5,
and the processing unit is specifically configured to release the video stream resource, stop the RTSP session, and prompt to play error information when determining that the number of RTSP session attempts is not lower than a preset second threshold.
9. A system for processing video streams, comprising a media server and a device for processing video streams according to any one of claims 5 to 8;
the media server is used for providing the video stream to the processing device of the video stream.
10. A storage medium having stored therein processor-executable instructions, which are loaded by one or more processors to perform a method of processing a video stream as claimed in any one of claims 1 to 4.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510802323.7A CN105451071B (en) | 2015-11-18 | 2015-11-18 | Video stream processing method, device and system |
PCT/CN2016/102664 WO2017084467A1 (en) | 2015-11-18 | 2016-10-20 | Method for processing video stream, device, and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510802323.7A CN105451071B (en) | 2015-11-18 | 2015-11-18 | Video stream processing method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105451071A CN105451071A (en) | 2016-03-30 |
CN105451071B true CN105451071B (en) | 2021-05-07 |
Family
ID=55560786
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510802323.7A Active CN105451071B (en) | 2015-11-18 | 2015-11-18 | Video stream processing method, device and system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105451071B (en) |
WO (1) | WO2017084467A1 (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105451071B (en) * | 2015-11-18 | 2021-05-07 | 腾讯科技(深圳)有限公司 | Video stream processing method, device and system |
CN106331749B (en) * | 2016-08-31 | 2020-04-24 | 北京贝塔科技股份有限公司 | Video request method and system |
CN111356017B (en) * | 2018-12-24 | 2022-05-13 | 浙江宇视科技有限公司 | Video monitoring network equipment keep-alive method and device |
CN112423146B (en) * | 2019-08-21 | 2023-10-03 | 亦非云互联网技术(上海)有限公司 | Method, system, medium, server and playing terminal for acquiring and pushing playing data |
CN112135199B (en) * | 2020-09-23 | 2022-07-29 | 平安国际智慧城市科技股份有限公司 | Video playing method based on multiple types of video sources and related equipment |
CN114339420B (en) * | 2020-10-09 | 2024-05-17 | 北京神州数码云科信息技术有限公司 | Streaming method and device, electronic equipment and storage medium |
CN115701710A (en) * | 2021-08-02 | 2023-02-10 | 北京字节跳动网络技术有限公司 | Live content switching and displaying method, device, equipment and medium |
CN113709518B (en) * | 2021-08-24 | 2023-11-28 | 天津津航计算技术研究所 | Real-time video transmission mode design method based on RTSP protocol |
CN115150369A (en) * | 2022-06-29 | 2022-10-04 | 湖北天融信网络安全技术有限公司 | Audio and video proxy method and audio and video proxy container |
CN116847113B (en) * | 2023-06-20 | 2024-03-12 | 联城科技(河北)股份有限公司 | Video live broadcast transfer method, device, equipment and medium based on cloud architecture module |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101888377A (en) * | 2010-05-26 | 2010-11-17 | 中兴通讯股份有限公司 | Communication method, media server and communication system |
CN102144390A (en) * | 2008-09-04 | 2011-08-03 | Sk电信有限公司 | Media transmission system and method |
CN102231863A (en) * | 2011-06-02 | 2011-11-02 | 南京中兴力维软件有限公司 | Transmission method of multichannel video streams and system thereof |
CN102333083A (en) * | 2011-08-24 | 2012-01-25 | 中兴通讯股份有限公司 | Method and system for transmitting data |
CN103716656A (en) * | 2013-12-11 | 2014-04-09 | 乐视网信息技术(北京)股份有限公司 | Video loading method and electronic device |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2910211A1 (en) * | 2006-12-19 | 2008-06-20 | Canon Kk | METHODS AND DEVICES FOR RE-SYNCHRONIZING A DAMAGED VIDEO STREAM |
WO2009061829A1 (en) * | 2007-11-05 | 2009-05-14 | Limelight Networks, Inc. | End to end data transfer |
CN103259802A (en) * | 2013-06-03 | 2013-08-21 | 贝壳网际(北京)安全技术有限公司 | Media file downloading method and device and client device |
CN104735473B (en) * | 2015-03-05 | 2018-03-09 | 天脉聚源(北京)科技有限公司 | A kind of detection method and device of video render |
CN105451071B (en) * | 2015-11-18 | 2021-05-07 | 腾讯科技(深圳)有限公司 | Video stream processing method, device and system |
-
2015
- 2015-11-18 CN CN201510802323.7A patent/CN105451071B/en active Active
-
2016
- 2016-10-20 WO PCT/CN2016/102664 patent/WO2017084467A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102144390A (en) * | 2008-09-04 | 2011-08-03 | Sk电信有限公司 | Media transmission system and method |
CN101888377A (en) * | 2010-05-26 | 2010-11-17 | 中兴通讯股份有限公司 | Communication method, media server and communication system |
CN102231863A (en) * | 2011-06-02 | 2011-11-02 | 南京中兴力维软件有限公司 | Transmission method of multichannel video streams and system thereof |
CN102333083A (en) * | 2011-08-24 | 2012-01-25 | 中兴通讯股份有限公司 | Method and system for transmitting data |
CN103716656A (en) * | 2013-12-11 | 2014-04-09 | 乐视网信息技术(北京)股份有限公司 | Video loading method and electronic device |
Also Published As
Publication number | Publication date |
---|---|
WO2017084467A1 (en) | 2017-05-26 |
CN105451071A (en) | 2016-03-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105451071B (en) | Video stream processing method, device and system | |
CN113423018B (en) | Game data processing method, device and storage medium | |
US10728601B2 (en) | Enhanced streaming source change | |
US20150256600A1 (en) | Systems and methods for media format substitution | |
CN111246284B (en) | Video stream playing method, system, terminal and storage medium | |
US9356985B2 (en) | Streaming video to cellular phones | |
RU2647654C2 (en) | System and method of delivering audio-visual content to client device | |
CN108063769B (en) | Method and device for realizing content service and content distribution network node | |
US10958972B2 (en) | Channel change method and apparatus | |
US9544630B2 (en) | Method and IPTV server for enabling playout of one or more media objects | |
EP2903260A1 (en) | Multi-speed playing method, device and system | |
JP2005537742A (en) | Streaming multimedia data | |
KR102434958B1 (en) | Indications for Partial Segments | |
KR20170000312A (en) | Method and apparatus for digital broadcast services | |
WO2017071428A1 (en) | Fast forward/rewind processing method and terminal | |
EP3113442A1 (en) | Method and server for improving quality in adaptive streaming delivery systems | |
CN116261021B (en) | Video stream playing method and device, electronic equipment and storage medium | |
WO2022166591A1 (en) | Method and apparatus for playing live streaming resource, and storage medium and electronic device | |
CN112532719A (en) | Information flow pushing method, device, equipment and computer readable storage medium | |
CN113438513A (en) | Video resolution switching method, device, equipment and storage medium | |
CN115460471B (en) | Video playing method, device, electronic equipment and computer readable medium | |
KR102454470B1 (en) | Method and apparatus for supporting a streaming service | |
CN113905025A (en) | Method, device, medium and computer equipment for transmitting stream data | |
Dong et al. | A Study on H. 264 Live Video Technology with Android System |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20221114 Address after: 1402, Floor 14, Block A, Haina Baichuan Headquarters Building, No. 6, Baoxing Road, Haibin Community, Xin'an Street, Bao'an District, Shenzhen, Guangdong 518,101 Patentee after: Shenzhen Yayue Technology Co.,Ltd. Address before: 2, 518000, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd. |