WO2017084467A1 - Method for processing video stream, device, and system - Google Patents

Method for processing video stream, device, and system Download PDF

Info

Publication number
WO2017084467A1
WO2017084467A1 PCT/CN2016/102664 CN2016102664W WO2017084467A1 WO 2017084467 A1 WO2017084467 A1 WO 2017084467A1 CN 2016102664 W CN2016102664 W CN 2016102664W WO 2017084467 A1 WO2017084467 A1 WO 2017084467A1
Authority
WO
WIPO (PCT)
Prior art keywords
video stream
video
media server
threshold
attempts
Prior art date
Application number
PCT/CN2016/102664
Other languages
French (fr)
Chinese (zh)
Inventor
应玉龙
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2017084467A1 publication Critical patent/WO2017084467A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring 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/44204Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/437Interfacing the upstream path of the transmission network, e.g. for transmitting client requests to a VOD server
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring 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/44209Monitoring of downstream path of the transmission network originating from a server, e.g. bandwidth variations of a wireless network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing 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/442Monitoring 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/44213Monitoring of end-user related data
    • H04N21/44222Analytics of user selections, e.g. selection of programs or purchase activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-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/47217End-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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network 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/63Control 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/643Communication protocols
    • H04N21/6437Real-time Transport Protocol [RTP]

Definitions

  • This application relates to
  • streaming Media refers to a media format that implements online playback by means of streaming.
  • the video website operator can package the program as a digital packet and send it to the network through the video delivery server.
  • the user can extract the data by decompressing the client and decompressing the data. Play.
  • common streaming protocols mainly include real-time streaming based on hypertext transfer protocol.
  • RTSP Real Time Streaming Protocol
  • HLS HTTP Live Streaming
  • RTSP Real Time Streaming Protocol
  • the embodiment of the present application provides a method, a device, and a system for processing a video stream, which can improve stability and fluency when playing video.
  • An embodiment of the present application provides a method for processing a video stream, including:
  • An acquiring unit configured to acquire a video stream from the media server according to the video stream identifier
  • a processing unit configured to determine, when an abnormality occurs in the acquisition of the video stream, determining whether the number of attempts to obtain the video stream is lower than a preset value; if yes, The trigger acquisition unit performs an operation of acquiring a video stream from the media server; if not, the error processing is performed.
  • the embodiment of the present application further provides a processing system for a video stream, including a media server and a processing device for any video stream provided by the embodiment of the present application;
  • the media server is configured to provide a video stream to a processing device of the video stream.
  • the embodiment of the present application After receiving the video play request carrying the video stream identifier, the embodiment of the present application obtains the video stream from the media server according to the video stream identifier, and determines whether the number of attempts to obtain the video stream is low when determining that the video stream is abnormally acquired. At the preset value, if yes, returning to perform the step of acquiring the video stream from the media server, otherwise, if the value is not lower than the preset value, the error processing is performed; because the scheme is abnormal when the video stream is abnormal, the corresponding abnormal attempt may be provided. Operation, to the maximum extent, the video can continue to play. Therefore, compared with the prior art, in the case of encountering an abnormality, the solution directly and incorrectly can provide stability and fluency when the video is played. BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1a is a schematic diagram of a process of processing a video stream according to an embodiment of the present disclosure
  • FIG. 1b is a flowchart of a method for processing a video stream according to an embodiment of the present application
  • FIG. 2 is another flowchart of a method for processing a video stream according to an embodiment of the present disclosure
  • FIG. 3 is a schematic diagram of a device for processing a video stream according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of a video stream processing apparatus according to an embodiment of the present application. Implementation. This application - clear way
  • the embodiment of the present application provides a method, an apparatus, and a system for processing a video stream.
  • the processing system of the video stream may include any processing device of the frequency stream provided by the embodiment of the present application, where the processing device of the frequency stream may be integrated in the terminal, and further, the processing system of the video stream further A media server can be included for providing a video stream to the terminal.
  • the video play request can be triggered by clicking or selecting the play trigger button.
  • the video play request carries a video stream identifier.
  • the terminal may obtain a video stream from the media server according to the video stream identifier.
  • the root sends a download request of the video stream to the media server according to the video stream identifier, and then connects The receiving media media server server roots according to the downloading request to request the return of the video video stream, back to and so on. . Then, after that, the video stream can be played in the local terminal at the terminal end. .
  • the terminal end determines that the video stream of the fixed-view video has been abnormally abnormal, then it may be possible to start the trial flow process with the start-up exception. If it is judged that the number of trial attempts to obtain the video stream stream is lower than the pre-set value. . If the answer is yes, then the return receipt execution line obtains the step of obtaining the video stream from the media server server. . Otherwise, if the number of attempts to try has exceeded the pre-preset value, for example, 33 times, then the line will report the error, for example, The release of the said video video stream source resource, and the suspension of the said RRTTSSPP session, and prompting the broadcast to play the wrong error message, Etc., etc. .
  • the problem is that the abnormality is directly and directly reported to the ttoo error processing method.
  • the case can be increased and the playback of the RRTTSSPP video frequency is stabilized and stable, and the flow is smooth. .
  • the embodiment of the present embodiment will advance the angular angle of the processing and processing device from the video and video stream, and the processing of the video and video stream will be described.
  • the physical device can be integrated into the device at the terminal end or the like.
  • the processing and processing device of the video video stream may be integrated into the device set in the terminal terminal or the like as a function module of the one-function function, and also It may be installed in the form of a soft body, installed at the terminal end, etc.
  • a processing method for processing video frequency stream includes: receiving and receiving a video broadcast, and requesting, and requesting the video broadcast
  • the video stream stream identifier is identified; the root obtains the video stream from the media server server according to the stream identifier of the video stream; and determines the video stream stream.
  • the number of trial attempts to obtain the video stream stream is determined to be lower than the pre-set value; if so, Then, the return receipt execution line obtains the step of obtaining the video frequency stream from the media server server; if not, the line 2200 reports the error processing. . .
  • the specific body flow process of the processing method of the video video stream may be as follows:
  • it may be triggered by receiving and receiving the user account through a click through the video broadcast play button or by touching the ground address of the video frequency link.
  • Video frequency stream tag identification To identify the video stream.
  • the video stream identifier can 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.
  • the video stream identifier is obtained from the media server according to the video stream identifier.
  • the details can be as follows:
  • the link address indicates where the video stream is stored in the media server.
  • the player interface, the playback engine, the decoder, and the cache module can be initialized separately, as follows.
  • the main task of the playback engine is to encapsulate the media resources, that is, the related functions of the video stream playback, and compile them into a dynamic link library to implement functions such as demultiplexing, decoding, and outputting the media resources.
  • the playback engine also provides control interfaces such as play, pause, fast forward, and fast rewind, providing playback information such as decoding delay, audio and video format, resolution, screen scanning mode, code rate, and frame rate, and encapsulating media resource playback functions. Sex and reusability. Therefore, at this time, it is mainly to set parameters related to the above tasks of the playback engine.
  • a decoder, a video decoder refers to a program that can compress or decompress digital video. Initialization here refers to configuring the relevant parameters of the decoder. D, initialize the cache module
  • Cache module refers to the cache file downloaded by the memory i, generally. applied to the cache
  • the RTSP video stream uses a memory buffering module in the fragment cache module to create and initialize the cache module.
  • the video stream is obtained from the media server through the initialized video player.
  • the type of the video stream can be determined according to the link address, and the number (i.e., initialization of the transmission) is configured according to the type, so that the media server allocates the video stream resource according to the transmission parameter, and starts the RTSP session.
  • the video stream is then retrieved from the media server based on the video stream resource and the RTSP session.
  • the transport protocol type may include a Transmission Control Protocol (TCP) and a User Datagram Protocol (UDP).
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • the transmission protocol type of the video stream is TCP, therefore, the transmission can be configured according to the 'TCP protocol. parameter. For example,
  • the TCP protocol transmits control information, and which network protocol the transport layer should use. If the link address of the video stream does not start with "rtsp", it can be determined that the transport protocol type of the video stream is UDP, then the UDP protocol can be used to configure the transmission parameters. For example, during transmission, the control layer can use the UDP protocol to transmit control information and which network protocol the transport layer should use.
  • the media server can allocate video stream resources according to the transmission parameters, and start an RTSP session, thereby starting data transmission of the video stream.
  • the terminal can be based on the video stream resources and RTSP session, to media service
  • the server sends a download request for the video stream, and then receives the video stream returned by the media server.
  • the video stream can be cached in the memory by the cache module for calling by the playback engine and the decoder, and played.
  • step 104 determines whether the number of attempts to obtain the video stream is lower than a preset value. If the number of attempts is lower than the preset value, 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 the number of attempts is not lower than the preset value, step 104 is performed.
  • step 102 If the number of attempts is lower than the first threshold, returning to perform the step of acquiring a video stream from the media server based on the video stream resource and the RTSP session (see description in step 102);
  • step 104 If the number of attempts is not lower than the first alarm value, it is determined whether the number of attempts of the RTSP session is lower than a preset second threshold. If the number of attempts is below the second threshold, the video stream resource is placed and the RTSP session is stopped, and the step of configuring the transmission parameters according to the type of the transmission protocol is performed (see the description in step 102). If the number of attempts is not lower than the second threshold, step 104 is performed.
  • the preset value, the first threshold, and the second threshold may be set according to actual application requirements.
  • the first threshold and the second threshold may be set to 3 times, or other values.
  • An abnormality in the acquisition of the video stream refers to a situation in which the video stream cannot be downloaded normally due to unstable network or unstable media server or other reasons.
  • the 104 Perform error reporting when determining that the number of attempts to obtain the video stream is not lower than a preset value. For example, the video stream resource can be placed, and the RTSP session can be stopped, and an error message is displayed.
  • the corresponding space may be released, for example, the cache module is released.
  • the video stream can continue to be downloaded until the user exits the video player.
  • the cache module, as well as the decoder, etc. can also be released to free up resources.
  • the embodiment obtains the video stream from the media server according to the video stream identifier, and determines the number of attempts to obtain the video stream when determining that the video stream is abnormally acquired. Whether it is lower than the preset value. If yes, the step of obtaining the video stream from the media server is returned, otherwise, if the value is not lower than the preset value, the error processing is performed.
  • the solution can provide corresponding abnormal operation, so as to ensure that the video can continue to play. Therefore, compared with the prior art, in the case of an error directly reporting an error, it is possible to improve the stability and fluency of playing a video, such as KTSP video, and greatly improve the user experience.
  • the processing device of the video stream is specifically integrated in the terminal, and the video stream is specifically an RTSP video stream as an example.
  • a method for processing a video stream may include the following steps.
  • the terminal receives a video play request triggered by a user.
  • the terminal can receive a video play request triggered by the user clicking on a video play button or a video link address, and the like.
  • the video play request may carry information such as an RTSP video stream identifier, where the video stream identifier is used to identify the video stream.
  • the video stream identifier may be a name, a number, or a link address of the video stream.
  • the terminal determines, according to the RTSP video stream identifier, a link address of the RTSP video stream. Wherein the link address indicating the storage location of the RTSP video stream media server, t ⁇ dagger port -5 ⁇ be a uniform resource ⁇ stand. Fu (URL, Uniform Resource Locator) and the like.
  • the terminal creates a video player according to the link address, and initializes the player interface, the play engine, the decoder, and the cache ⁇ fi block respectively, as follows:
  • Create a player interface including the configuration of the Activity component's Layout, menus such as the initial 4 of the SlidingMenu, the initial 4 of the bottom bar, and the initial 4 of the Aetionbar.
  • the main task of the playback engine is to encapsulate the media resources, that is, the related functions of the RTSP video stream playback, and compile them into a dynamic link library to implement functions such as demultiplexing, decoding, and output playback of media resources.
  • the playback engine also provides control interfaces such as play, pause, fast forward, and fast rewind, providing playback information such as decoding delay, audio and video format, resolution, screen scanning mode, code rate, and frame rate, and encapsulating media resource playback functions. Sex and reusability. Therefore, at this time, it is mainly to set parameters related to the above tasks of the playback engine.
  • the video playback engine can be initialized by reading part of the video stream information from the video memory cache of the cache module.
  • a decoder refers to a program that can compress or decompress digital video. Initialization here refers to configuring the relevant parameters of the decoder. For example, part of the video stream information can be read from the video memory buffer of the cache module to initialize the decoder.
  • Cache module which refers to storing the downloaded cache file in memory. Generally, it is applied to scenes with less cache length, freed after use, and fast reading speed.
  • the RTSP video stream is downloaded from the network in the form of a video clip and managed by means of a memory buffer.
  • the terminal determines a link i of the RTSP video stream, such as whether the URL is "rtsp" At the beginning, if yes, the transmission parameters are configured according to the TCP protocol. If not, the UDP protocol is used to configure the transmission parameters, which can be as follows:
  • the terminal determines whether the link address of the RTSP video stream starts with "rtsp". If yes, it can be determined that the transport protocol type of the RTSP video stream is TCP. Therefore, the transmission parameters can be configured according to the TCP protocol. For example, during transmission, the control layer can use the TCP protocol to transmit control information, and use the specified port number, and transmit control information with the media server through the control layer to negotiate the transport layer (for the player and server to transfer control streaming media) Data) Which network protocol (such as UDP, RDP or TCP) is used. If the link address of the RTSP video stream does not start with "rtsp", it can be determined that the transport protocol type of the video stream is UDP. Then, the UDP protocol can be used to configure the transmission parameters.
  • the control layer can use the TCP protocol to transmit control information, and use the specified port number, and transmit control information with the media server through the control layer to negotiate the transport layer (for the player and server to transfer control streaming media) Data) Which network protocol (such as UDP,
  • control layer can use the UDP protocol to transmit control information, and use the specified port number, and transmit control information with the media server through the control layer to negotiate the transport layer (for the player and server to transfer control streaming media). Data) Which network protocol is used.
  • port 554 can be used.
  • the negotiation with the media server which network protocol is used by the transport layer may also be referred to as the transmission initial.
  • the media server allocates a video stream resource according to the transmission parameter, and starts an RTSP session, thereby starting a digital transmission of the RTSP video stream.
  • the terminal acquires an RTSP video stream from the media server based on the video stream resource and the RTSP session, for example, downloading an RTSP video stream.
  • 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.
  • the transport layer network association (such as UDP, RDP, or TCP, etc.) determined in step 204 may be used to download the TSP video stream from the media server, and the downloaded TSP video stream is stored in the memory for video playback. Called by engine and decoder, etc. Put it.
  • the maximum number of RTSP video streams to be cached is determined by the video player in the terminal and the media server.
  • the terminal plays the RTSP video stream through the video player.
  • the video player's playback engine driver plays the RTSP video stream segment.
  • the RTSP video stream data can be read from the cache module's memory buffer, and the decoder can be used to decode, render, output the picture and sound.
  • the played memory cache will be released immediately, and then the cache will continue to cache the RTSP video stream data.
  • the playback engine needs to communicate with the cache module to coordinate the work, so as to ensure that the video player always plays the RTSP video stream normally.
  • the terminal determines whether an abnormality occurs in the acquisition of the RTSP video stream. If an abnormality occurs, step 209 is performed. If no abnormality occurs, step 212 is performed.
  • the abnormality in the acquisition of the RTSP video stream refers to the fact that the RTSP video stream cannot be downloaded normally due to unstable network or unstable media server or other reasons.
  • step 210 is performed.
  • the first threshold may be set according to the requirements of the actual application, for example, may be set to 3 times, or other values.
  • the terminal determines whether the number of attempts of the RTSP session is lower than a preset second threshold. If the number of attempts is lower than the second threshold, the KTSP video stream resource is forwarded, and the RTSP session is stopped, and the transmission parameter is attempted to be re-downloaded to re-download the video stream, that is, the return is performed.
  • the step of configuring the transmission parameters in step 204 is performed. If the number of attempts is not lower than the second threshold, it means that the consecutive attempts (second threshold) have not been successfully downloaded, and then step 211 is performed.
  • the second threshold may be set according to the requirements of the actual application, for example, may be set to 3 times, or other values.
  • the terminal processes the error, for example, releasing the video stream resource, stopping the RTSP session, and prompting to play an error message.
  • the corresponding space may be released, for example, the cache module is released, and the process ends.
  • the terminal determines whether the user exits the video player. If the user exits the video player, the cache module, the decoder, and the like are released, and the process is terminated by putting resources and the like. If the user has not exited the video player, then the next video stream is downloaded, and the process returns to step 206.
  • the embodiment after receiving the video play request carrying the RTSP video stream identifier, the embodiment obtains the RTSP video stream from the media server according to the RTSP video stream identifier, and determines the acquisition of the RTSP frequency stream. And determining whether the number of attempts of the transport layer network protocol is lower than a first threshold. When the number of attempts is not lower than the first threshold, it is further determined whether the number of attempts of the RTSP session is lower than a preset second threshold, thereby determining whether to perform a corresponding abnormal attempt operation, and after performing the corresponding abnormal attempt operation, Perform error handling.
  • the scheme can provide corresponding abnormal attempt operation to ensure that the video can continue to play. Therefore, compared with the prior art, in the case of an error directly reporting an error, the stability and fluency of the RTSP video can be improved, and the user experience is greatly improved.
  • the embodiment of the present application further provides a video stream processing apparatus.
  • the video stream processing apparatus may include a receiving unit 301, an obtaining unit 302, and a processing unit 303.
  • the receiving unit 301 can receive a video play request.
  • the receiving unit 301 can be configured to receive a video play request triggered by the user by clicking a video play button or a video link address, and the like.
  • the video play request may carry information such as a video stream identifier, where the video stream identifier is used to identify a video stream.
  • 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.
  • the obtaining unit 302 can acquire a video stream from the media server according to the video stream identifier.
  • the processing unit 303 may determine whether the number of attempts to obtain the video stream is lower than a preset value when the acquisition of the video stream is abnormal; if yes, the trigger acquiring unit 302 performs an operation of acquiring the video stream from the media server; if not, the error is reported. deal with.
  • the processing unit 303 can determine whether the number of attempts of the transport layer network is lower than a preset first threshold
  • the threshold is not lower than the first threshold, determine whether the number of attempts of the RTSP session is lower than a preset second threshold. If the threshold is lower than the second threshold, release the video stream resource, stop the RTSP session, and trigger the acquiring sub-unit to execute. The operation of configuring the transmission parameter according to the type of the transmission protocol; if not lower than the second threshold, the error processing is performed.
  • the video stream resource may be released, and the RTSP session is stopped, and an error message is prompted.
  • the processing unit 303 may release the video stream resource, stop the RTSP session, and prompt the playback error message when determining that the number of attempts of the RTSP session is not lower than the preset second threshold.
  • the abnormality of the video stream refers to the instability of the network or the instability of the media server. For some reason, or for other reasons, the video stream cannot be downloaded normally.
  • the corresponding space can be released, for example, the release module is released.
  • the obtaining unit 302 may continue to
  • 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.
  • t o Create a subunit to create a video player based on the link address and initialize the video player.
  • the creation subunit can initialize the player interface, the playback engine, the decoder, the cache module, and the like, respectively.
  • the creation subunit can initialize the player interface, the playback engine, the decoder, the cache module, and the like, respectively.
  • the obtaining sub-unit may be specifically configured to determine a transmission protocol type of the video stream according to the link address, configure a transmission parameter according to the transmission protocol type, so that the media server allocates video stream resources according to the transmission parameter, and starts RTSP. Session, then, based on 0 the video stream resource and the RTSP session get the video stream from the media server.
  • the processing unit 303 can determine the ⁇ of the video stream. When an abnormality occurs, it is determined whether the number of attempts to acquire the frequency stream is lower than a preset value; if yes, the triggering acquisition sub-unit performs initialization according to the link address. After the video player obtains the video stream from the media server, if not, the error processing is performed.
  • the transport protocol type may include a transmission control protocol (TCP , Transmission Control Protocol) and User Data Protocol (UDP, User Datagram Protocol).
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • the control layer can use the TCP protocol to transmit control information, and which network protocol the transport layer should use. If the link address of the video stream does not start with "rtsp", the obtaining subunit can determine that the transport protocol type of the video stream is UDP, then the UDP protocol can be used to configure the transmission parameters.
  • the control layer can use the UDP protocol to transmit control information, and which network protocol the transport layer should use, and so on.
  • the media server can allocate video stream resources according to the transmission parameters, and start an RTSP session, thereby starting data transmission of the video stream.
  • the acquiring subunit can be based on the video stream resource.
  • the RTSP session sending a download request of the video stream to the media server, and then receiving the video acquisition subunit returned by the media server and downloading the video stream to the video stream, the buffer stream may be cached in the memory for the playback engine and The decoder or the like makes a call and plays it.
  • the foregoing units may be implemented as a separate entity, and may be implemented in any combination, and may be implemented as the same entity or a plurality of entities.
  • the foregoing method embodiments and details are not described herein.
  • the processing device of the video stream may be specifically integrated in a device such as a terminal.
  • the terminal can be specifically a device such as a mobile phone, a tablet or a laptop.
  • the processing unit of the video stream of the embodiment may obtain the video stream from the media server according to the video stream identifier by the obtaining unit 301, and the processing unit 303 determines When the acquisition of the video stream is abnormal, it is determined whether the number of attempts to obtain the video stream is lower than a preset value, and if so, the acquisition unit 302 is triggered. Perform the operation of obtaining the video stream from the media server. Otherwise, if the error is not lower than the preset value, the error processing is performed. Because the solution is abnormal when the video stream is abnormal, the corresponding abnormal attempt operation can be provided to ensure that the video can continue to play. Going down, therefore, compared with the prior art, in the case of an error directly reporting an error, it can provide improved stability and fluency when playing video, such as RTSP video, and greatly improve the user experience.
  • the embodiment of the present application further provides a processing system for a video stream, which may include a processing device for a video stream in each embodiment of the present application.
  • the processing device of the video stream can be integrated in a device such as a terminal.
  • the video stream processing device may receive a video play request, where the video play request carries a video stream identifier; obtain a video stream from the media server according to the video stream identifier; and determine, when the video stream acquisition is abnormal, determine whether the number of attempts to obtain the video stream is It is lower than the preset value; if yes, it returns to the step of acquiring the video stream from the media server; if not, it enters the error processing.
  • the processing device of the frequency stream may be 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, and initialize the video player, according to the link address,
  • the initialized video player obtains a video stream from the media server; determines whether the number of attempts of the transport layer network protocol is lower than a preset first threshold; if lower than the first threshold, returns to perform the media based on the video stream resource and the RTSP session The operation of the server to obtain the video stream; if not lower than the first threshold, determining whether the number of attempts of the RTSP session is lower than a preset second threshold, if the second threshold is lower, releasing the video stream resource, and stopping the RTSP session And returning to perform an operation of configuring a transmission parameter according to the type of the transmission protocol; if not lower than the second threshold, performing an error processing.
  • the first threshold and the second threshold may be set according to the requirements of the actual application.
  • the first threshold and the second threshold may be set to 3 times, and details are not described herein again.
  • processing system of the video stream may further include other devices, for example, a media server.
  • the media server can provide a video stream to the processing device of the video stream.
  • the processing system of the video stream may include any processing device of the video stream provided by the embodiment of the present application. Therefore, the processing device of any video stream proposed by the embodiment of the present application may be implemented. For the effect, please refer to the previous embodiment, and details are not described herein again.
  • FIG. 4 is a schematic diagram of a video stream processing apparatus according to an embodiment of the present application.
  • the apparatus can include a processor 41, a communication interface 44, a storage device 46, and a bus 49.
  • the storage device 46 includes a production system 47, a communication module 48, and a stream processing module 43.
  • the processor 41 may have one or more, may be in the same physical device, or be distributed among multiple physical devices.
  • the device can receive the video stream sent by the media server over a certain network using the communication interface 44.
  • the stream processing module 43 may include a receiving unit 431, an ear unit 432, and a processing unit 433.
  • the receiving unit 431 can receive a video play request.
  • the obtaining unit 432 can acquire the video stream from the media server according to the video stream identifier.
  • the processing unit 433 may determine, when the acquisition of the video stream is abnormal, whether the number of attempts to acquire the video stream is lower than a preset value; if yes, the trigger obtaining unit 432 performs an operation of acquiring the video stream from the media server; if not, proceeding Error handling.
  • the functions of the receiving unit 431, the obtaining unit 432, and the processing unit 433 are similar to the receiving unit 301, the obtaining unit 302, and the processing unit 303, and are not described herein again.
  • the hardware modules in the embodiments may be implemented in a hardware manner or a hardware platform plus software.
  • the above software includes machine readable instructions stored in a volatile storage medium. Therefore, each embodiment can also be embodied as a soft product.
  • the hardware may be implemented by specialized hardware or hardware that executes machine readable instructions.
  • the hardware can be specially designed for permanent circuits or logic devices (such as dedicated processors such as FPGAs or ASICs) for performing specific operations.
  • the hardware may also include programmable logic devices or circuits (such as including general purpose processors or other programmable processors) that are temporarily configured by software for performing particular operations.
  • the machine readable instructions corresponding to the modules in the figures may be implemented by a system or the like operating on a computer to perform some or all of the operations described herein.
  • the non-transitory computer readable storage medium may be inserted into a memory provided in an expansion board within the computer or written to a memory provided in an expansion unit connected to the computer.
  • the CPU or the like installed on the expansion board or expansion unit can perform some and all of the actual operations according to the instructions.
  • Non-transitory computer readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (eg, CD-ROM, CD-, CD-RW, DVD-ROM > DVD-RAM, DVD-RW, DVD+RW), magnetic tape, Non-volatile memory card and ROM.
  • the program code can be downloaded from the server computer by the communication network.

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

Disclosed in the embodiments of the present application are a method, a device and a system for processing a video stream. The embodiments of the present application comprises: after receiving a video playback request carrying a video stream identifier, acquiring, according to the video stream identifier, a video stream from a media server; when it is determined that an abnormality occurs in the acquisition of the video stream, determining whether the number of attempts for acquiring the video stream is below a preset value, and if so, returning to execute the step of acquiring the video stream from the media server, otherwise, if the number of attempts is not below the preset value, reporting an error. The described solution can provide improved stability and fluency when playing back a video.

Description

本申请涉及通  This application relates to
统。  System.
目前, 用户使用移动客户端观看直播视频, 都是基于流媒体Currently, users use mobile clients to watch live video, all based on streaming media.
( Streaming Media )协议来实现的。 所谓流媒体是指采用流式传输的方 式实现在线播放的媒体格式。 具体实现时, 视频网站运营商可以通过视 频传送服务器把节目封装为数椐包发出, 并传送到网络上, 当用户需要 观看该视频时, 便可以通过.解压客户端对这些数据进:行解压并播放。 目 前比较常见的流媒体协议主要有基于超文本传送协议的实时流传输(Streaming Media) protocol to achieve. The so-called streaming media refers to a media format that implements online playback by means of streaming. In specific implementation, the video website operator can package the program as a digital packet and send it to the network through the video delivery server. When the user needs to watch the video, the user can extract the data by decompressing the client and decompressing the data. Play. Currently, common streaming protocols mainly include real-time streaming based on hypertext transfer protocol.
( HLS, HTTP Live Streaming )协议和实时流传输协议 ( RTSP , Real Time Streaming Protocol )等。 其中, RTSP是―种较通用的实时流媒体协议, 能够实现视频的直播功能, 需要有专门的媒体播放器(media player )和
Figure imgf000002_0001
(HLS, HTTP Live Streaming) protocol and Real Time Streaming Protocol (RTSP). Among them, RTSP is a more general-purpose real-time streaming media protocol, which can realize the live broadcast function of video, and requires a special media player (media player) and
Figure imgf000002_0001
本申请实施例提供一种视频流的处理方法、 装置和系统, 可以提供 提高播放视频时的稳定性和流畅性。 The embodiment of the present application provides a method, a device, and a system for processing a video stream, which can improve stability and fluency when playing video.
本申请实施例提供一种视频流的处理方法, 包括:  An embodiment of the present application provides a method for processing a video stream, including:
接收视频播放请求, 所述视频播放请求携带视频流标识; 根据所述视频流标识从媒体服务器获取视频流;  Receiving a video play request, where the video play request carries a video stream identifier; and acquiring a video stream from the media server according to the video stream identifier;
确定视频流的获取出现异常时, 判断获取视频流的尝试次数是否低 于预 i殳值; When it is determined that the acquisition of the video stream is abnormal, it is determined whether the number of attempts to obtain the video stream is low. Pre-i殳 value;
若是, 则返回执行从媒.体服务器获取视频流的步骤;  If yes, returning to the step of acquiring a video stream from the media server;
Figure imgf000003_0001
流 标 -ΐί
Figure imgf000003_0001
Flow marker - ΐί
获取单元, 用于根据所述视频流标识从媒体服务器获取視频流; 处理单元, 用于确定视频流的获取出现异常时, 判断获取视频流的 尝试次数是否低于预设值; 若是, 则触发获取单元执行从媒.体服务器获 取视频流的操作; 若否, 则进-行报错处理。  An acquiring unit, configured to acquire a video stream from the media server according to the video stream identifier, and a processing unit, configured to determine, when an abnormality occurs in the acquisition of the video stream, determining whether the number of attempts to obtain the video stream is lower than a preset value; if yes, The trigger acquisition unit performs an operation of acquiring a video stream from the media server; if not, the error processing is performed.
此外, 本申请实施例还提.供一种视频流的处理系统, 包括媒体服务 器和本申请实施例提供的任一种视频流的处理装置;  In addition, the embodiment of the present application further provides a processing system for a video stream, including a media server and a processing device for any video stream provided by the embodiment of the present application;
所述媒体服务器, 用于向视频流的处理装置提供视频流。  The media server is configured to provide a video stream to a processing device of the video stream.
本申请实施例采用在接收到携带視频流标识的视频播放请求后, 根 据该视频流标识从媒体服务器获取视频流, 在确定视频流的获取出现异 常时, 判断获取视频流的尝试次数是否低于预设值, 若是, 则返回执行 从媒体服务器获取视频流的步骤, 否则, 若不低于预设值, 才进行报错 处理; 由于该方案在视频流出现异常时,可以提供相应的异常尝试操作, 最大程度保障视频可以继续播放下去, 因此, 相对现有技术在遇到异常 时则直接报.错的方案而言, 可以提供提高播放视频时的稳定性和流畅 性。 附图简要说明  After receiving the video play request carrying the video stream identifier, the embodiment of the present application obtains the video stream from the media server according to the video stream identifier, and determines whether the number of attempts to obtain the video stream is low when determining that the video stream is abnormally acquired. At the preset value, if yes, returning to perform the step of acquiring the video stream from the media server, otherwise, if the value is not lower than the preset value, the error processing is performed; because the scheme is abnormal when the video stream is abnormal, the corresponding abnormal attempt may be provided. Operation, to the maximum extent, the video can continue to play. Therefore, compared with the prior art, in the case of encountering an abnormality, the solution directly and incorrectly can provide stability and fluency when the video is played. BRIEF DESCRIPTION OF THE DRAWINGS
以下酎图仅为本申请技术方案的一些例子, 本申请并不局限于图中 示出的特征。 以下酎图中, 相似的标号表示相^ 图 la是本申请实施例提供的视频流的处理系统的场景示意图; 图 lb是本申请实施例提供的视频流的处理方法的流程图; The following figures are only a few examples of the technical solutions of the present application, and the application is not limited to the features shown in the drawings. In the following figures, similar reference numerals indicate FIG. 1a is a schematic diagram of a process of processing a video stream according to an embodiment of the present disclosure; FIG. 1b is a flowchart of a method for processing a video stream according to an embodiment of the present application;
图 2是本申请实施例提供的视频流的处理方法的另一流程图; 图 3是本申请实施例提.供的视频流的处理装置的示意图;  2 is another flowchart of a method for processing a video stream according to an embodiment of the present disclosure; FIG. 3 is a schematic diagram of a device for processing a video stream according to an embodiment of the present application;
图 4是本申请实施例提供的视频流的处理装置的示意图。 实施.本申 -清的方式  FIG. 4 is a schematic diagram of a video stream processing apparatus according to an embodiment of the present application. Implementation. This application - clear way
为了描述上的简洁和直观, 下文通过描述若千代表性的实施例来对 本申请的方案进行阐述。 但本文并未示出所有实施方式。 实施例中大量 的细节仅用于帮助理解本申请的方案, 本申请的技术方案实现时可以不 局限于这些细节。 为了避免不必要地模糊了本申请的方案, 一些实施方 式没有进行细致地描述, 而是仅给出了框架。 下文中, "包括 "是指 "包 括但不限于", "根据… ... "是指 "至少根据 ...…,但不限于仅根据… ... "。 说明书和权利要求书中的 "包括" 是指某种程度上至少包括, 应当解释 为除了包括之后提到的特征外, 其它特征也可以存在。 下文中没有特别 指出一个成分的数量时, 意味着该成分可以是一个也可以是多个, 或可 理解为至少一个。  For the sake of brevity and clarity in the description, the scheme of the present application will be explained below by describing a representative embodiment. However, not all embodiments are shown herein. A large number of the details in the embodiments are only used to help understand the solution of the present application, and the technical solutions of the present application may not be limited to these details. In order to avoid unnecessarily obscuring the aspects of the present application, some embodiments are not described in detail, but only the framework is given. In the following, "including" means "including but not limited to", "according to..." means "at least according to ..., but not limited to only based on ...". The word "comprising", as used in the specification and claims, is meant to include, to some extent, the meaning of the invention. When the number of one component is not specifically indicated below, it means that the component may be one or more, or may be understood to be at least one.
本申请实施例提供一种视频流的处理方法、 装置和系统。  The embodiment of the present application provides a method, an apparatus, and a system for processing a video stream.
参见图 l a, 该视频流的处理系统可以包括本申请实施例所提供的任 一种 ¾L频流的处理装置,该 频流的处理装置可以集成在终端中,此外, 该视频流的处理系统还可以包括媒体服务器, 用于向终端提供视频流。  Referring to FIG. 1a, the processing system of the video stream may include any processing device of the frequency stream provided by the embodiment of the present application, where the processing device of the frequency stream may be integrated in the terminal, and further, the processing system of the video stream further A media server can be included for providing a video stream to the terminal.
当用户需要观看视频时, 可以通过点击或选择播放触发键来触发视 频播放请求。 其中, 该视频播放请求携带视频流标识, 当终端接收到该 视频播放请求后, 便可以根据该视频流标识从媒体服务器获取视频流。 比如, 根.据该视频流标识向媒体服务器发送视频流的下载请求, 然后接 收收媒媒体体服服务务器器根根据据该该下下载载请请求求返返回回的的视视频频流流,, 等等等等。。 然然后后,, 便便可可以以在在终终 端端本本地地播播放放该该视视频频流流。。 When the user needs to watch the video, the video play request can be triggered by clicking or selecting the play trigger button. The video play request carries a video stream identifier. After receiving the video play request, the terminal may obtain a video stream from the media server according to the video stream identifier. For example, the root sends a download request of the video stream to the media server according to the video stream identifier, and then connects The receiving media media server server roots according to the downloading request to request the return of the video video stream, back to and so on. . Then, after that, the video stream can be played in the local terminal at the terminal end. .
在在播播放放 RRTTSSPP视视频频过过程程中中,, 经经常常会会遇遇到到由由于于网网络络不不稳稳定定或或者者媒媒体体服服 务务器器不不稳稳定定,, 而而导导致致偶偶尔尔无无法法正正常常下下载载视视频频流流的的情情况况。。 根根据据本本申申请请各各实实 In the process of playing and playing the RRTTSSPP video and video frequency, it is often encountered that the network will not be unstable due to the network network, or the media media server will not be unstable. However, the lead to the occasional situation is that there is no way to download the video stream stream normally. . According to the application, please refer to the application.
55 施施例例,, 若若终终端端确确定定视视频频流流出出现现了了异异常常,, 则则可可以以启启动动异异常常尝尝试试流流程程,, 比比如如 判判断断获获取取视视频频流流的的尝尝试试次次数数是是否否低低于于预预设设值值。。 若若是是,, 则则返返回回执执行行从从媒媒体体 服服务务器器获获取取視視频频流流的的步步骤骤。。 否否则则,, 若若尝尝试试的的次次数数已已超超过过预预设设值值,, 比比如如 33 次次,, 则则进进行行报报错错处处理理,, 比比如如释释放放所所述述视视频频流流资资源源,, 以以及及停停止止所所述述 RRTTSSPP 会会话话,, 并并提提示示播播放放错错误误信信息息,, 等等等等。。 相相比比现现有有方方案案中中的的遇遇到到异异常常直直接接报报 ttoo 错错的的处处理理方方式式,, 本本申申请请的的技技术术方方案案可可以以增增加加 RRTTSSPP视视频频的的播播放放稳稳定定性性和和 流流畅畅性性。。 55. For example, if the terminal end determines that the video stream of the fixed-view video has been abnormally abnormal, then it may be possible to start the trial flow process with the start-up exception. If it is judged that the number of trial attempts to obtain the video stream stream is lower than the pre-set value. . If the answer is yes, then the return receipt execution line obtains the step of obtaining the video stream from the media server server. . Otherwise, if the number of attempts to try has exceeded the pre-preset value, for example, 33 times, then the line will report the error, for example, The release of the said video video stream source resource, and the suspension of the said RRTTSSPP session, and prompting the broadcast to play the wrong error message, Etc., etc. . Compared with the existing method in the existing existing solution, the problem is that the abnormality is directly and directly reported to the ttoo error processing method. The case can be increased and the playback of the RRTTSSPP video frequency is stabilized and stable, and the flow is smooth. .
本本实实施施例例将将从从视视频频流流的的处处理理装装置置的的角角度度进进--行行描描述述,, 该该视视频频流流的的处处理理 装装置置具具体体可可以以集集成成在在终终端端等等设设备备中中。。 该该视视频频流流的的处处理理装装置置,, 可可以以作作为为一一 功功能能模模块块集集成成在在终终端端等等设设备备中中,, 也也可可以以以以软软体体的的形形式式安安装装在在终终端端等等设设备备 The embodiment of the present embodiment will advance the angular angle of the processing and processing device from the video and video stream, and the processing of the video and video stream will be described. The physical device can be integrated into the device at the terminal end or the like. . The processing and processing device of the video video stream may be integrated into the device set in the terminal terminal or the like as a function module of the one-function function, and also It may be installed in the form of a soft body, installed at the terminal end, etc.
1155 中中,, 在在此此不不再再赘赘述述。。 In 1155, it will not be described again here. .
一一种种视视频频流流的的处处理理方方法法,, 包包括括:: 接接收收视视频频播播放放请请求求,, 该该视视频频播播放放请请 求求携携带带视视频频流流标标识识;; 根根据据该该视视频频流流标标识识从从媒媒体体服服务务器器获获取取视视频频流流;; 确确定定 視視频频流流的的获获取取出出现现异异常常时时,, 判判断断获获取取视视频频流流的的尝尝试试次次数数是是否否低低于于预预设设 值值;; 若若是是,, 则则返返回回执执行行从从媒媒体体服服务务器器获获取取视视频频流流的的步步骤骤;; 若若否否,, 则则进进行行 2200 报报错错处处理理。。  A processing method for processing video frequency stream, the package includes: receiving and receiving a video broadcast, and requesting, and requesting the video broadcast The video stream stream identifier is identified; the root obtains the video stream from the media server server according to the stream identifier of the video stream; and determines the video stream stream. When the acquisition is abnormal, the number of trial attempts to obtain the video stream stream is determined to be lower than the pre-set value; if so, Then, the return receipt execution line obtains the step of obtaining the video frequency stream from the media server server; if not, the line 2200 reports the error processing. . .
如如图图 llbb所所示示,, 该该視視频频流流的的处处理理方方法法的的具具体体流流程程可可以以如如下下:: As shown in FIG. 11b, the specific body flow process of the processing method of the video video stream may be as follows:
110011、、 接接收收视视频频播播放放请请求求。。 110011,, receiving and receiving video broadcasts, please request. .
例例如如,, 可可以以接接收收用用户户通通过过点点击击视视频频播播放放键键或或视视频频链链接接地地址址所所触触发发的的
Figure imgf000005_0001
For example, for example, it may be triggered by receiving and receiving the user account through a click through the video broadcast play button or by touching the ground address of the video frequency link.
Figure imgf000005_0001
2255 其其中中,, 该该视视频频播播放放请请求求可可以以携携带带视视频频流流标标识识等等信信息息。。 视视频频流流标标识识用用 于识别视频流。 比如, 该视频流标识可以是.视频流的名称、 编号或链接 地址等。 2255, wherein the video video broadcast is requested to be requested to carry the video stream stream identification identifier and the like information. . Video frequency stream tag identification To identify the video stream. For example, the video stream identifier can be a name, a number, or a link address of the video stream.
该视频流具体可以为 RTSP视频流或其他格式的直播视频流。  The video stream may specifically be an RTSP video stream or a live video stream in other formats.
102、 根椐该视频流标识从媒体服务器获取视频流。 例如, 具体可以 如下:  102. The video stream identifier is obtained from the media server according to the video stream identifier. For example, the details can be as follows:
( 1 )根据该视频流标识确定视频流的链接地址。  (1) determining a link address of the video stream according to the video stream identifier.
该链接地址指示该视频流在媒体服务器中的存储位置。  The link address indicates where the video stream is stored in the media server.
( 2 )根椐该链接地址创建视频播放器, 并对该视频播放器进行初始 化;  (2) creating a video player based on the link address and initializing the video player;
例如, 在根据该链接地址创建视频播放器后, 可以分别对播放器界 面、 播放引擎、 解码器和缓存模块进行初始化, 具体可以如下。  For example, after the video player is created according to the link address, the player interface, the playback engine, the decoder, and the cache module can be initialized separately, as follows.
A、 初始化播放器界面  A, initialize the player interface
创建播放器界面, 包括活动 (Activity )组件的布局 (Layout ) 的配 置、 菜单如側滑菜单( Sliding Menu ) 的初始化、 底下信息条的初始化、 以及.操作栏(Action bar ) 的初始化, 等等。  Create a player interface, including the configuration of the Activity component's layout (Layout), menus such as the Sliding Menu initialization, the underlying information bar initialization, and the Action bar initialization, etc. .
B、 初始化播放引擎  B, initialize the playback engine
播放引擎主要任务是将媒体资源, 即视频流播放的相关功能进行封 装, 编译为动态链接库, 以实现媒体资源的解复用、 解码和输出播放等 功能。 播放引擎还提供播放、 暂停、 快进、 以及快退等控制接口, 提供 解码时延、 音视频格式、 分辨率、 屏幕扫描模式、 码率和帧率等播放信 息, 实现媒体资源播放功能的封装性和重用性。 因此, 此时主要是对播 放引擎的上述任务相关的参数进行设置。 解码器, 即视频解码器, 是指一个能够对数字视频进行压缩或者解 压缩的程序, 这里的初始化指的是对解码器的相关参数进行配置。 D、 初始化缓存模块 The main task of the playback engine is to encapsulate the media resources, that is, the related functions of the video stream playback, and compile them into a dynamic link library to implement functions such as demultiplexing, decoding, and outputting the media resources. The playback engine also provides control interfaces such as play, pause, fast forward, and fast rewind, providing playback information such as decoding delay, audio and video format, resolution, screen scanning mode, code rate, and frame rate, and encapsulating media resource playback functions. Sex and reusability. Therefore, at this time, it is mainly to set parameters related to the above tasks of the playback engine. A decoder, a video decoder, refers to a program that can compress or decompress digital video. Initialization here refers to configuring the relevant parameters of the decoder. D, initialize the cache module
缓存模块, 指以内存 i力 储下载的缓存文件, 一般.应用于缓存  Cache module, refers to the cache file downloaded by the memory i, generally. applied to the cache
^买取.速度要求快的场景。 在本申请实 施例中, RTSP視频流以片段的 缓存模块中, 都使用内存缓 初始化緩存模块包括创建并初始化缓存模块。  ^Buy. A scene with a fast speed requirement. In the embodiment of the present application, the RTSP video stream uses a memory buffering module in the fragment cache module to create and initialize the cache module.
( 3 )根据该链接地址,通过初始化后的视频播放器从媒体服务器获 取视频流。  (3) According to the link address, the video stream is obtained from the media server through the initialized video player.
例如, 可以根据该链接地址确定该视频流的 类型, 根据该 类型配置 ^数(即传输的初始化), 以便该媒体服务器根 据该传输参数分配视频流资源, 以及启动 RTSP会话。 然后, 基于该視 频流资源和 RTSP会话从媒体服务器获取视频流。  For example, the type of the video stream can be determined according to the link address, and the number (i.e., initialization of the transmission) is configured according to the type, so that the media server allocates the video stream resource according to the transmission parameter, and starts the RTSP session. The video stream is then retrieved from the media server based on the video stream resource and the RTSP session.
其中, 传输协议类型可以包括传输控制协议( TCP , Transmission Control Protocol )和用户数据艮协议 ( UDP, User Datagram Protocol )等。  The transport protocol type may include a Transmission Control Protocol (TCP) and a User Datagram Protocol (UDP).
比如, 以该视频流为 RTSP视频流为例, 若该视频流的链接地址以 "rtsp" 开头, 则可以确定该視频流的传输协议类型为 TCP, 因此, 可 以根据' TCP协议来配置传输参数。 比如,  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 can be determined that the transmission protocol type of the video stream is TCP, therefore, the transmission can be configured according to the 'TCP protocol. parameter. For example,
TCP协议来传输控制信息, 以及传输层应该采用哪种网络协议等。 而若 该视频流的链接地址不是以 "rtsp" 开头, 则可以确定该视频流的传输 协议类型为 UDP, 那么, 可以采用 UDP协议来配置传输参数。 比如在 传输时, 控制层則可以采用 UDP协议来传输控制信息, 以及传输层应 该采用哪种网絡协议,
Figure imgf000007_0001
The TCP protocol transmits control information, and which network protocol the transport layer should use. If the link address of the video stream does not start with "rtsp", it can be determined that the transport protocol type of the video stream is UDP, then the UDP protocol can be used to configure the transmission parameters. For example, during transmission, the control layer can use the UDP protocol to transmit control information and which network protocol the transport layer should use.
Figure imgf000007_0001
在配置了传输参数, 传输初始化之后, 媒体服务器便可以根据该传 输参数分配视频流资源, 以及启动 RTSP会话, 进而启动视频流的数据 传¾ ^[ 比如, 此时终端可以基于该视频流资源和 RTSP会话, 向媒体服 务器发送视频流的下载请求, 然后接收媒体服务器返回的视频流。 After the transmission parameters are configured and the transmission is initialized, the media server can allocate video stream resources according to the transmission parameters, and start an RTSP session, thereby starting data transmission of the video stream. [For example, the terminal can be based on the video stream resources and RTSP session, to media service The server sends a download request for the video stream, and then receives the video stream returned by the media server.
终端下载到视频流之后,可以由缓存模块将该視频流缓存在内存中, 以供播放引擎和解码器等进行调用, 并进行播放。  After the terminal downloads the video stream, the video stream can be cached in the memory by the cache module for calling by the playback engine and the decoder, and played.
103、确定视频流的获取出现异常时,判断获取视频流的尝试次数是 否低于预设值。 若尝试次数低于预设值, 则返回执行从媒体服务器获取 视频流的步骤, 比如, 返回执行根据该链接地址, 通过初始化后的视频 播放器从媒.体服务器获取视频流的步骤。 否则, 若尝试次数不低于预设 值, 则执行步骤 104。  103. When it is determined that the acquisition of the video stream is abnormal, determine whether the number of attempts to obtain the video stream is lower than a preset value. If the number of attempts is lower than the preset value, 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 the number of attempts is not lower than the preset value, step 104 is performed.
例如, 可以通过两个层面来判断该 "获取视频流的尝试次数" 是否 氐于-预设值, 如下:  For example, it can be judged by two levels whether the "number of attempts to obtain a video stream" is at a preset value, as follows:
判断传输层网络协议的尝试次数是否低于预设第一阈值;  Determining whether the number of attempts of the transport layer network protocol is lower than a preset first threshold;
若尝试次数低于第一阈值, 则返回执行基于该视频流资源和 RTSP 会话从媒体服务器获取視频流的步驟(参见步骤 102中的描述);  If the number of attempts is lower than the first threshold, returning to perform the step of acquiring a video stream from the media server based on the video stream resource and the RTSP session (see description in step 102);
若尝试次数不低于第一闹值, 则判断 RTSP会话的尝试次数是否低 于预设第二阈值。 若尝试次数低于第二阈值, 则锋放该视频流资源, 以 及停止该 RTSP会话, 并返回执行根据该传输协议类型配置传输参数的 步骤(参见步骤 102 中的描述)。 若尝试次数不低于第二阈值, 则执行 步驟 104。  If the number of attempts is not lower than the first alarm value, it is determined whether the number of attempts of the RTSP session is lower than a preset second threshold. If the number of attempts is below the second threshold, the video stream resource is placed and the RTSP session is stopped, and the step of configuring the transmission parameters according to the type of the transmission protocol is performed (see the description in step 102). If the number of attempts is not lower than the second threshold, step 104 is performed.
其中, 预设值、 第- 阈值和第二阈值可以根据实际应用的需求进行 设置。 比如, 可以设置第一阈值和第二阈值均为 3次, 或其它值。  The preset value, the first threshold, and the second threshold may be set according to actual application requirements. For example, the first threshold and the second threshold may be set to 3 times, or other values.
其中, 视频流的获取出现异常指的是由于网络不稳定或者媒体服务 器不稳定, 或者其他的原因而导致无法正常下载视频流的情况。  An abnormality in the acquisition of the video stream refers to a situation in which the video stream cannot be downloaded normally due to unstable network or unstable media server or other reasons.
104、在确定获取视频流的尝试次数不低于预设值时,进行报错处理。 比如, 可以锋放该视频流资源, 以及停止该 RTSP会话, 并提示播 放错误信息。 可选的, 在进行报错处理之后, 为了节省资源, 可以释放相应的空 间, 比如, 释放缓存模块。 104. Perform error reporting when determining that the number of attempts to obtain the video stream is not lower than a preset value. For example, the video stream resource can be placed, and the RTSP session can be stopped, and an error message is displayed. Optionally, after the error processing is performed, in order to save resources, the corresponding space may be released, for example, the cache module is released.
此外, 若视频流没有出现异常, 则可以继续下载该视频流, 直至用 户退出该视频播放器。在退出视频播放器之后, 同样可以释放缓存模块、 以及解码器等, 以释放资源。  In addition, if there is no abnormality in the video stream, the video stream can continue to be downloaded until the user exits the video player. After exiting the video player, the cache module, as well as the decoder, etc., can also be released to free up resources.
由上可知 , 本实施例采用在接收到携带视频流标识的视频播放请求 后, 根据该视频流标识从媒体服务器获取视频流, 在确定视频流的获取 出现异常时, 判断获取视频流的尝试次数是否低于预设值。 若是, 则返 回执行从媒体服务器获取视频流的步骤, 否则, 若不低于预设值, 才进 行报错处理。 该方案在视频流出现异常时, 可以提供相应的异常尝试操 作, 最大程度保障视频可以继续播放下去。 因此, 相对现有技术在遇到 异常时则直接报错的方案而言, 可以提供提高播放视频, 如 KTSP视频 时的稳定性和流畅性, 大大提高用户体验。  It can be seen that, after receiving the video play request carrying the video stream identifier, the embodiment obtains the video stream from the media server according to the video stream identifier, and determines the number of attempts to obtain the video stream when determining that the video stream is abnormally acquired. Whether it is lower than the preset value. If yes, the step of obtaining the video stream from the media server is returned, otherwise, if the value is not lower than the preset value, the error processing is performed. When the video stream is abnormal, the solution can provide corresponding abnormal operation, so as to ensure that the video can continue to play. Therefore, compared with the prior art, in the case of an error directly reporting an error, it is possible to improve the stability and fluency of playing a video, such as KTSP video, and greatly improve the user experience.
在一些实施例中, 将以该视频流的处理装置具体集成在终端中, 且 该视频流具体为 RTSP视频流为例进行说明。  In some embodiments, the processing device of the video stream is specifically integrated in the terminal, and the video stream is specifically an RTSP video stream as an example.
如图 2所示, 一种视频流的处理方法, 可以包括以下步骤。  As shown in FIG. 2, a method for processing a video stream may include the following steps.
201、 终端接收用户触发的视频播放请求。  201. The terminal receives a video play request triggered by a user.
例如, 终端可以接收用户通过点击视频播放键或视频链接地址所触 发的视频播放请求 , 等等。  For example, the terminal can receive a video play request triggered by the user clicking on a video play button or a video link address, and the like.
其中, 该视频播放请求可以携带 RTSP视频流标识等信息, 该视频 流标识用于识别视频流。 比如, 该视频流标识可以是視频流的名称、 编 号或链接地址等。  The video play request may carry information such as an RTSP video stream identifier, where the video stream identifier 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.
202、 终端根据该 RTSP視频流标识确定 RTSP视频流的链接地址。 其中 ,该链接地址指示该 RTSP视频流在媒体服务器中的存储位置, t匕^口-5 Γ以是统一资源定 ^立.符 ( URL, Uniform Resource Locator ) 等。 203、 终端根据该链接地址创建视频播放器, 并分别对播放器界面、 播放引擎、 解码器和緩存 ^fi块进行初始化, 如下: 202. The terminal determines, according to the RTSP video stream identifier, a link address of the RTSP video stream. Wherein the link address indicating the storage location of the RTSP video stream media server, t ^ dagger port -5 Γ be a uniform resource ^ stand. Fu (URL, Uniform Resource Locator) and the like. 203. The terminal creates a video player according to the link address, and initializes the player interface, the play engine, the decoder, and the cache ^fi block respectively, as follows:
( 1 )初始化播放器界面;  (1) Initializing the player interface;
创建播放器界面, 包括 Activity 组件的 Layout 的配置、 菜单如 SlidingMenu的初始 4匕、底下信息条的初始 4匕、以.及 Aetionbar的初始 4匕,  Create a player interface, including the configuration of the Activity component's Layout, menus such as the initial 4 of the SlidingMenu, the initial 4 of the bottom bar, and the initial 4 of the Aetionbar.
( 2 )初始化播放引擎; (2) Initializing the playback engine;
播放引擎主要任务是将媒体资源, 即 RTSP视频流播放的相关功能 进行封装, 编译为动态链接库, 以实现媒.体资源的解复用、 解码和输出 播放等功能。 播放引擎还提供播放、 暂停、 快进、 以及快退等控制接口, 提供解码时延、 音视频格式、 分辨率、 屏幕扫描模式、 码率和帧率等播 放信息, 实现媒体资源播放功能的封装性和重用性。 因此, 此时主要是 对播放引擎的上述任务相关的参数进行设置。 比如, 可以从缓存模块的 視频内存缓存中, 读取部分视频流信息, 来初始化视频播放引擎。  The main task of the playback engine is to encapsulate the media resources, that is, the related functions of the RTSP video stream playback, and compile them into a dynamic link library to implement functions such as demultiplexing, decoding, and output playback of media resources. The playback engine also provides control interfaces such as play, pause, fast forward, and fast rewind, providing playback information such as decoding delay, audio and video format, resolution, screen scanning mode, code rate, and frame rate, and encapsulating media resource playback functions. Sex and reusability. Therefore, at this time, it is mainly to set parameters related to the above tasks of the playback engine. For example, the video playback engine can be initialized by reading part of the video stream information from the video memory cache of the cache module.
( 3 )初始化解码器;  (3) initializing the decoder;
解码器, 即视频解码器, 是指一个能够对数字视频进行压缩或者解 压缩的程序,这里的初始化指的是对解码器的相关参数进行配置。比如, 可以从緩存模块的视频内存缓存中, 读取部分视频流信息, 来进初始化 解码器。  A decoder, a video decoder, refers to a program that can compress or decompress digital video. Initialization here refers to configuring the relevant parameters of the decoder. For example, part of the video stream information can be read from the video memory buffer of the cache module to initialize the decoder.
( 4 )初始化缓存模块;  (4) initializing the cache module;
缓存模块, 指以内存的方式存储下载的缓存文件, 一般.应用于缓存 长度较少、 使用完就会释放、 以及.读取.速度要求快的场景。 在本申请实 施例中, RTSP視频流都是以视频片段的形式从网络下载, 并使用内存 緩存的方式进行管理。  Cache module, which refers to storing the downloaded cache file in memory. Generally, it is applied to scenes with less cache length, freed after use, and fast reading speed. In the embodiment of the present application, the RTSP video stream is downloaded from the network in the form of a video clip and managed by means of a memory buffer.
204、 终端确定 RTSP视频流的链接地 i , 比如 URL是否以 "rtsp" 开头, 若是, 则根据 TCP协议来配置传输参数, 若否, 则采用 UDP协 议来配置传输参数, 具体可以如下: 204. The terminal determines a link i of the RTSP video stream, such as whether the URL is "rtsp" At the beginning, if yes, the transmission parameters are configured according to the TCP protocol. If not, the UDP protocol is used to configure the transmission parameters, which can be as follows:
终端确定该 RTSP视频流的链.接地址是否以 "rtsp" 开头, 若是, 则 可以确定该 RTSP视频流的传输协议类型为 TCP, 因此, 可以根椐 TCP 协议来配置传输参数。 比如, 在传输时, 控制层可以采用 TCP协议来传 输控制信息, 并采用指定的端口号, 以及与媒体服务器通过控制层传输 控制信息, 以协商传输层(用于播放器与服务器传递控制流媒体数据) 使用哪一种网絡协议 (如 UDP、 RDP或 TCP等)。 若该 RTSP视频流的 链接地址不是以 "rtsp" 开头, 则可以确定该视频流的传输协议类型为 UDP, 那么, 可以采用 UDP协议来配置传输参数。 比如在传输时, 控 制层则可以采用 UDP协议来传输控制信息, 并采用指定的端口号, 以 及与媒体服务器通过控制层传输控制信息, 以协商传输层(用于播放器 与服务器传递控制流媒体数据 )使用哪一种网络协议。  The terminal determines whether the link address of the RTSP video stream starts with "rtsp". If yes, it can be determined that the transport protocol type of the RTSP video stream is TCP. Therefore, the transmission parameters can be configured according to the TCP protocol. For example, during transmission, the control layer can use the TCP protocol to transmit control information, and use the specified port number, and transmit control information with the media server through the control layer to negotiate the transport layer (for the player and server to transfer control streaming media) Data) Which network protocol (such as UDP, RDP or TCP) is used. If the link address of the RTSP video stream does not start with "rtsp", it can be determined that the transport protocol type of the video stream is UDP. Then, the UDP protocol can be used to configure the transmission parameters. For example, during transmission, the control layer can use the UDP protocol to transmit control information, and use the specified port number, and transmit control information with the media server through the control layer to negotiate the transport layer (for the player and server to transfer control streaming media). Data) Which network protocol is used.
需说明的是, 若端口号为空或者未指定, 则可以使用 554端口。 其中, 与媒体服务器协商传输层使用哪一种网络协议的过^ _也可以 称为传输初始 。  It should be noted that if the port number is empty or not specified, port 554 can be used. Among them, the negotiation with the media server which network protocol is used by the transport layer may also be referred to as the transmission initial.
205、 媒体服务器根椐该传输参数分配视频流资源, 以及启动 RTSP 会话, 进而启动 RTSP视频流的数椐传输。  205. The media server allocates a video stream resource according to the transmission parameter, and starts an RTSP session, thereby starting a digital transmission of the RTSP video stream.
206、 终端基于该视频流资源和 RTSP会话从媒体服务器获取 RTSP 视频流, 比如下载 RTSP视频流。  206. The terminal acquires an RTSP video stream from the media server based on the video stream resource and the RTSP session, for example, downloading an RTSP video stream.
例如, 终端可以基于该视频流资源和 RTSP会话, 向媒体服务器发 送 RTSP视频流的下载请求, 然后接收媒体服务器返回的 RTSP视频流。  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.
比如可以采用步骤 204中所确定的传输层网络协 i义 (如 UDP、 RDP 或 TCP等 )来从媒体服务器中下载 TSP视频流, 并把下载的 TSP视 频流存储在内存中, 以供视频播放引擎和解码器等进行调用, 并进行播 放。 For example, the transport layer network association (such as UDP, RDP, or TCP, etc.) determined in step 204 may be used to download the TSP video stream from the media server, and the downloaded TSP video stream is stored in the memory for video playback. Called by engine and decoder, etc. Put it.
其中, 最多缓存多少 RTSP视频流由终端中的视频播放器与媒体服 务器协商决定。  Among them, the maximum number of RTSP video streams to be cached is determined by the video player in the terminal and the media server.
207、 终端通过视频播放器播放 RTSP视频流。  207. The terminal plays the RTSP video stream through the video player.
视频播放器的播放引擎驱动播放 RTSP视频流片段, 比如, 可以从 缓存模块的内存缓存中读取 RTSP视频流数据,并利用解码器进行解码、 渲染、 输出画面和声音。 播放完的内存缓存会被立刻释放掉, 再驱动缓 存继续缓存后面的 RTSP视频流数据。  The video player's playback engine driver plays the RTSP video stream segment. For example, the RTSP video stream data can be read from the cache module's memory buffer, and the decoder can be used to decode, render, output the picture and sound. The played memory cache will be released immediately, and then the cache will continue to cache the RTSP video stream data.
其中, 播放引擎需要与缓存模块进行通讯, 以协调工作, 才能保证 视频播放器一直正常播放 RTSP视频流。  The playback engine needs to communicate with the cache module to coordinate the work, so as to ensure that the video player always plays the RTSP video stream normally.
208、 终端确定 RTSP视频流的获取是否出现异常, 若出现异常, 则 执行步骤 209, 若未出现异常, 则执行步骤 212。  208. The terminal determines whether an abnormality occurs in the acquisition of the RTSP video stream. If an abnormality occurs, step 209 is performed. If no abnormality occurs, step 212 is performed.
其中, RTSP视频流的获取出现异常指的是由于网络不稳定或者媒体 服务器不稳定, 或者其他的原因而导致无法正常下载 RTSP视频流的情 况。  The abnormality in the acquisition of the RTSP video stream refers to the fact that the RTSP video stream cannot be downloaded normally due to unstable network or unstable media server or other reasons.
209、 终端确定 RTSP视频流的获取出现异常时, 判断传输层网络协 议的尝试次数是否低于预设第一阈值。 若尝试次数低于第一阈值, 则利 用原传输层网络协议, 尝试重新下载该 RTSP视频流, 即返回执行步驟 206。 若尝试次数不低于第一阈值, 则表示连续尝试了多次 (第一阈值) 还未下载成功, 因此, 执行步驟 210。  209. When the terminal determines that the acquisition of the RTSP video stream is abnormal, determine whether the number of attempts of the transport layer network protocol is lower than a preset first threshold. If the number of attempts is lower than the first threshold, the original transport layer network protocol is used to attempt to re-download the RTSP video stream, and the process returns to step 206. If the number of attempts is not lower than the first threshold, it means that the number of consecutive attempts (first threshold) has not been successfully downloaded, therefore, step 210 is performed.
其中, 第一阈值可以根据实际应用的需求进行设置, 比如, 可以设 置为 3次, 或其它值。  The first threshold may be set according to the requirements of the actual application, for example, may be set to 3 times, or other values.
210、 终端判断 RTSP会话的尝试次数是否低于预设第二阈值。 若尝 试次数低于第二阈值, 则锋放该 KTSP视频流资源, 以及停止该 RTSP 会话, 并尝试重新配置传输参数, 以对视频流进行重新下载, 即返回执 行步骤 204中的配置传输参数的步骤。 若尝试次数不低于第二阈值, 则 表示连续尝试了多次(第二阈值)还未下载成功, 于是执行步骤 211。 210. The terminal determines whether the number of attempts of the RTSP session is lower than a preset second threshold. If the number of attempts is lower than the second threshold, the KTSP video stream resource is forwarded, and the RTSP session is stopped, and the transmission parameter is attempted to be re-downloaded to re-download the video stream, that is, the return is performed. The step of configuring the transmission parameters in step 204 is performed. If the number of attempts is not lower than the second threshold, it means that the consecutive attempts (second threshold) have not been successfully downloaded, and then step 211 is performed.
其中, 第二阈值可以根据实际应用的需求进行设置, 比如, 可以设 置为 3次, 或其它值。  The second threshold may be set according to the requirements of the actual application, for example, may be set to 3 times, or other values.
211、 终端进 _行报错处理, 比如, 可以释放该视频流资源, 以及停止 该 RTSP会话, 并提示播放错误信息。  211. The terminal processes the error, for example, releasing the video stream resource, stopping the RTSP session, and prompting to play an error message.
可选的, 在进行报错处理之后, 为了节省资源, 可以释放相应的空 间, 比如, 释放缓存.模块, 流程结束。  Optionally, after the error 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、 若 RTSP視频流的获^ I未出现异常, 則终端判断用户是否退出 该视频播放器。 若用户退出该视频播放器, 则释放缓存模块、 以及解码 器等, 以#放资源等, 流程结束。 若用户没有退出该視频播放器, 则继 续下载下一段视频流, 即返回执行步骤 206。  212. If the RTSP video stream is not abnormal, the terminal determines whether the user exits the video player. If the user exits the video player, the cache module, the decoder, and the like are released, and the process is terminated by putting resources and the like. If the user has not exited the video player, then the next video stream is downloaded, and the process returns to step 206.
由上可知, 本实施例采用在接收到携带 RTSP视频流标识的视频播 放请求后, 根据该 RTSP視频流标识从媒.体服务器获取 RTSP视频流, 在确定 RTSP 频流的获取.出现异常时, 判断传输层网络协议的尝试次 数是否低于第一阈值。 在尝试次数不低于第一阈值时, 又进一步判断 RTSP会话的尝试次数是否低于预设第二阈值, 从而来确定是否进行相 应的异常尝试操作,在进行了相应的异常尝试操作后,才进行报错处理。 该方案在视频流出现异常时, 可以提供相应的异常尝试操作, 最大程度 保障视频可以继续播放下去。 因此, 相对现有技术在遇到异常时则直接 报错的方案而言, 可以提供提高播放 RTSP视频时的稳定性和流畅性, 大大提高用户体验。  As can be seen from the above, after receiving the video play request carrying the RTSP video stream identifier, the embodiment obtains the RTSP video stream from the media server according to the RTSP video stream identifier, and determines the acquisition of the RTSP frequency stream. And determining whether the number of attempts of the transport layer network protocol is lower than a first threshold. When the number of attempts is not lower than the first threshold, it is further determined whether the number of attempts of the RTSP session is lower than a preset second threshold, thereby determining whether to perform a corresponding abnormal attempt operation, and after performing the corresponding abnormal attempt operation, Perform error handling. When the video stream is abnormal, the scheme can provide corresponding abnormal attempt operation to ensure that the video can continue to play. Therefore, compared with the prior art, in the case of an error directly reporting an error, the stability and fluency of the RTSP video can be improved, and the user experience is greatly improved.
为了更好地实施以上方法, 本申请实施例还提供一种视频流的处理 装置, 如图 3所示, 该视频流的处理装置可以包括接收单元 301、 获取 单元 302和处理单元 303。 接收单元 301可以接收视频播放请求。 In order to better implement the above method, the embodiment of the present application further provides a video stream processing apparatus. As shown in FIG. 3, the video stream processing apparatus may include a receiving unit 301, an obtaining unit 302, and a processing unit 303. The receiving unit 301 can receive a video play request.
例如, 接收单元 301 , 可以用于接收用户通过点击視频播放键或视 频链接地址所触发的视频播放请求 , 等等。  For example, the receiving unit 301 can be configured to receive a video play request triggered by the user by clicking a video play button or a video link address, and the like.
其中, 该視频播放请求可以携带視频流标识等信息, 该视频流标识 用于识别视频流, 比如, 该视频流标识可以是视频流的名称、 编号或链 接地址等  The video play request may carry information such as a video stream identifier, where the video stream identifier is used to identify a video stream. For example, the video stream identifier may be a name, a number, or a link address of the video stream.
该视频流具体可以为 RTSP视频流或其他格式的直播视频流。  The video stream may specifically be an RTSP video stream or a live video stream in other formats.
获取单元 302可以根据该视频流标识从媒体服务器获取视频流。 处理单元 303可以确定视频流的获取出现异常时, 判断获取视频流 的尝试次数是否低于预设值; 若是, 则触发获取单元 302执行从媒体服 务器获取视频流的操作; 若否, 则进行报错处理。  The obtaining unit 302 can acquire a video stream from the media server according to the video stream identifier. The processing unit 303 may determine whether the number of attempts to obtain the video stream is lower than a preset value when the acquisition of the video stream is abnormal; if yes, the trigger acquiring unit 302 performs an operation of acquiring the video stream from the media server; if not, the error is reported. deal with.
例如, 处理单元 303可以判断传输层网络" ^议的尝试次数是否低于 预设第一阈值;  For example, the processing unit 303 can determine whether the number of attempts of the transport layer network is lower than a preset first threshold;
若低于第一阈值, 则返回触发获取子单元执行基于该视频流资源和 TSP会话从媒体服务器获取视频流的操作;  If it is lower than the first threshold, returning to the trigger acquisition subunit to perform an operation of acquiring a video stream from the media server based on the video stream resource and the TSP session;
若不低于第一阈值, 则判断 RTSP会话的尝试次数是否低于预设第 二阈值, 若低于第二阈值, 则释放该视频流资源, 以及停止该 RTSP会 话, 并触发获取子单元执行根据该传输协议类型配置传输参数的操作; 若不低于第二阔值, 则进行报错处理。  If the threshold is not lower than the first threshold, determine whether the number of attempts of the RTSP session is lower than a preset second threshold. If the threshold is lower than the second threshold, release the video stream resource, stop the RTSP session, and trigger the acquiring sub-unit to execute. The operation of configuring the transmission parameter according to the type of the transmission protocol; if not lower than the second threshold, the error processing is performed.
其中, 报错处理的方式可以有多种, 比如, 可以释放该视频流资源, 以及停止该 RTSP会话 ., 并提示播放错误信息。  There may be multiple ways of error processing, for example, the video stream resource may be released, and the RTSP session is stopped, and an error message is prompted.
例如, 该处理单元 303可以在确定判断 RTSP会话的尝试次数不低 于预设第二阈值时, 释放该视频流资源, 以及停止该 RTSP会话, 并提 示播放错误信息。  For example, the processing unit 303 may release the video stream resource, stop the RTSP session, and prompt the playback error message when determining that the number of attempts of the RTSP session is not lower than the preset second threshold.
其中, 视频流出现异常指的是由于网络不稳定或者媒体服务器不稳 定, 或者其他的原因而导致无法正常下载视频流的情况。 Among them, the abnormality of the video stream refers to the instability of the network or the instability of the media server. For some reason, or for other reasons, the video stream cannot be downloaded normally.
一些例子中, 在进行报错处理之后, 为了节省资源, 可以释放相应 的空间, 比如, 释放缓,存模块。  In some cases, after the error processing, in order to save resources, the corresponding space can be released, for example, the release module is released.
此外, 若视频流的获取没有出现异常, 则获取单元 302可以继续下 In addition, if no abnormality occurs in the acquisition of the video stream, the obtaining unit 302 may continue to
5 载该视频流, 直至用户退出该视频播放器。 在退出视频播放器之后, 同 样可以释放緩存模块、 以及解码器等, 以释放资源。 5 Load the video stream until the user exits the video player. After exiting the video player, the cache module, decoder, etc. can also be released to free up resources.
其中, 该获取单元 302可以包括确定子单元、 创建子单元和获取子 单元, 如下:  The obtaining unit 302 may include a determining subunit, a creating subunit, and an obtaining subunit, as follows:
该确定子单元, 用于根据该视频流标识确定视频流的链接地址。 t o 创建子单元, 用于根据该链接地址创建视频播放器, 并对该视频播 放器进行初始化。  The determining subunit is configured to determine a link address of the video stream according to the video stream identifier. t o Create a subunit to create a video player based on the link address and initialize the video player.
比如, 根据该链接地址创建视频播放器后, 该创建子单元可以分别 对播放器界面、 播放引擎、 解码器和缓存模块等进行初始化, 详见前面 的实施例, 在此不再赞述。  For example, after the video player is created according to the link address, the creation subunit can initialize the player interface, the playback engine, the decoder, the cache module, and the like, respectively. For details, refer to the previous embodiment, which is not mentioned here.
15 获取.子单元, 用于根据该链接地址, 通过初始化后的视频播放器从 媒体服务器获取视频流。  15 Acquire a subunit for obtaining a video stream from the media server through the initialized video player according to the link address.
例如, 该获取.子单元, 具体可以用于根据该链接地址确定该视频流 的传输协议类型, 根据该传输协议类型配置传输参数, 以便该媒体服务 器根据该传输参数分配视频流资源, 以及启动 RTSP会话, 然后, 基于 0 该视频流资源和 RTSP会话从媒体服务器获取视频流。  For example, the obtaining sub-unit may be specifically configured to determine a transmission protocol type of the video stream according to the link address, configure a transmission parameter according to the transmission protocol type, so that the media server allocates video stream resources according to the transmission parameter, and starts RTSP. Session, then, based on 0 the video stream resource and the RTSP session get the video stream from the media server.
则此时, 该处理单元 303可以确定视频流的荻.取出现异常时, 判断 获取 4¾频流的尝试次数是否低于预设值; 若是, 则触发获取子单元执行 根据该链接地址, 通过初始化后的视频播放器从媒.体服务器获取视频流 的操作, 若否, 則进 _行报错处理。 Then, the processing unit 303 can determine the 视频 of the video stream. When an abnormality occurs, it is determined whether the number of attempts to acquire the frequency stream is lower than a preset value; if yes, the triggering acquisition sub-unit performs initialization according to the link address. After the video player obtains the video stream from the media server, if not, the error processing is performed.
5 其中, 传输协议类型可以包括传输控制协议( TCP , Transmission Control Protocol )和用户数据才艮协议. ( UDP, User Datagram Protocol )等。 比如, 以该视频流为 RTSP视频流为例, 若该视频流的链接地址以 "rtsp" 开头, 则获取子单元可以确定该视频流的传输协议类型为 TCP, 因此, 可以根据 TCP协议来配置传输参数。 比如, 在传输时, 控制层可 以采用 TCP协议来传输控制信息, 以及传输层应该采用哪种网络协议 等。 若该视频流的链接地址不是以 "rtsp" 开头, 则获取子单元可以确 定该视频流的传输协议类型为 UDP, 那么, 可以采用 UDP协议来配置 传输参数。 比如在传输时, 控制层则可以采用 UDP协议来传输控制信 息, 以及传输层应该采用哪种网络协议, 等等。 5 where the transport protocol type may include a transmission control protocol (TCP , Transmission Control Protocol) and User Data Protocol (UDP, User Datagram Protocol). For example, if the video stream is an RTSP video stream, if the link address of the video stream starts with "rtsp", the obtaining sub-unit can determine that the transmission protocol type of the video stream is TCP, and therefore, can be configured according to the TCP protocol. Transfer parameters. For example, during transmission, the control layer can use the TCP protocol to transmit control information, and which network protocol the transport layer should use. If the link address of the video stream does not start with "rtsp", the obtaining subunit can determine that the transport protocol type of the video stream is UDP, then the UDP protocol can be used to configure the transmission parameters. For example, during transmission, the control layer can use the UDP protocol to transmit control information, and which network protocol the transport layer should use, and so on.
在配置了传输参数, 传输初始化之后, 媒体服务器便可以根据该传 输参数分配視频流资源, 以及启动 RTSP会话, 进而启动视频流的数据 传输, 比如, 此时获取子单元可以基于该视频流资源和 RTSP会话, 向 媒体服务器发送视频流的下载请求, 然后接收媒体服务器返回的视频 获取子单元下载到视频流之后, 可以由缓.存模块将该视频流缓存在 内存中, 以供播放引擎和解码器等进行调用, 并进行播放。  After the transmission parameters are configured, the media server can allocate video stream resources according to the transmission parameters, and start an RTSP session, thereby starting data transmission of the video stream. For example, the acquiring subunit can be based on the video stream resource. And the RTSP session, sending a download request of the video stream to the media server, and then receiving the video acquisition subunit returned by the media server and downloading the video stream to the video stream, the buffer stream may be cached in the memory for the playback engine and The decoder or the like makes a call and plays it.
具体实施时, 以上各个单元可以作为独立的实体来实现, 也可以进 行任意组合, 作为同一或若干个实体来实现, 以上各个单元的具体实施 可参见前面的方法实施例, 在此不再赘述。  In the specific implementation, the foregoing units may be implemented as a separate entity, and may be implemented in any combination, and may be implemented as the same entity or a plurality of entities. For the specific implementation of the foregoing, refer to the foregoing method embodiments, and details are not described herein.
该视频流的处理装置具体可以集成在终端等设备中。 终端具体可以 为手机、 平板电脑或笔记本电脑等设备。  The processing device of the video stream may be specifically integrated in a device such as a terminal. The terminal can be specifically a device such as a mobile phone, a tablet or a laptop.
由上可知, 本实施例的视频流的处理装置在接收到携带视频流标识 的视频播放请求后, 可以由获取单元 301根据该视频流标识从媒体服务 器获取视频流, 并由处理单元 303在确定视频流的获取出现异常时, 判 断获取视频流的尝试次数是否低于预设值, 若是, 则触发获取单元 302 执行从媒体服务器获取视频流的操作, 否则, 若不低于预设值, 才进行 报错处理; 由于该方案在视频流出现异常时, 可以提供相应的异常尝试 操作, 最大程度保障视频可以继续播放下去, 因此, 相对现有技术在遇 到异常时则直接报错的方案而言, 可以提供提高播放视频, 如 RTSP视 频时的稳定性和流畅性, 大大提高用户体验。 It can be seen that, after receiving the video play request carrying the video stream identifier, the processing unit of the video stream of the embodiment may obtain the video stream from the media server according to the video stream identifier by the obtaining unit 301, and the processing unit 303 determines When the acquisition of the video stream is abnormal, it is determined whether the number of attempts to obtain the video stream is lower than a preset value, and if so, the acquisition unit 302 is triggered. Perform the operation of obtaining the video stream from the media server. Otherwise, if the error is not lower than the preset value, the error processing is performed. Because the solution is abnormal when the video stream is abnormal, the corresponding abnormal attempt operation can be provided to ensure that the video can continue to play. Going down, therefore, compared with the prior art, in the case of an error directly reporting an error, it can provide improved stability and fluency when playing video, such as RTSP video, and greatly improve the user experience.
相应的, 本申请实施例还提供一种视频流的处理系统, 可以包括本 申请各实施例视频流的处理装置。 其中, 该视频流的处理装置可以集成 在终端等设备中。  Correspondingly, the embodiment of the present application further provides a processing system for a video stream, which may include a processing device for a video stream in each embodiment of the present application. The processing device of the video stream can be integrated in a device such as a terminal.
视频流的处理装置可以接收视频播放请求, 该视频播放请求携带视 频流标识; 根据该视频流标识从媒体服务器获取视频流; 确定视频流的 获取出现异常时, 判断获取視频流的尝试次数是否低于预设值; 若是, 则返回执行从媒体服务器获取视频流的步骤; 若否, 則进 _行报错处理。  The video stream processing device may receive a video play request, where the video play request carries a video stream identifier; obtain a video stream from the media server according to the video stream identifier; and determine, when the video stream acquisition is abnormal, determine whether the number of attempts to obtain the video stream is It is lower than the preset value; if yes, it returns to the step of acquiring the video stream from the media server; if not, it enters the error processing.
例如, 该频流的处理装置可以用于;^据该视频流标识确定视频流的 链接地址, 根据该链接地址创建視频播放器, 并对该视频播放器进行初 始化, 根据该链接地址, 通过初始化后的视频播放器从媒体服务器获取 视频流; 判断传输层网絡协议的尝试次数是否低于预设第一阈值; 若低 于第一阈值, 则返回执行基于该视频流资源和 RTSP会话从媒体服务器 获取视频流的操作; 若不低于第一阈值, 则判断 RTSP会话的尝试次数 是否低于预设第二阈值, 若低于第二阈值, 则释放该视频流资源, 以及 停止该 RTSP会话, 并返回执行根据该传输协议类型配置传输参数的操 作; 若不低于第二阈值, 则进行报错处理。  For example, the processing device of the frequency stream may be 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, and initialize the video player, according to the link address, The initialized video player obtains a video stream from the media server; determines whether the number of attempts of the transport layer network protocol is lower than a preset first threshold; if lower than the first threshold, returns to perform the media based on the video stream resource and the RTSP session The operation of the server to obtain the video stream; if not lower than the first threshold, determining whether the number of attempts of the RTSP session is lower than a preset second threshold, if the second threshold is lower, releasing the video stream resource, and stopping the RTSP session And returning to perform an operation of configuring a transmission parameter according to the type of the transmission protocol; if not lower than the second threshold, performing an error processing.
其中, 第一阈值和第二阈值可以根据实际应用的需求进―行设置, 比 如, 可以设置第一阈值和第二阈值均为 3次, 在此不再赘述。  The first threshold and the second threshold may be set according to the requirements of the actual application. For example, the first threshold and the second threshold may be set to 3 times, and details are not described herein again.
此外, 该视频流的处理系统还可以包括其他的设备, 比如, 还可以 包括媒体服务器。 该媒体服务器可以向视频流的处理装置提供视频流。 In addition, the processing system of the video stream may further include other devices, for example, a media server. The media server can provide a video stream to the processing device of the video stream.
以上各个设^ ·的具体实施可参见前面的实施例, 在此不再赘述。 由于该视频流的处理系统可以包括本申请实施例所提供.的任一种视 频流的处理装置, 因此, 可以实现本申请实施例所提 的任一种视频流 的处理装置所能实现的有益效果, 详见前面的实施例, 在此不再赘述。  For the specific implementation of the above, refer to the foregoing embodiments, and details are not described herein again. The processing system of the video stream may include any processing device of the video stream provided by the embodiment of the present application. Therefore, the processing device of any video stream proposed by the embodiment of the present application may be implemented. For the effect, please refer to the previous embodiment, and details are not described herein again.
本申请实施例还提^一种视频流的处理装置。 图 4为本申请实施例 的一种视频流的处理装置的示意图。 如图 4所示, 该装置可以包括处理 器 41、 通信接口 44、 存储装置 46和总线 49。 存储装置 46中包括搡作 系统 47、 通信模块 48和流处理模块 43。  The embodiment of the present application further provides a processing device for a video stream. FIG. 4 is a schematic diagram of a video stream processing apparatus according to an embodiment of the present application. As shown in FIG. 4, the apparatus can include a processor 41, a communication interface 44, a storage device 46, and a bus 49. The storage device 46 includes a production system 47, a communication module 48, and a stream processing module 43.
处理器 41可以有一个或者多个, 可以在同一个物理设备中, 或者分 布在多个物理设备中。  The processor 41 may have one or more, may be in the same physical device, or be distributed among multiple physical devices.
该装置可以利用通信接口 44 通过某种网络接收媒体服务器发送的 視频流。  The device can receive the video stream sent by the media server over a certain network using the communication interface 44.
流处理模块 43 可以包括接收单元 431、 获耳又单元 432和处理单元 433。  The stream processing module 43 may include a receiving unit 431, an ear unit 432, and a processing unit 433.
接收单元 431可以接收视频播放请求。  The receiving unit 431 can receive a video play request.
获取单元 432可以根据该视频流标识从媒体服务器获取视频流。 处理单元 433可以在确定视频流的获取出现异常时, 判断获取视频 流的尝试次数是否低于预设值; 若是, 则触发获取单元 432执行从媒体 服务器获取视频流的操作; 若否, 则进行报错处理。  The obtaining unit 432 can acquire the video stream from the media server according to the video stream identifier. The processing unit 433 may determine, when the acquisition of the video stream is abnormal, whether the number of attempts to acquire the video stream is lower than a preset value; if yes, the trigger obtaining unit 432 performs an operation of acquiring the video stream from the media server; if not, proceeding Error handling.
接收单元 431、 获取单元 432和处理单元 433的功能与上述接收单 元 301、 获取单元 302和处理单元 303类似, 这里不再赘述。  The functions of the receiving unit 431, the obtaining unit 432, and the processing unit 433 are similar to the receiving unit 301, the obtaining unit 302, and the processing unit 303, and are not described herein again.
需要说明的是, 上述各流程和各结构图中不是所有的步骤和模块都 是必须的, 可以根据实际的需要忽略某些步骤或模块。 各步骤的执行顺 序不是固定的, 可以根据需要进行调整。 各模块的划分仅仅是为了便于 描述釆用的功能上的划分, 实际实现时, 一个模块可以分由多个模块实 现, 多个模块的功能也可以由同一个模块实现, 这些模块可以位于同一 个设备中, 也可以位于不同的设备中。 另外, 上面描述中采用 "第一,,、 "第二" 仅仅为了方便区分具有同一含义的两个对象, 并不表示其有实 质的区别。 It should be noted that not all the steps and modules in the foregoing processes and the various structural diagrams are necessary, and some steps or modules may be omitted according to actual needs. The order of execution of each step is not fixed and can be adjusted as needed. The division of each module is only for the convenience Describe the functional division of the application. In actual implementation, a module can be implemented by multiple modules. The functions of multiple modules can also be implemented by the same module. These modules can be located in the same device or in different In the device. In addition, the use of "first," and "second" in the above description merely for the convenience of distinguishing two objects having the same meaning does not mean that there is a substantial difference.
各实施例中的硬件模块可以以硬件方式或硬件平台加软件的方式实 现。 上述软件包括机器可读指令, 存储在 易失性存储介质中。 因此, 各实施例也可以体现为软.件产品。  The hardware modules in the embodiments may be implemented in a hardware manner or a hardware platform plus software. The above software includes machine readable instructions stored in a volatile storage medium. Therefore, each embodiment can also be embodied as a soft product.
各例中, 硬件可以由专门的硬件或执行机器可读指令的硬件实现。 例如, 硬件可以为专门设计的永久性电路或逻辑器件(如专用处理器, 如 FPGA或 ASIC )用于完成特定的操作。 硬件也可以包括由软件临时 配置的可编程逻辑器件或电路(如包括通用处理器或其它可编程处理 器)用于执行特定操作。  In each case, the hardware may be implemented by specialized hardware or hardware that executes machine readable instructions. For example, the hardware can be specially designed for permanent circuits or logic devices (such as dedicated processors such as FPGAs or ASICs) for performing specific operations. The hardware may also include programmable logic devices or circuits (such as including general purpose processors or other programmable processors) that are temporarily configured by software for performing particular operations.
图中的模块对应的机器可读指令可以使计算机上操作的搡作系统等 来完成这里描述的部分或者全部操作。 非易失性计算机可读存储介质可 以是插入计算机内的扩展板中所设置的存储器中或者写到与计算机相 连接的扩展单元中设置的存储器。安装在扩展板或者扩展单元上的 CPU 等可以根椐指令执行部分和全部实际操作。  The machine readable instructions corresponding to the modules in the figures may be implemented by a system or the like operating on a computer to perform some or all of the operations described herein. The non-transitory computer readable storage medium may be inserted into a memory provided in an expansion board within the computer or written to a memory provided in an expansion unit connected to the computer. The CPU or the like installed on the expansion board or expansion unit can perform some and all of the actual operations according to the instructions.
非易失性计算机可读存储介质包括软盘、 硬盘、 磁光盘、 光盘(如 CD-ROM , CD- , CD-RW , DVD-ROM > DVD- RAM、 DVD- RW、 DVD+RW )、 磁带、 非易失性存储卡和 ROM。 可选择地, 可以由通信网 络从服务器计算机上下载程序代码。  Non-transitory computer readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (eg, CD-ROM, CD-, CD-RW, DVD-ROM > DVD-RAM, DVD-RW, DVD+RW), magnetic tape, Non-volatile memory card and ROM. Alternatively, the program code can be downloaded from the server computer by the communication network.
综上所述, 权利要求的范围不应局限于以上描述的例子中的实施方 式, 而应当将说明书作为 - 个整体并给予最宽泛的解释。  In summary, the scope of the claims should not be limited to the embodiments in the examples described above, but the description should be taken as a whole and given the broadest explanation.

Claims

1、 一种视频流的处理方法, 其特征在于, 包括:  A method for processing a video stream, comprising:
接收视频播放请求, 所述视频播放请求携带视频流标识; 根据所述视频流标识从媒体服务器获取视频流;  Receiving a video play request, where the video play request carries a video stream identifier; and acquiring a video stream from the media server according to the video stream identifier;
确定视频流的获取出现异常时, 判断获取视频流的尝试次数是否低 于预设值;  When it is determined that the acquisition of the video stream is abnormal, it is determined whether the number of attempts to obtain the video stream is lower than a preset value;
若是, 则返回执行从媒体服务器获取.视频流的步骤;  If yes, returning to the step of obtaining a video stream from the media server;
若否, 则进行报错处理。  If not, an error handling process is performed.
1、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述视频流 标识从媒体服务器获取视频流, 包括:  The method according to claim 1, wherein the acquiring 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 identifier;
根据所述.链接地址创建视频播放器, 并对所述视频播^^器进行初始 化;  Creating a video player according to the link address, and initializing the video broadcaster;
根据所述链接地址, 通过初始化后的视频播放器从媒体服务器获取 视频流;  Obtaining a video stream from the media server by the initialized video player according to the link address;
所述返回执行从媒体服务器获取视频流的步骤, 具体为: 返回执行 根据所述链接地址, 通过初始化后的视频播放器从媒体服务器获取视频 流的步骤。  The step of returning to obtain a video stream from the media server is specifically: returning to the step of acquiring a video stream from the media server by the initialized video player according to the link address.
3、 根据权刮要求 2所述的方法, 其特征在于, 所述对所述 频播放 器进行初始化, 包括:  3. The method according to claim 2, wherein the initializing the frequency player comprises:
分别对播放器界面、 播放引擎、 解码器和缓存模块进行初始化。 The player interface, the playback engine, the decoder, and the cache module are initialized separately.
4、根据权利要求 2所述的方法, 其特征在于, 所述根据所述链接地 址, 通过初始化后的视频播放器从媒体服务器获取视频流, 包括: 根据所述链接地址确定所述.視频流的传输协议类型; 根据所述传输协议类型配置传输参数, 以便所述媒体服务器根据所 述传输参数分配视频流资源, 以及启动实时流传输协议 RTSP会话; 基于所述视频流资源和 RTSP会话从媒体服务器获取视频流。 The method according to claim 2, wherein the obtaining, by the initialized video player, the video stream from the media server according to the link address comprises: determining the video according to the link address The type of transport protocol for the stream; And configuring a transmission parameter according to the transmission protocol type, so that the media server allocates a video stream resource according to the transmission parameter, and starts a real-time streaming protocol RTSP session; and acquires a video stream from the media server based on the video stream resource and the RTSP session.
5、根据权利要求 4所述的方法, 其特征在于, 所述判断获取视频流 的尝试次数是否低于预设值, 若是, 则返回执行从媒体服务器获取视频 流的步驟; 若否, 则进行艮错处理, 包括:  The method according to claim 4, wherein the determining whether the number of attempts to acquire the video stream is lower than a preset value, and if yes, returning to the step of acquiring a video stream from the media server; if not, proceeding Wrong handling, including:
判断传输层网絡协议的尝试次数是否低于预设第一阈值;  Determining whether the number of attempts of the transport layer network protocol is lower than a preset first threshold;
若低于第一阈值, 则返回执行基于所述视频流资源和 RTSP会话从 媒体服务器获取视频流的步骤;  If it is lower than the first threshold, returning to perform the step of acquiring a video stream from the media server based on the video stream resource and the RTSP session;
若不低于第一阔值, 则判断 RTSP会话的尝试次数是否低于预设第 二阈值,若低于第二阈值, 则释放所述视频流资源, 以及停止所述 RTSP 会话, 并返回执行根据所述传输协议类型配置传输参数的步骤; 若不低 于第二阈值, 则进行报错处理。  If the value is not lower than the first threshold, it is determined whether the number of attempts of the RTSP session is lower than a preset second threshold. If the second threshold is lower, the video stream resource is released, and the RTSP session is stopped, and the execution is returned. And the step of configuring the transmission parameter according to the type of the transmission protocol; if not lower than the second threshold, performing an error processing.
6、 根据权利要求 5所述的方法, 其特征在于, 所述进行报错处理, 包括:  The method according to claim 5, wherein the performing error processing includes:
釋放所述视频流资源, 以及停止所述 RTSP会话, 并提示播放错误 信息。  The video stream resource is released, and the RTSP session is stopped, and an error message is prompted to be played.
7、 一种视频流的处理装置, 其特征在于, 包括:  A device for processing a video stream, comprising:
接收单元, 用于接收视频播放请求, 所述视频播放 _请求携带视频流 标识;  a receiving unit, configured to receive a video play request, where the video play_request carries a video stream identifier;
获取单元, 用于根据所述视频流标识从媒体服务器获取视频流; 处理单元, 用于确定视频流的获 $1出现异常时, 判断获取 ¾频流的 尝试次数是否低于预设值; 若是, 则触发获取单元执行从媒.体服务器获 取视频流的操作; 若否, 则进-行报错处理。  An obtaining unit, configured to: acquire a video stream from the media server according to the video stream identifier; and use, by the processing unit, to determine whether the number of attempts to acquire the 3⁄4 stream is lower than a preset value when the video stream is abnormally obtained by the $1; Then, the trigger acquisition unit performs an operation of acquiring a video stream from the media server; if not, the error processing is performed.
8、根据权利要求 7所述的装置, 其特征在于, 所述获取单元包括确 定子单元、 创建子单元和获取子单元; 8. The apparatus according to claim 7, wherein the obtaining unit comprises a stator unit, a creation subunit, and an acquisition subunit;
所述确定子单元,用于根据所述视频流标识确定视频流的链接地址; 创建子单元, 用于根椐所述链接地址创建视频播放器, 并对所述.视 频播放器进行初始化;  Determining a subunit, configured to determine a link address of the video stream according to the video stream identifier; creating a subunit, configured to create a video player based on the link address, and initializing the video player;
获取子单元, 用于根据所述链接地址, 通过初始化后的视频播放器 从媒体服务器获取视频流;  Obtaining a subunit, configured to acquire a video stream from the media server by using the initialized video player according to the link address;
所述处理单元, 具体用于确定视频流的获取出现异常时, 判断获取 视频流的尝试次数是否低于预设值; 若是, 则触发获取子单元执行根据 所述链接地址, 通过初始化后的视频播放器从媒体服务器获取视频流的 操作, 若否, 则进行报错处理。  The processing unit is specifically configured to determine whether the number of attempts to obtain the video stream is lower than a preset value when the acquisition of the video stream is abnormal; if yes, trigger the acquiring sub-unit to execute the initialized video according to the link address. The player obtains the video stream from the media server, and if not, performs error processing.
9、 根据权利要求 8所述的装置, 其特征在于,  9. Apparatus according to claim 8 wherein:
所述创建子单元, 具体用于根据所述链接地址创建视频播放器, 并 分别对播放器界面、 播放引擎、 解码器和缓^ "模块进行初始化。  The creating subunit is specifically configured to create a video player according to the link address, and initialize the player interface, the playing engine, the decoder, and the buffer module respectively.
10、 根据权利要求 8所述的装置, 其特征在于, 所述获取子单元, 具体用于:  The device according to claim 8, wherein the acquiring subunit is specifically configured to:
根据所述链接地址确定所述視频流的传输协议类型;  Determining a transmission protocol type of the video stream according to the link address;
根据所述.传输协议类型配置传输参数, 以便所述媒体服务器根据所 述传输参数分配视频流资源, 以及启动实时流传输协议 RTSP会话; 基于所述视频流资源和 RTSP会话从媒体服务器获取视频流。  Configuring a transmission parameter according to the transmission protocol type, so that the media server allocates a video stream resource according to the transmission parameter, and starts a real-time streaming protocol RTSP session; acquiring a video stream from the media server based on the video stream resource and the RTSP session .
11、 根据权利要求 10所述的装置, 其特征在于, 所述处理单元, 具 体用于:  11. The apparatus according to claim 10, wherein the processing unit is specifically configured to:
判断传输层网絡协议的尝试次数是否低于预设第一阈值;  Determining whether the number of attempts of the transport layer network protocol is lower than a preset first threshold;
若低于第一闹值, 则返回触发获取子单元执行基于所述视频流资源 和 RTSP会话从媒体服务器获取视频流的操作;  If it is lower than the first idle value, returning to the trigger acquisition subunit to perform an operation of acquiring a video stream from the media server based on the video stream resource and the RTSP session;
若不低于第一阈值, 则判断 RTSP会话的尝试次数是否低于预设第 二阈值,若低于第二阈值, 则释放所述.视频流资源, 以及.停止所述 RTSP 会话, 并触发获取子单元执行根据所述传输协议类型配置传输参数的操 作; 若不低于第二阈值, 则进行报错处理。 If not lower than the first threshold, determine whether the number of attempts of the RTSP session is lower than a preset number a second threshold, if the second threshold is lower, releasing the video stream resource, and stopping the RTSP session, and triggering the acquiring subunit to perform an operation of configuring a transmission parameter according to the transport protocol type; If the threshold is two, the error processing is performed.
12、 根据权利要求 11所述的方法, 其特征在于,  12. The method of claim 11 wherein:
所述处理单元, 具体用于在确定判断 KTSP会话的尝试次数不低于 预设第二阈值时, 释放所述.視频流资源, 以及停止所述 RTSP会话, 并 提示播放错误信息。  The processing unit is specifically configured to: when determining that the number of attempts of the KTSP session is not lower than a preset second threshold, release the video stream resource, stop the RTSP session, and prompt to play the error information.
13 , 一种视频流的处理系统, 其特征在于, 包括媒体服务器和权利 要求 7至 12任一项所述的視频流的处理装置;  A processing system for a video stream, comprising: a media server and a processing device for the video stream according to any one of claims 7 to 12;
所述媒体服务器, 用于向视频流的处理装置提供视频流。  The media server is configured to provide a video stream to a processing device of the video stream.
PCT/CN2016/102664 2015-11-18 2016-10-20 Method for processing video stream, device, and system WO2017084467A1 (en)

Applications Claiming Priority (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
CN201510802323.7 2015-11-18

Publications (1)

Publication Number Publication Date
WO2017084467A1 true WO2017084467A1 (en) 2017-05-26

Family

ID=55560786

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/102664 WO2017084467A1 (en) 2015-11-18 2016-10-20 Method for processing video stream, device, and system

Country Status (2)

Country Link
CN (1) CN105451071B (en)
WO (1) WO2017084467A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709518A (en) * 2021-08-24 2021-11-26 天津津航计算技术研究所 RTSP (real time streaming protocol) -based video real-time transmission mode design method
CN114339420A (en) * 2020-10-09 2022-04-12 武汉斗鱼鱼乐网络科技有限公司 Stream pulling method and device, electronic equipment and storage medium
CN115150369A (en) * 2022-06-29 2022-10-04 湖北天融信网络安全技术有限公司 Audio and video proxy method and audio and video proxy container
CN116847113A (en) * 2023-06-20 2023-10-03 联城科技(河北)股份有限公司 Video live broadcast transfer system and method based on cloud architecture module

Families Citing this family (6)

* Cited by examiner, † Cited by third party
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
CN115701710A (en) * 2021-08-02 2023-02-10 北京字节跳动网络技术有限公司 Live content switching and displaying method, device, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110302279A1 (en) * 2007-11-05 2011-12-08 Limelight Networks, Inc. Origin request with peer fulfillment
CN102333083A (en) * 2011-08-24 2012-01-25 中兴通讯股份有限公司 Method and system for transmitting data
CN103259802A (en) * 2013-06-03 2013-08-21 贝壳网际(北京)安全技术有限公司 Media file downloading method and device and client device
CN103716656A (en) * 2013-12-11 2014-04-09 乐视网信息技术(北京)股份有限公司 Video loading method and electronic device
CN104735473A (en) * 2015-03-05 2015-06-24 天脉聚源(北京)科技有限公司 Video stream playing detection method and device
CN105451071A (en) * 2015-11-18 2016-03-30 腾讯科技(深圳)有限公司 Video stream processing method, device and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
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
KR101019634B1 (en) * 2008-09-04 2011-03-07 에스케이 텔레콤주식회사 Media streaming system and method
CN101888377A (en) * 2010-05-26 2010-11-17 中兴通讯股份有限公司 Communication method, media server and communication system
CN102231863B (en) * 2011-06-02 2013-03-27 南京中兴力维软件有限公司 Transmission method of multichannel video streams and system thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110302279A1 (en) * 2007-11-05 2011-12-08 Limelight Networks, Inc. Origin request with peer fulfillment
CN102333083A (en) * 2011-08-24 2012-01-25 中兴通讯股份有限公司 Method and system for transmitting data
CN103259802A (en) * 2013-06-03 2013-08-21 贝壳网际(北京)安全技术有限公司 Media file downloading method and device and client device
CN103716656A (en) * 2013-12-11 2014-04-09 乐视网信息技术(北京)股份有限公司 Video loading method and electronic device
CN104735473A (en) * 2015-03-05 2015-06-24 天脉聚源(北京)科技有限公司 Video stream playing detection method and device
CN105451071A (en) * 2015-11-18 2016-03-30 腾讯科技(深圳)有限公司 Video stream processing method, device and system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114339420A (en) * 2020-10-09 2022-04-12 武汉斗鱼鱼乐网络科技有限公司 Stream pulling method and device, electronic equipment and storage medium
CN114339420B (en) * 2020-10-09 2024-05-17 北京神州数码云科信息技术有限公司 Streaming method and device, electronic equipment and storage medium
CN113709518A (en) * 2021-08-24 2021-11-26 天津津航计算技术研究所 RTSP (real time streaming protocol) -based video real-time transmission mode design method
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
CN116847113A (en) * 2023-06-20 2023-10-03 联城科技(河北)股份有限公司 Video live broadcast transfer system and method based on cloud architecture module
CN116847113B (en) * 2023-06-20 2024-03-12 联城科技(河北)股份有限公司 Video live broadcast transfer method, device, equipment and medium based on cloud architecture module

Also Published As

Publication number Publication date
CN105451071B (en) 2021-05-07
CN105451071A (en) 2016-03-30

Similar Documents

Publication Publication Date Title
WO2017084467A1 (en) Method for processing video stream, device, and system
US10182211B2 (en) Methods and systems to fast fill media players
WO2017107542A1 (en) Video program obtaining method, device and system
CN110557655B (en) Video picture display method and device, electronic equipment and storage medium
EP3142381B1 (en) Network video playing method and device
CN108810657B (en) Method and system for setting video cover
CN104602138A (en) Method and device for supporting HLS protocol by streaming media server
CN111447455A (en) Live video stream playback processing method and device and computing equipment
US20060206561A1 (en) Personal multimedia on-line broadcasting system and method thereof
CN112354177A (en) Webrtc-based cloud game instant starting method, device and system
JP2018514967A (en) Display for partial segments
CN114040232A (en) Screen projection system, method, electronic device and storage medium
CN113973214A (en) Video stream format conversion method, device and storage medium
WO2017101417A1 (en) Method and system for recording live broadcast streaming media
TWI634784B (en) Digital media content playing transfer method and application device thereof
JP2018514108A (en) Display for partial segments
KR20170000312A (en) Method and apparatus for digital broadcast services
WO2017071428A1 (en) Fast forward/rewind processing method and terminal
CN111385660B (en) Video on demand method, device, equipment and storage medium
WO2016197955A1 (en) Multimedia stream multicasting method and device
JP2018514106A (en) Display for partial segments
CN116261021B (en) Video stream playing method and device, electronic equipment and storage medium
JP4544029B2 (en) Portable terminal, streaming communication system, streaming communication method, and streaming communication program
WO2017071642A1 (en) Media playback method, device and computer storage medium
US20150026711A1 (en) Method and apparatus for video content distribution

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16865645

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.10.2018)

122 Ep: pct application non-entry in european phase

Ref document number: 16865645

Country of ref document: EP

Kind code of ref document: A1