CN110536175B - Code rate switching method and device - Google Patents

Code rate switching method and device Download PDF

Info

Publication number
CN110536175B
CN110536175B CN201810509972.1A CN201810509972A CN110536175B CN 110536175 B CN110536175 B CN 110536175B CN 201810509972 A CN201810509972 A CN 201810509972A CN 110536175 B CN110536175 B CN 110536175B
Authority
CN
China
Prior art keywords
video
code rate
downloading
video source
decoder
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810509972.1A
Other languages
Chinese (zh)
Other versions
CN110536175A (en
Inventor
梁亮
向晨宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810509972.1A priority Critical patent/CN110536175B/en
Publication of CN110536175A publication Critical patent/CN110536175A/en
Application granted granted Critical
Publication of CN110536175B publication Critical patent/CN110536175B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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/438Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving encoded video stream packets from an IP 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/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/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/462Content or additional data management, e.g. creating a master electronic program guide from data received from the Internet and a Head-end, controlling the complexity of a video stream by scaling the resolution or bit-rate based on the client capabilities
    • H04N21/4621Controlling the complexity of the content stream or additional data, e.g. lowering the resolution or bit-rate of the video stream for a mobile client with a small screen
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The embodiment of the application discloses a code rate switching method, which comprises the following steps: in the process of downloading video fragments of a video source at a first code rate, uploading a downloading parameter for identifying network downloading quality to a server; acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate; downloading the video fragments of the video source at the second code rate according to the switching information; and if the preset condition is met, switching to the second code rate to play the video fragments of the video source at the second code rate. Therefore, according to the embodiment, the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by the user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, and the situation that the playing video is blocked can be avoided to a certain extent.

Description

Code rate switching method and device
Technical Field
The present application relates to the field of data processing, and in particular, to a method and an apparatus for code rate switching.
Background
With the development of network technology, users can use terminals to surf the internet to watch videos. The video provided by one video source on the network generally has a plurality of code rates, and the videos with different code rates have different degrees of definition. Therefore, when a user watches a video provided by a video source, the user can select the code rate of the watched video according to watching requirements and the like, then, the terminal can download the video fragment corresponding to the selected code rate from the video source, the video fragment under one code rate carries part of video stream data of the video source under the code rate, and the terminal can play the video provided by the video source by sequentially playing the downloaded video fragments.
However, due to the network fluctuation problem of the terminal used by the user, the network speed may be difficult to support the code rate originally selected by the user for a period of time, for example, when the originally selected code rate is higher, the video segment corresponding to the code rate is also larger, and when the network speed is unstable or slow, the playing time provided by downloading the video segment will not be enough to meet the speed of normally playing the video, so that the user may watch the video in a stuck state.
In order to watch the video continuously, the user can only manually switch to a lower code rate, the code rate switching by manual operation brings extra user operation, and the phenomenon of blocking cannot be eliminated immediately after switching, so that poor watching experience of the user is caused.
Disclosure of Invention
In order to solve the technical problem, the application provides a code rate switching method and device, so that a user can watch videos without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
The embodiment of the application discloses the following technical scheme:
a first aspect of the present application provides a code rate switching method, where the method includes:
in the process of downloading video fragments of a video source at a first code rate, uploading a downloading parameter for identifying the network downloading quality to a server;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading the video fragments of the video source at the second code rate according to the switching information;
and if the preset condition is met, switching to the second code rate to play the video fragments of the video source at the second code rate.
A second aspect of the present application provides a code rate switching apparatus, including: the device comprises an uploading module, an obtaining module, a downloading module and a switching module;
the uploading module is used for uploading downloading parameters for identifying the network downloading quality to the server in the process of downloading video fragments of the video source at the first code rate;
the obtaining module is configured to obtain switching information determined by the server according to the download parameter, where the switching information includes an identifier of a second code rate;
the downloading module is used for downloading the video fragments of the video source at the second code rate according to the switching information;
and the switching module is used for switching to the second code rate to play the video fragments of the video source at the second code rate if a preset condition is met.
A third aspect of the present application provides a code rate switching device, where the device includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the code rate switching method of any of the first aspect according to instructions in the program code.
A fourth aspect of the present application provides a video playing method, including:
playing video fragments of a video source at a first code rate when the video playing code rate is the first code rate;
uploading a downloading parameter for identifying network downloading quality to a server in the process of downloading the video source under the first code rate;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading the video fragments of the video source at the second code rate according to the switching information;
and if the preset condition is met, switching the video playing code rate to the second code rate, and playing the video fragments of the video source at the second code rate.
A fifth aspect of the present application provides a video playback apparatus, including: the device comprises a playing module, an uploading module, an obtaining module, a downloading module and a switching module;
the playing module is used for playing the video fragments of the video source at a first code rate when the video playing code rate is the first code rate;
the uploading module is used for uploading downloading parameters for identifying the network downloading quality to a server in the process of downloading the video source under the first code rate;
the obtaining module is configured to obtain switching information determined by the server according to the download parameter, where the switching information includes an identifier of a second code rate;
the downloading module is used for downloading the video fragments of the video source at the second code rate according to the switching information;
and the switching module is used for switching the video playing code rate to the second code rate and playing the video fragments of the video source at the second code rate if a preset condition is met.
A sixth aspect of the present application provides a video playback device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the code rate switching method of any of the fourth aspect according to instructions in the program code.
A seventh aspect of the present application provides a code rate switching method, where the method includes:
acquiring a downloading parameter uploaded by a terminal, wherein the downloading parameter is used for identifying the network downloading quality of video fragments of a video source downloaded by the terminal at a first code rate;
determining a second code rate corresponding to the network downloading quality according to the downloading parameters;
and sending switching information carrying the identifier of the second code rate to the terminal to indicate the terminal to download the video fragments of the video source at the second code rate.
An eighth aspect of the present application provides a code rate switching apparatus, the apparatus comprising: the device comprises an acquisition module, a determination module and a sending module;
the acquisition module is used for acquiring downloading parameters uploaded by a terminal, and the downloading parameters are used for identifying the network downloading quality of video fragmentation of a video source downloaded by the terminal under a first code rate;
the determining module is used for determining a second code rate corresponding to the network downloading quality according to the downloading parameters;
and the sending module is used for sending the switching information carrying the identifier of the second code rate to the terminal so as to instruct the terminal to download the video fragments of the video source at the second code rate.
A ninth aspect of the present application provides a code rate switching device, comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the code rate switching method of the seventh aspect according to instructions in the program code.
The tenth aspect of the present application provides a code rate switching system, where the system includes a terminal and a server;
the terminal is used for uploading downloading parameters for identifying the network downloading quality to the server in the process of downloading video fragments of a video source at a first code rate; acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate; downloading the video fragments of the video source at the second code rate according to the switching information; if the preset condition is met, switching to the second code rate to play the video fragments of the video source at the second code rate;
the server is used for acquiring the downloading parameters uploaded by the terminal; determining the second code rate corresponding to the network downloading quality according to the downloading parameters; and sending the switching information to the terminal to instruct the terminal to download the video fragments of the video source at the second code rate.
An eleventh aspect of the present application provides a computer-readable storage medium for storing program code for executing the bitrate switching method of any one of the first aspect, the video playing method of the fourth aspect, or the bitrate switching method of the seventh aspect.
According to the technical scheme, the video fragments of the video source at the first code rate are downloaded, so that the downloading parameters can be uploaded to the server in the process of playing the video fragments at the first code rate, and the network downloading quality of the video fragments at the first code rate can be identified by the downloading parameters, so that the switching information acquired from the server can indicate the code rate suitable for the downloading parameters or the network downloading quality, such as the second code rate. And downloading the video fragments of the video source at the second code rate according to the switching information, and switching to the second code rate to play the video fragments of the video source at the second code rate when a preset condition is met. Therefore, the video fragments under the corresponding code rates can be flexibly downloaded through the switching information capable of indicating the current network downloading quality, and the code rate of the currently played video is automatically switched when the conditions are met. The method and the device have the advantages that the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by a user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, the situation that the played video is blocked can be avoided to a certain extent, the user can watch the video without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the description below are only some embodiments of the present application, and for those skilled in the art, other drawings may be obtained according to these drawings without inventive labor.
Fig. 1 is a schematic diagram of an architecture of a code rate switching system according to an embodiment of the present application;
fig. 2a is a signaling flowchart of a code rate switching method according to an embodiment of the present application;
FIG. 2b is a diagram illustrating a media index file according to an embodiment of the present application;
fig. 2c is a signaling flowchart of a video playing method according to an embodiment of the present application;
fig. 3 is a signaling flowchart of a code rate switching method according to an embodiment of the present application;
fig. 4a is a schematic structural diagram of a code rate switching apparatus according to an embodiment of the present application;
fig. 4b is a schematic structural diagram of a video playing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a code rate switching apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a code rate switching device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a code rate switching system according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In a conventional code rate switching method, when a user watches a video provided by a video source, a code rate of the watched video can be selected according to watching requirements and the like, then, a terminal can download a video fragment corresponding to the selected code rate from the video source, the video fragment at one code rate carries part of video stream data of the video source at the code rate, and the terminal can play the video provided by the video source by sequentially playing the downloaded video fragments. The code rate refers to the number of bits (bits) transmitted or processed in a unit time, and may be, for example, 1000 bits/s or 1000 kbits/s.
It should be noted that the definition degrees of the video slices of the same video source at different code rates are different, for example, the resolution of the video slices of the video source at different code rates are different. Specifically, if the bitrate is higher, the definition degree (for example, resolution) of the video slice of the video source at the bitrate is higher, whereas if the bitrate is lower, the definition degree (for example, resolution) of the video slice of the video source at the bitrate is lower; for example, the video source may have a video slice resolution of 1280p × 720p at a high bitrate, and a video slice resolution of 1920p × 1080p at a low bitrate.
However, in the conventional code rate switching method, due to the network fluctuation problem of the terminal used by the user, the network speed may be difficult to support the code rate originally selected by the user for a period of time, for example, when the originally selected code rate is higher, the video segment corresponding to the code rate is also larger, and when the network speed is unstable or slow, the time consumed for downloading the video segment will be longer than the playing time that can be provided by the video segment, that is, the playing time provided for downloading the video segment will not be enough to satisfy the speed of normally playing the video, so that the user may watch the video in a stuck state. In order to watch the video continuously, the user can only manually switch to the lower code rate, and the manual operation of switching the code rate brings extra user operation. In addition, in the conventional code rate switching method, after the user manually switches the code rate, the video fragments of the video source at the switched code rate are downloaded, so that the user needs to wait for a period of time to continue watching the video after manually switching the code rate, that is, after manually switching the code rate, the user does not know that the video is blocked immediately, and thus the user watching experience is not good.
Therefore, the embodiment of the application provides a code rate switching method, so that video fragments with different code rates can be flexibly downloaded, and the code rate of the currently played video is automatically switched when the conditions are met. The method and the device have the advantages that the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by a user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, the situation that the played video is blocked can be avoided to a certain extent, the user can watch the video without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
As an example, fig. 1 shows a schematic structural diagram of a rate switching system provided in this embodiment, and the rate switching method provided in this embodiment may be applied to the rate switching system shown in fig. 1, where the rate switching system may include a terminal 101 and a server 102. The terminal 101 may be a device having a communication function and a video playing function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like; the terminal 101 is not limited in the embodiment of the present application.
It is understood that the bitrate switching system shown in fig. 1 can be applied to a video playing scene, for example, the video playing scene can be a video (such as a movie or a recorded television program) which is provided by a user through a terminal 101 and has a fixed playing time length, or the video playing scene can be a video (such as a live video) which is provided by a user through a terminal 101 and has a non-fixed playing time length and is provided by a network address.
In this scenario, during the process of downloading video slices of a video source at a first bitrate by the terminal 101, the download parameters may be uploaded to the server 102. The downloading parameter may be a parameter for identifying a network downloading quality for downloading the video slice at the first bitrate, for example, the downloading parameter may include a downloading time of the video slice, a bitrate corresponding to the video slice, a buffering time, and the like. The video source can be understood as video stream data with different bit rates, and the source of the video source can be a network address, for example, the video source can be network-originated network streaming media which provides network streaming media with different bit rates. The video fragment may be partial video stream data that is continuous from the video source at a code rate, for example, the playing time corresponding to the video source is 1 minute, and the partial video stream data of 30 th to 40 th seconds in the playing time of the video source may be used as the video fragment. The first code rate may be a code rate set by the terminal 101 for a video source in advance before downloading the video source, or may be a code rate set by a user for the video source.
In this embodiment, a video source may include a plurality of video slices at different bitrate, and each video slice may include a plurality of video frames. The video frame in the video fragment corresponds to a playing time in the playing time of the video source, and it can be understood that the playing time of the video fragment in the video source can be understood from the playing time in the playing time of the video source corresponding to the video frame with the first playing sequence in the video fragment to the playing time in the playing time of the video source corresponding to the video frame with the last playing sequence in the video fragment.
The number of video slices of a video source at different code rates is the same, for example, a video source at code rate a and code rate B may include 8 video slices. Also, the video slice may have an identifier corresponding thereto, and the identifier of the video slice may be used to determine a playing order of the video slice when playing the video source, for example, assuming that an order of playing the video slice of the video source at the first bitrate is: the video fragment A is played first, and then the video fragment B is played, so that the playing sequence of the video fragment A can be determined to be the first according to the identifier of the video fragment A, and the video fragment B can be determined to be the next video fragment of the video fragment A in the playing sequence according to the identifier of the fragment B.
It should be noted that, in video segments of a video source at different code rates, the playing time of each of a plurality of video segments corresponding to the same identifier in the video source is the same; for example, assuming that the video slice a is a video slice of the video source at the bitrate a, and the playing time of the video slice a in the video source is from 1 st 30 seconds to 1 st 39 seconds in the playing time of the entire video source, since the video slice B is a video slice of the video source at the bitrate B, and the identifier of the video slice B is the same as the identifier of the video slice a, it may be determined that the playing time of the video slice B in the video source is also from 1 st 30 seconds to 1 st 39 seconds in the playing time of the entire video source.
After the server 102 obtains the download parameter uploaded by the terminal 101, a second code rate corresponding to the download parameter may be determined according to the download parameter; wherein the second bitrate can be understood as a bitrate suitable for the network download quality identified by the download parameter. Then, the server 102 may send the handover information carrying the second code rate to the terminal 101. Since the download parameter may identify the network download quality for downloading the video segments at the first bitrate, the switching information sent by the server 102 may indicate a bitrate, e.g., the second bitrate, suitable for the download parameter or the network download quality. It should be emphasized that, in this embodiment, the first code rate may be higher than the second code rate, or may be lower than the second code rate, and in this embodiment, no limitation is made on the high-low relationship between the first code rate and the second code rate.
It should be noted that the code rate determined by the server 102 according to the download parameter may be the same as the code rate currently played by the terminal, and in the case that the code rate is the same, the server 102 may not send the handover information to the terminal 101 in the case that the code rate is the same because there is no need for handover. Alternatively, the server 102 may also send the switching information to the terminal 101, and since the code rate identifier included in the switching information is the same as the identifier of the code rate currently being downloaded and played by the terminal 101, the terminal 101 may not perform subsequent processing on the switching information.
After the terminal 101 obtains the switching information sent by the server 102, the terminal 101 may download the video clips of the video source at the second code rate according to the switching information. If the preset condition is satisfied, the terminal 101 may switch to the second bitrate to play the video slices of the video source at the second bitrate.
In this way, it is possible to realize that the terminal 101 can flexibly download the video segments at the code rate adapted to the current network download quality through the switching information capable of indicating the current network download quality, and automatically switch the code rate of the currently played video when the conditions are met. When the network downloading quality is not good, the terminal 101 can automatically start downloading the video fragments with low code rate and automatically switch from the high code rate originally selected by the user to the low code rate, or when the terminal 101 switches from an internet environment with poor network downloading quality (for example, internet surfing using 3G mobile communication technology) to an internet environment with good network downloading quality (for example, internet surfing using Wireless-Fidelity (Wi-Fi)), the terminal 101 can automatically start downloading the video fragments with high code rate and switch from the low code rate preset originally to the high code rate; therefore, in the process of switching the code rate of the terminal 101, not only is manual switching by a user not needed, but also the video fragments at the low code rate (or the high code rate) are downloaded before switching, and the situation that the playing video is blocked can be avoided to a certain extent, so that the user can watch the video without being aware of the influence caused by network fluctuation, and the watching experience of the user is improved.
Next, as illustrated in fig. 1, it is assumed that a user is requesting a series of dramas having a play duration of 40min through the terminal 101, and the bitrate set by the user for a video source providing the series is a first bitrate, where the definition of the series is high definition (with a resolution of 1920p × 1080p). During the process of downloading the video source to the video slice at the first code rate, the terminal 101 may upload the download parameters of the download quality to the server 102. Then, the server 102 may determine, according to the download parameter, a code rate corresponding to the download parameter, specifically, because the network download quality identified by the download parameter is poor, may determine that the code rate corresponding to the download parameter is a second code rate lower than the first code rate, and may send handover information carrying the second code rate to the terminal 101. Next, the terminal 101 may download video clips of the video source at a second code rate according to the switching information, wherein the definition of the tv play at the second code rate is standard definition (with a resolution of 1280p 720 p). When the conditions are met, the terminal 101 can automatically switch the code rate for playing the series from the first code rate to the second code rate, so that the terminal 101 can play the video fragments of the video source at the second code rate, and therefore, in the process of switching the code rates by the terminal 101, not only is manual switching by a user not needed, but also the video fragments at the second code rate are downloaded before switching, the situation that the series is blocked when played can be avoided to a certain extent, and the user can watch the series without being aware of the influence caused by network fluctuation.
It is to be understood that, in the application scenario described above, although the actions of the embodiment of the present application are described as being performed partially by the terminal 101 and partially by the server 102, the actions may also be performed completely by the terminal 101. The present application is not limited in terms of the execution subject as long as the actions disclosed in the embodiments of the present application are executed.
It should be noted that the above application scenarios are only shown for the convenience of understanding the present application, and the embodiments of the present application are not limited in any way in this respect. Rather, embodiments of the present application may be applied to any scenario where applicable.
Various non-limiting embodiments of the present application are described in detail below with reference to the accompanying drawings.
Next, the code rate switching method provided by the present application will be introduced from the perspective of interaction between the terminal side and the server side. Referring to fig. 2a, a signaling flowchart of a code rate switching method provided in the embodiment of the present application is shown. As shown in fig. 2a, the following steps may be included:
s201: and in the process of downloading the video source by the terminal under the first code rate, uploading a downloading parameter for identifying the network downloading quality to the server.
In this embodiment, the terminal may first determine that the bitrate of the video source that needs to be downloaded is the first bitrate. The first code rate may be an initial code rate for playing the video or a default code rate of the player, and the first code rate may also be a code rate adjusted by the user during the playing process. The terminal may then begin downloading video slices of the video source at the first bitrate. In order to ensure that the code rate of the currently downloaded video source is suitable for the current network download quality, specifically, in the process of downloading the video fragment by the terminal, the terminal may obtain a download parameter for identifying the network download quality, and may upload the download parameter to the server, so that the server may determine the current network download quality according to the download parameter.
For example, assuming that a terminal used by a user is a smart phone, when the user wants to request a game video through a penguin electronic contest mobile Application (APP) in the smart phone, a code rate at which the user selects to play the game video is 1000kbit/s; then, the smart phone may determine a video source providing the video game, and the bitrate of the video source is a first bitrate; then, the smart phone can download the video fragments of the video source at the first code rate of 1000kbit/s, and in the process of downloading the video fragments at the first code rate, the smart phone can obtain corresponding downloading parameters and upload the downloading parameters to the server.
It should be noted that the embodiments of the present application provide various manners for the terminal to upload the download parameters to the server in the process of downloading the video fragment, for example, the terminal may execute downloading of one video fragment and upload the download parameters to the server, or the terminal may upload the download parameters to the server after downloading of one video fragment. The following will be specifically described for the two modes:
the first mode is as follows: the terminal executes downloading of a video fragment and uploading of the downloading parameters to the server.
In the method, the terminal can upload the downloading parameters for identifying the network downloading quality of the downloaded video fragments to the server according to a preset mode in the process of downloading the video fragments of the video source at the first code rate; for example, the terminal may upload the download parameters to the server periodically, for example, the terminal may upload the download parameters to the server every 1 s.
For example, when the downloading progress of a video segment reaches 50%, the terminal may obtain a downloading parameter for identifying the network downloading quality for downloading the video segment, and upload the downloading parameter to the server in the process of continuing downloading the video segment.
It should be noted that, in this embodiment, the download parameters that are uploaded to the server by the terminal each time may be the download parameters that are obtained by the terminal from the last time of uploading the download parameters to the current time of uploading the download parameters. For example, the download parameters uploaded to the server by the terminal for the ith time may be the download parameters acquired by the terminal from the terminal for the ith-1 time to the ith time of uploading and downloading the parameters.
The second mode is as follows: and after the terminal finishes downloading one video fragment, uploading the downloading parameters to the server.
In this manner, after downloading a video fragment of a video source at a first code rate, the terminal may obtain a download parameter for identifying a network download quality for downloading the video fragment, and upload the download parameter to the server.
For example, after the downloading progress of one video segment reaches 100% (i.e., the video segment is downloaded), the terminal may acquire the downloading parameters in the whole process of downloading the video segment, and may upload the downloading parameters to the server.
It should be noted that, in this embodiment, the download parameter uploaded to the server by the terminal each time may be a download parameter acquired by the terminal in the whole process of downloading one video fragment of the video source at the first code rate. For example, after the terminal finishes downloading the video fragment a of the video source at the first code rate, the download parameter uploaded to the server may be a download parameter acquired by the terminal in the whole process of downloading the video fragment a; after the terminal finishes downloading the video fragment B of the video source at the first code rate, the download parameter uploaded to the server may be a download parameter obtained by the terminal in the whole process of downloading the video fragment B.
Therefore, the method can ensure that the obtained downloading parameters can reflect the average value of each parameter in the whole process of downloading the video clip, but not only the parameter values at a certain moment, so that the obtained downloading parameters can more accurately reflect the network downloading quality of the video clip.
S202: and the server determines a second code rate corresponding to the network downloading quality according to the downloading parameters, and sends switching information carrying an identifier of the second code rate to the terminal so as to instruct the terminal to download the video fragments of the video source at the second code rate.
After the terminal uploads the download parameter for identifying the network download quality to the server, the server may determine, according to the download parameter, a code rate corresponding to the network download quality identified by the download parameter. If the code rate determined by the server is a second code rate different from the first code rate, the server may send, to the terminal, the switching information carrying the identifier of the second code rate, so as to instruct the terminal to perform a subsequent action through the switching information.
In an implementation manner of this embodiment, the server may store a corresponding relationship between the network download quality and the code rate in advance. After the server receives the download parameters uploaded by the terminal, the server may determine the network download quality corresponding to the download parameters, and determine the code rate corresponding to the network download quality according to the pre-stored correspondence between the network download quality and the code rate. If the code rate determined by the server is a second code rate different from the first code rate, the server may generate, according to the second code rate, switching information carrying an identifier of the second code rate, and send the switching information to the terminal, so as to instruct the terminal to perform a subsequent action through the switching information.
For example, it is assumed that the downloaded video segment is a video segment of a video source at a first bitrate of 1000bit/s, and the download parameters uploaded by the server and received by the terminal include that the size of the video segment not downloaded is 500Mb, the current download time of the video segment is 5s, and the receiving speed is 1 kbps. Because the server can determine that the network downloading quality identified by the downloading parameter is better than the network downloading quality corresponding to the first code rate 1000bit/s according to the downloading parameter, the server can determine that the code rate corresponding to the downloading quality identified by the downloading parameter is the second code rate 2000bit/s, and the second code rate 2000bit/s is higher than the first code rate 1000bit/s. Therefore, the server may generate the handover information carrying the identifier of the second code rate of 2000 bits/s, and may send the handover information to the terminal.
S203: and the terminal downloads the video fragments of the video source at the second code rate according to the switching information.
After the terminal acquires the switching information determined by the server according to the downloading parameters, if the second code rate indicated by the switching information is different from the first code rate, it is indicated that the first code rate is not suitable for the current downloading parameters (or not suitable for the network downloading quality identified by the current downloading parameters), and the second code rate carried by the switching information is more suitable for the current downloading parameters (or more suitable for the network downloading quality identified by the current downloading parameters). Therefore, the terminal can determine that the video clips to be downloaded are the video clips of the video source at the second code rate according to the switching information. The terminal may then download the video clips of the video source at the second code rate.
For example, assume that a terminal used by a user is a smart phone, and the smart phone is downloading video clips of a video source corresponding to a game video at a first bitrate of 1000kbit/s. In the process that the smart phone downloads the video fragments of the video source at the first code rate of 1000kbit/s, if the switching information carrying the second code rate of 2000kbit/s and sent by the server is obtained, the smart phone can firstly determine the second code rate of 2000kbit/s in the switching information, and then start downloading the video fragments of the video source at the second code rate of 2000kbit/s.
It should be noted that after the video clips of the video source at a code rate are downloaded, the video clips need to be decoded by a specific decoder, and it is understood that the specific decoder may be a decoder restarted according to the decoder parameters of the video source at the code rate. The decoder parameters are stored in the video slices, and the decoder parameters in the video slices can embody the characteristics of the video source providing the video slices, such as the video slice at which bitrate the video source is, and the compression mode corresponding to the video slice. Therefore, after the video fragments of the video source at a code rate are downloaded, the decoder parameters of the video source at the code rate can be determined according to the downloaded video fragments, and the decoder is restarted according to the decoder parameters, so that the video fragments can be decoded by the restarted decoder, and the decoded video fragments can be played.
Since the decoder parameters of a video source at a code rate are usually stored in the key frames of the video slices of the video source at the code rate, and the key frames of the video slices are usually the video frames in the video slices in the earlier playing order, for example, the key frames of a video slice may be the video frames in the first playing order in the video slice. Therefore, in order to ensure that the video fragment can be played after the video fragment of the video source at the second code rate is downloaded, in this embodiment, in the process of downloading the video fragment of the video source at the second code rate, the downloaded video fragment is a complete video fragment, but not an incomplete video fragment.
It should be emphasized that the embodiments of the present application provide various ways of downloading video slices of a video source at a second code rate according to switching information, and in particular, the various ways will be described in detail later.
S204: and if the preset condition is met, the terminal is switched to the second code rate to play the video fragments of the video source at the second code rate.
It can be understood that, after downloading the video clips of the video source at the second code rate according to the switching information, the terminal immediately switches to the second code rate to play the video clips of the video source at the second code rate; it may happen that a video slice of the video source at the second code rate is not downloaded, so that the decoder parameter in the video slice cannot be obtained, the decoder cannot be restarted according to the decoder parameter, and the video slice of the video source at the second code rate cannot be decoded, that is, the video slice cannot be played; or, it is possible that the video segment of the video source at the first code rate is not played completely, which affects the normal playing of the video segment.
Therefore, in this embodiment, after the terminal downloads the video fragment of the video source at the second code rate according to the switching information, it may be determined whether the terminal meets the preset condition first, and if the terminal meets the preset condition, for example, the downloaded video source is completely played at the first code rate, or a video fragment of the video source at the second code rate is completely downloaded; then, the terminal may switch from the first bitrate to the second bitrate, so that the video clips of the downloaded video source at the second bitrate can be played.
For example, assume that a terminal used by a user is a smart phone, and the smart phone has downloaded a video fragment a of a video source corresponding to a game video at a first bitrate of 1000kbit/s and a video fragment B of the video source corresponding to the game video at a second bitrate of 2000kbit/s, where the video fragment B is a next video fragment of the video fragment a in a playing sequence. When the smart phone finishes playing the video fragment A, the smart phone can be switched to the second code rate of 2000kbit/s to play the video fragment B, wherein the preset condition is considered to be met.
It should be noted that, since the video slices need to be decoded by the decoder, the video slices can be played, and the video slices of the video source at different code rates need to be decoded by the decoder after being restarted according to different decoder parameters; for example, a video slice of a video source at a first code rate needs to be decoded by a decoder restarted according to a decoder parameter corresponding to the first code rate, and a video slice of the video source at a second code rate needs to be decoded by a decoder restarted according to a decoder parameter corresponding to the second code rate.
Therefore, in an implementation manner of the embodiment of the application, if the preset condition is met, the terminal may switch to the second code rate to play video clips of the video source at the second code rate through the decoder restarted according to the decoder parameter corresponding to the second code rate. Specifically, S204 may include the steps of:
step 11: and after the terminal acquires the decoder parameters of the video source at the second code rate by downloading the video fragments of the video source at the second code rate, if the preset conditions are met, restarting the decoder according to the decoder parameters.
In this way, after the terminal downloads the video slices of the video source at the second code rate according to the switching information, since the downloaded video slices of the video source at the second code rate are all complete video slices, the video slices all include key frames, and the key frames carry decoder parameters of the video source at the second code rate. Therefore, when the preset condition is met, the terminal can obtain the decoder parameter of the video source at the second code rate according to the video slicing of the downloaded video source at the second code rate, and restart the decoder according to the decoder parameter. It should be noted that, in an implementation manner, after all the downloaded video sources are decoded in video slices at the first code rate by the decoder, the decoder may be restarted according to the decoder parameters of the video sources at the second code rate.
Step 12: and the terminal is switched to the second code rate to play the video fragments of the video source at the second code rate.
After restarting the decoder according to the decoder parameters of the video source at the second code rate, the restarted decoder has the capability of decoding the video slices of the video source at the second code rate. Therefore, the decoder in the terminal can be switched to the second code rate, and the decoder switched to the second code rate can be used for decoding the video fragments of the video source at the second code rate, so that the video fragments of the video source at the second code rate can be played.
For example, suppose a terminal used by a user is a smart phone, the smart phone has downloaded a video fragment a of a video source corresponding to a game video at a first code rate of 1000kbit/s and a video fragment B of the video source corresponding to the game video at a second code rate of 2000kbit/s, where the video fragment B is a next video fragment of the video fragment a in a playing sequence; and the video frame with the first playing sequence in the video slice B is a key frame carrying the decoder parameter of the video source at the second code rate. When the smart phone finishes playing the video fragment a, the preset condition can be considered to be met, the smart phone can firstly obtain a decoder parameter of the video source at the second code rate according to the video fragment B, and restart the decoder according to the decoder parameter. The smartphone may then decode video slice B using the restarted decoder so that video slice B may be played.
It should be noted that, in this embodiment, before restarting the decoder according to the decoder parameter of the video source at the second code rate, the terminal may reset the internal state of the demultiplexing module according to the switching information after receiving the switching information carrying the Identifier of the second code rate, for example, the demultiplexing module may first demultiplex a Program Association Table (PAT) in a Transport Stream (TS), then search for a Packet Identifier (PID) of an audio and a video through a Program Map Table (PMT), then acquire the video source parameter at the second code rate, and finally transmit the decoder parameter to the decoder, so that the decoder can be restarted according to the decoder parameter.
According to the technical scheme, the video fragments of the video source at the first code rate are downloaded, so that the download parameters can be uploaded to the server in the process of playing the video fragments at the first code rate, and the network download quality of the video fragments at the first code rate can be identified by the download parameters, so that the code rate suitable for the download parameters or the network download quality, such as the second code rate, can be indicated by the switching information acquired from the server. And downloading the video fragments of the video source at the second code rate according to the switching information, and switching to the second code rate to play the video fragments of the video source at the second code rate when a preset condition is met. Therefore, the video fragments under the corresponding code rates can be flexibly downloaded through the switching information capable of indicating the current network downloading quality, and the code rate of the currently played video is automatically switched when the conditions are met. When the network downloading quality is not good, the terminal can automatically start downloading the video fragments under the low code rate and automatically switch from the high code rate originally selected by the user to the low code rate, or when the terminal switches from the internet surfing environment with poor network downloading quality to the internet surfing environment with good network downloading quality, the terminal can automatically start downloading the video fragments under the high code rate and switch from the originally preset low code rate to the high code rate; therefore, in the process of switching the code rate of the terminal, the user does not need to manually switch, and the video fragments under the low code rate (or the high code rate) are downloaded before switching, so that the situation that the playing video is blocked can be avoided to a certain extent, the user can watch the video without being aware of the influence caused by network fluctuation, and the watching experience of the user is improved.
The foregoing embodiments provide various manners for downloading video clips of a video source at a second bitrate according to switching information (i.e., various implementations of S203 are provided), for example, after a complete video clip of the video source at a first bitrate is downloaded, the video clip of the video source at the second bitrate is started to be downloaded, or when the switching information is acquired, the video clip of the video source at the second bitrate is started to be downloaded. Next, description will be made regarding these two ways.
The first mode is as follows: and after the terminal finishes downloading a complete video fragment of the video source at the first code rate, downloading the video fragment of the video source at the second code rate.
In the method, if the terminal acquires the switching information, the first video fragment of the video source at the first code rate is being downloaded; then, the terminal may determine the identifier of the second video segment according to the identifier of the first video segment, where the second video segment may be a next video segment of the first video segment in the playing order. Then, after the terminal finishes downloading the first video fragment of the video source at the first code rate, the terminal may start downloading the video fragment of the video source at the second code rate from the second video fragment according to the switching information and the identifier of the second video fragment.
For example, suppose that a terminal used by a user is a smart phone, if the smart phone obtains switching information carrying a second code rate of 2000kbit/s, and the smart phone is downloading a complete first video fragment of a video source corresponding to a game video at a first code rate of 1000kbit/s, wherein the playing time of the first video fragment in the game video is from 1 st 30 seconds to 1 st 39 seconds in the playing time of the whole game video. Then, the smart phone may first determine the second code rate of 2000kbit/s in the handover information. Then, the smartphone may determine the identifier of the second video segment according to the identifier of the first video segment, that is, may determine that the playing time of the second video segment in the game video is from 1 st 40 seconds to 1 st 49 seconds in the playing time of the entire game video. Then, after the smart phone finishes downloading the complete first video fragment, the smart phone can start to download the video fragment of the video source at the second code rate of 2000kbit/s from the second video fragment according to the switching information and the identifier of the second video fragment.
The second mode is as follows: and when the terminal acquires the switching information, starting to download the video fragments of the video source at the second code rate.
In the method, if the terminal acquires the switching information, the first video fragment of the video source at the first code rate is being downloaded; then, the terminal may start downloading the video segments of the video source at the second code rate from the first video segment according to the switching information and the identifier of the first video segment.
As a possible implementation manner, in a process of downloading a first video fragment of a video source at a first code rate by a terminal, when the terminal acquires switching information carrying a second code rate, the terminal may first stop downloading the first video fragment of the video source at the first code rate. Then, the terminal may start downloading the video segments of the video source at the second code rate from the first video segment according to the second code rate and the identifier of the first video segment.
For example, assuming that a terminal used by a user is a smart phone, when the smart phone is downloading a first video fragment of a video source corresponding to a game video at a first bitrate of 1000kbit/s and the downloading progress of the first video fragment reaches 50%, if the smart phone obtains switching information carrying a second bitrate of 2000kbit/s, the smart phone may first stop downloading the first video fragment of the video source at the first bitrate of 1000kbit/s. Then, the smart phone can download the video fragments of the video source at the second code rate from the first video fragment according to the second code rate of 2000kbit/s and the identifier of the first video fragment.
Therefore, in the present mode, in the process of downloading the first video fragment of the video source at the first code rate by the terminal, when the terminal acquires the switching information carrying the second code rate, the terminal can start to download the video fragment of the video source at the second code rate from the first video fragment without waiting for the completion of downloading the complete first video fragment of the video source at the first code rate, so that the time of waiting for downloading the video fragment of the video source at the second code rate is shortened, and the efficiency of downloading the video fragment of the video source at the second code rate is improved.
It should be noted that, in the foregoing embodiment, various manners for downloading the video segments of the video source at the second code rate by the terminal according to the switching information are provided, and each manner may acquire different first video segments, for example, acquire a complete first video segment, a partial first video segment, and the like. Correspondingly, on the basis of the embodiment corresponding to fig. 2a, for acquiring different first video segments, the embodiment of the present application provides various implementation manners that the terminal switches to the second code rate to play the video segments of the video source at the second code rate if the preset condition is met, that is, S204 may have various implementation manners. Two implementations of which will be described below.
The first mode is as follows: and after the terminal plays the complete video fragments of the video source at the first code rate, switching to the second code rate to play the video fragments of the video source at the second code rate.
Specifically, after the terminal finishes downloading the complete first video fragment of the video source at the first code rate, the terminal starts to download the video fragment of the video source at the second code rate from the second video fragment. Then, after the terminal finishes playing the complete first video segment, the terminal may switch to the second bitrate, and may start playing the video segment of the video source at the second bitrate from the second video segment.
For example, assume that a terminal used by a user is a smart phone, and after the smart phone finishes downloading a complete first video fragment of a video source corresponding to a game video at a first bitrate of 1000kbit/s, the smart phone starts downloading a video fragment of the video source at a second bitrate of 2000kbit/s from a second video fragment, where the playing time of the first video fragment in the game video is from 1 st 30 seconds to 1 st 39 seconds in the playing time of the game video, and the playing time of the second video fragment in the game video is from 1 st 40 seconds to 1 st 49 seconds in the playing time of the game video. When the smart phone plays the game video to the end of the 1 st minute 39 seconds in the whole game video playing time, the smart phone can be considered to have played the complete first video fragment, and then the smart phone can start to switch to the second code rate of 2000kbit/s from the 1 st minute 40 seconds in the whole game video playing time, so that the second video fragment of the video source at the second code rate of 2000kbit/s can be played from the second video fragment.
The second mode is as follows: after the terminal plays the part of video fragments of the video source at the first code rate, the terminal is switched to the second code rate from the maximum time corresponding to the part of video fragments so as to play the video fragments of the video source at the second code rate from the maximum time.
Specifically, after the terminal finishes downloading a part of first video fragments of the video source at the first code rate, the terminal starts to download the video fragments of the video source at the second code rate from the first video fragments. Then, the terminal may determine the maximum playing time of the downloaded video source at the first bitrate of the partial first video segment; the maximum playing time of a part of the first video segments of the video source at the first code rate may be understood as the playing time corresponding to the video frame of which the playing sequence is the last in the part of the first video segments. Then, when the terminal plays the part of the first video fragment of the video source at the first code rate and reaches the maximum playing time, the terminal can switch to the second code rate and start to play the first video fragment of the video source at the second code rate from the maximum playing time; for example, a video frame corresponding to the maximum playing time may be determined in a first video segment of the video source at the second code rate, and then the first video segment of the video source at the second code rate may be played from a next video frame of the video frame in the playing order.
For example, assume that a terminal used by a user is a smart phone, and after the smart phone downloads a part of first video fragments of a video source corresponding to a game video at a first bitrate of 1000kbit/s, the smart phone downloads video fragments of the video source at a second bitrate of 2000kbit/s from the first video fragments, where the playing time of the first video fragments in the game video is from 1 st 30 s to 1 st 39 s in the playing time of the game video, the playing time of the part of first video fragments in the game video is from 1 st 30 s to 1 st 35 s in the playing time of the game video, and the maximum playing time of the part of first video fragments is from 1 st 35 s in the playing time of the game video. When the smart phone plays the game video until the 1 st minute 35 seconds in the whole game video playing time is over, the smart phone can be considered to have played the part of the first video fragment, and then the smart phone can start to switch to the second code rate of 2000kbit/s from the 1 st minute 36 seconds in the whole game video playing time and start to play the first video fragment of the video source at the second code rate from the 1 st minute 36 seconds in the whole game video playing time.
Therefore, in this mode, in the process of playing a part of the first video fragments of the video source at the first code rate by the terminal, when the terminal plays the part of the first video fragments and reaches the maximum playing time of the part of the first video fragments, the terminal can be switched to the second code rate, and the first video fragments of the video source at the second code rate are played from the maximum playing time without waiting for the playing of the complete first video fragments of the video source at the first code rate and then switched to the second code rate, so that the time consumed by the terminal for switching the code rates is shortened, and the speed of switching the code rates by the terminal is increased.
In the conventional method, a terminal can acquire a download position of a video fragment at a code rate only when the video fragment of a video source at the code rate needs to be downloaded. Therefore, in the process of switching from the first code rate to the second code rate, the terminal can start to acquire the download position of the video fragment at the second code rate only when acquiring the request of switching to the second code rate, so that in the process of switching the code rate, the terminal needs to spend time to acquire the download position of the video fragment at the second code rate, the time of switching the code rate is increased, and the speed of switching the code rate is reduced.
Therefore, in an implementation manner of the embodiment of the present application, on the basis of the embodiment corresponding to fig. 2a, before S201, the method may further include the following steps: and the terminal acquires the media index files of the video source at different code rates.
Specifically, before downloading a video fragment of a video source at a first code rate, a terminal may first obtain media index files of the video source at different code rates, where a media index file at one code rate may be used to identify a download position of a video fragment at the code rate. For example, as shown in fig. 2b, the video source provides video slices at three code rates, which are the first code rate, the second code rate and the third code rate, respectively, and the video slices at different code rates may be transport stream (ts) slices. Before downloading the video fragment of the video source at the first code rate, the terminal may acquire a media index file set corresponding to the video source, where the media index file set may include three media index files of the video source at three different code rates, and the three media index files may be a media index file of the video source at the first code rate, a media index file of the video source at the second code rate, and a media index file of the video source at the third code rate, respectively; specifically, the media index file at the first bitrate may be used to identify a download position of the ts fragment a at the first bitrate, the media index file at the second bitrate may be used to identify a download position of the ts fragment B at the second bitrate, and the media index file at the third bitrate may be used to identify a download position of the ts fragment C at the third bitrate.
Before downloading the video fragment of the video source at the first code rate, the terminal already acquires the media index files of the video source at different code rates. Therefore, when the terminal needs to download the video fragments of the video source at the first code rate, the terminal can determine the media index file corresponding to the first code rate from the media index files of the video source at different code rates; then, the terminal may determine, according to the media index file corresponding to the first code rate, a download position of the video fragment of the video source at the first code rate, and download, according to the download position, the video fragment of the video source at the first code rate.
It should be noted that, when the video watched by the user is the on-demand video, since the playing time of the on-demand video is fixed, the download position of the video segment of the video source providing the on-demand video at different code rates is also fixed, that is, the media index file of the video source providing the on-demand video at different code rates is also fixed.
When the video watched by the user is the live video, the playing time length of the live video is not fixed, so that the downloading positions of the video fragments of the video source providing the live video at different code rates can be periodically updated, that is, the media index files of the video source providing the live video at different code rates can be periodically updated. Therefore, when the video watched by the user is a live video, in this embodiment, the media index files of the video source at different bit rates can be periodically acquired in the process of downloading the video fragment of the video source at one bit rate.
Therefore, in the technical scheme of the embodiment of the application, the media index files of the video source under different code rates can be acquired before the video fragment of the video source under one code rate is downloaded, so that in the process of code rate switching, the terminal can directly acquire the media index file under the switched code rate locally, that is, the downloading position of the video fragment under the switched code rate can be directly acquired locally, and the time is not required to be spent for acquiring the downloading position of the video fragment under the switched code rate, so that the time for code rate switching is shortened, and the speed for code rate switching is increased.
Next, the video playing method provided by the present application will be described from the perspective of terminal side and server side interaction. Referring to fig. 2c, a signaling flowchart of a video playing method according to an embodiment of the present application is shown. As shown in fig. 2c, the following steps may be included:
s211: and the terminal plays the video fragments of the video source at the first code rate when the video playing code rate is the first code rate.
For example, assuming that the terminal used by the user is a tablet computer, when the user wishes to request a movie through the update video APP in the tablet computer, the user may start playing the movie with the update video APP by clicking a play key. Specifically, after the user clicks the play key, the tablet pc may determine a video source providing the movie and determine that a bitrate for playing the movie is a default bitrate of 1000kbit/s (i.e., a first bitrate); and when the tablet computer starts playing the movie, the video fragments of the video source at the default code rate of 1000kbit/s can be played at the playback code rate of 1000kbit/s.
S212: and the terminal uploads a downloading parameter for identifying the network downloading quality to a server in the process of downloading the video source in the video fragmentation at the first code rate.
It should be noted that S212 is similar to S201 described above, please refer to the related description for S201 in the above embodiments, and will not be described herein again.
Continuing with the example in S211, in the process of downloading the video clips of the video source corresponding to the movie at the default bitrate of 1000kbit/S, the tablet computer may obtain the corresponding downloading parameters, and may upload the downloading parameters to the server.
S213: and the server determines a second code rate corresponding to the network downloading quality according to the downloading parameters, and sends switching information carrying an identifier of the second code rate to the terminal so as to instruct the terminal to download the video fragments of the video source at the second code rate.
Wherein the handover information comprises an identification of the second code rate. It should be noted that S213 is similar to S202 described above, please refer to the related description for S202 in the above embodiments, and will not be described herein again.
Continuing with the example in S212, assume that the video segment downloaded by the tablet computer is a video segment of the video source at the default bitrate of 1000bit/S, and the download parameters uploaded by the server receiving terminal include the size of the video segment not downloaded being 500Mb, the current video segment download time being 5S, and the receiving speed being 1 kbps. Because the server can determine that the network downloading quality identified by the downloading parameter is better than the network downloading quality corresponding to the default code rate of 1000bit/s according to the downloading parameter, the server can determine that the code rate corresponding to the downloading quality identified by the downloading parameter is the second code rate of 2000bit/s, and the second code rate of 2000bit/s is higher than the default code rate of 1000bit/s. Therefore, the server can generate the switching information carrying the identifier of the second code rate of 2000 bits/s, and can send the switching information to the tablet computer.
S214: and the terminal downloads the video fragments of the video source at the second code rate according to the switching information.
It should be noted that S214 is similar to S203 described above, please refer to the related description for S203 in the above embodiments, and will not be described herein again.
Continuing to take the example in S213 as an example, in the process of downloading the video clips of the video source at the default bitrate of 1000kbit/S, if the switching information carrying the second bitrate of 2000kbit/S and sent by the server is acquired, the tablet may first determine the second bitrate of 2000kbit/S in the switching information, and then start downloading the video clips of the video source at the second bitrate of 2000kbit/S.
S215: and if the preset condition is met, the terminal switches the video playing code rate to the second code rate and plays the video fragments of the video source at the second code rate.
It should be noted that S215 is similar to S204 described above, please refer to the related description for S204 in the above embodiments, and will not be described herein again.
For example, suppose that the tablet computer has downloaded a video slice a of the video source corresponding to the movie at a default bitrate of 1000kbit/s and a video slice B of the video source corresponding to the movie at a second bitrate of 2000kbit/s, where the video slice B is the next video slice of the video slice a in the playing order. When the tablet computer finishes playing the video fragment A, the preset condition can be considered to be met, and the tablet computer can be switched to the second code rate of 2000kbit/s to play the video fragment B.
According to the technical scheme, the video fragments of the video source at the first code rate are downloaded, so that the downloading parameters can be uploaded to the server in the process of playing the video fragments at the first code rate, and the network downloading quality of the video fragments at the first code rate can be identified by the downloading parameters, so that the switching information acquired from the server can indicate the code rate suitable for the downloading parameters or the network downloading quality, such as the second code rate. And downloading the video fragments of the video source at the second code rate according to the switching information, and switching to the second code rate to play the video fragments of the video source at the second code rate when a preset condition is met. Therefore, the video fragments under the corresponding code rates can be flexibly downloaded through the switching information capable of indicating the current network downloading quality, and the code rate of the currently played video is automatically switched when the conditions are met. The method and the device have the advantages that the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by a user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, the situation that the played video is blocked can be avoided to a certain extent, the user can watch the video without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
For better understanding and implementing the above-mentioned scheme of the embodiment of the present application, a corresponding application scenario will be exemplified with reference to fig. 3, and a specific description will be given of a code rate switching method provided in the embodiment of the present application.
Suppose that a user requests a movie "red sea action" through an Tengcong video APP in a smart phone (i.e., a terminal), and the code rate set by the user for a video source providing the movie "red sea action" is a first code rate; then, in the process that the smartphone downloads the video source providing the movie "red sea action" for video slicing at the first bitrate, the bitrate switching method may include the following steps:
s301: the smart phone can acquire media index files of the video source at different code rates.
S302: the smart phone can download video fragments of the video source at a first code rate according to the media index file of the video source at the first code rate;
s303: after the smart phone finishes downloading one video fragment of the video source at the first code rate, the smart phone can upload a downloading parameter for identifying the network downloading quality of the video fragment to a server.
S304: the server may determine a second code rate corresponding to the network download quality according to the download parameter, and may send switching information carrying an identifier of the second code rate to the smartphone, so as to instruct the smartphone to download the video clips of the video source at the second code rate.
Wherein the second code rate is lower than the first code rate.
S305: if the smart phone is downloading the first video fragment of the video source at the first code rate when acquiring the switching information, the smart phone may determine the identifier of the second video fragment according to the identifier of the first video fragment.
And the second video segment is the next video segment of the first video segment in the playing sequence.
S306, the intelligent mobile phone resets the internal state of the demultiplexing module according to the switching information.
S307: after the smart phone finishes downloading the first video fragment of the video source at the first code rate, the smart phone starts to download the video fragment of the video source at the second code rate from the second video fragment according to the switching information and the identifier of the second video fragment.
S308, the smart phone acquires the decoder parameters of the video source at the second code rate, and restarts a decoder according to the decoder parameters.
S309: and after the smart phone finishes playing the first video fragment of the video source at the first code rate, switching to the second code rate to play the second video fragment of the video source at the second code rate.
According to the technical scheme, the video fragments of the video source at the first code rate are downloaded, so that the download parameters can be uploaded to the server in the process of playing the video fragments at the first code rate, and the network download quality of the video fragments at the first code rate can be identified by the download parameters, so that the code rate suitable for the download parameters or the network download quality, such as the second code rate, can be indicated by the switching information acquired from the server. And downloading the video fragments of the video source at the second code rate according to the switching information, and switching to the second code rate to play the video fragments of the video source at the second code rate when a preset condition is met. Therefore, the video fragments under the corresponding code rate can be flexibly downloaded through the switching information capable of indicating the current network downloading quality, and the code rate of the currently played video is automatically switched when the conditions are met. The method and the device have the advantages that the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by a user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, the situation that the played video is blocked can be avoided to a certain extent, the user can watch the video without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
To facilitate better implementation of the above-described aspects of the embodiments of the present application, the following also provides relevant means for implementing the above-described aspects.
Referring to fig. 4a, in an embodiment of a code rate switching apparatus 400 provided by the present application, the code rate switching apparatus 400 may include: the system comprises an uploading module 401, an obtaining module 402, a downloading module 403 and a switching module 404;
the uploading module 401 is configured to upload, to a server, a downloading parameter for identifying network downloading quality in a process of downloading video clips of a video source at a first code rate;
the obtaining module 402 is configured to obtain switching information determined by the server according to the download parameter, where the switching information includes an identifier of a second code rate;
the downloading module 403 is configured to download the video segments of the video source at the second code rate according to the switching information;
the switching module 404 is configured to switch to the second code rate to play the video segments of the video source at the second code rate if a preset condition is met.
In an embodiment, if the first video segment of the video source at the first code rate is being downloaded when the switching information is obtained, the downloading module 403 is further configured to:
determining an identifier of a second video fragment according to the identifier of the first video fragment, wherein the second video fragment is the next video fragment of the first video fragment in the playing sequence;
after downloading the first video fragment of the video source at the first code rate, according to the switching information and the identifier of the second video fragment, starting to download the video fragment of the video source at the second code rate from the second video fragment.
In one embodiment, the switching module 404 is further configured to:
and after the first video fragment of the video source at the first code rate is played, switching to the second code rate to play the second video fragment of the video source at the second code rate.
In an embodiment, if the first video segment of the video source at the first code rate is being downloaded when the switching information is obtained, the downloading module 403 is further configured to:
and according to the switching information and the identifier of the first video fragment, starting to download the video fragments of the video source at a second code rate from the first video fragment.
In one embodiment, the switching module 404 is further configured to:
determining the maximum playing time of the downloaded video source at a part of first video fragments under a first code rate;
when the part of the first video fragments of the video source under the first code rate is played to the maximum playing time, switching to the second code rate, and starting to play the first video fragments of the video source under the second code rate from the maximum playing time.
In one embodiment, the switching module 404 is further configured to:
after the decoder parameters of the video source at a second code rate are acquired by downloading the video fragments of the video source at the second code rate, if the preset conditions are met, restarting a decoder according to the decoder parameters;
and switching to the second code rate to play the video fragments of the video source at the second code rate.
In an embodiment, the upload module 401 is further configured to:
after downloading a video fragment of the video source at a first code rate, uploading a downloading parameter for identifying the network downloading quality of the video fragment to the server.
In an embodiment, the obtaining module 402 is further configured to obtain media index files of the video source at different code rates before the downloading video source performs video slicing at a first code rate; the media index file under one code rate is used for identifying the downloading position of the video fragment under the code rate.
Referring to fig. 4b, in an embodiment of the present application, a video playing apparatus 410 is provided, where the apparatus 410 includes: a playing module 411, an uploading module 412, an obtaining module 413, a downloading module 414 and a switching module 415;
the playing module 411 is configured to play the video segments of the video source at the first code rate when the video playing code rate is the first code rate;
the uploading module 412 is configured to upload, to a server, a downloading parameter for identifying network downloading quality in a process of downloading the video source in the video slicing at the first code rate;
the obtaining module 413 is configured to obtain switching information determined by the server according to the download parameter, where the switching information includes an identifier of a second code rate;
the downloading module 414 is configured to download the video segments of the video source at the second code rate according to the switching information;
the switching module 415 is configured to switch the video playing code rate to the second code rate and play the video segments of the video source at the second code rate if a preset condition is met.
Referring to fig. 5, a code rate switching apparatus 500 according to an embodiment of the present application includes: an acquisition module 501, a determination module 502 and a sending module 503;
the obtaining module 501 is configured to obtain a download parameter uploaded by a terminal, where the download parameter is used to identify a network download quality of video fragmentation of a terminal download video source at a first code rate;
the determining module 502 is configured to determine a second code rate corresponding to the network download quality according to the download parameter;
the sending module 503 is configured to send, to the terminal, the switching information carrying the identifier of the second code rate to instruct the terminal to download the video segments of the video source at the second code rate.
As shown in fig. 6, for convenience of description, only the relevant parts of the embodiments of the present application are shown, and details of the specific techniques are not disclosed, please refer to the method part of the embodiments of the present application. The code rate switching device may be a terminal, and the terminal may be any terminal device including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA, for short in english), a Sales terminal (POS, for short in english), a vehicle-mounted computer, and the like, where the terminal is the mobile phone:
fig. 6 is a block diagram illustrating a partial structure of a mobile phone related to a terminal provided in an embodiment of the present application. Referring to fig. 6, the handset includes: radio Frequency (RF) circuit 610, memory 620, input unit 630, display unit 640, sensor 650, audio circuit 660, wireless fidelity (WiFi) module 670, processor 680, and power supply 690. Those skilled in the art will appreciate that the handset configuration shown in fig. 6 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 6:
the RF circuit 610 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 680; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuit 610 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (Low Noise Amplifier, LNA), a duplexer, and the like. In addition, the RF circuitry 610 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communications (GSM), general Packet Radio Service (GPRS), code Division Multiple Access (CDMA), wideband Code Division Multiple Access (WCDMA), long Term Evolution (LTE), e-mail, short message Service (Short SMS), and so on.
The memory 620 may be used to store software programs and modules, and the processor 680 may execute various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 620. The memory 620 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 620 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 630 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also referred to as a touch screen, may collect touch operations of a user (e.g., operations of the user on the touch panel 631 or near the touch panel 631 by using any suitable object or accessory such as a finger or a stylus) thereon or nearby, and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 631 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 680, and can receive and execute commands sent by the processor 680. In addition, the touch panel 631 may be implemented by various types such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 630 may include other input devices 632 in addition to the touch panel 631. In particular, other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 640 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 640 may include a Display panel 641, and optionally, the Display panel 641 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 631 can cover the display panel 641, and when the touch panel 631 detects a touch operation thereon or nearby, the touch panel is transmitted to the processor 680 to determine the type of the touch event, and then the processor 680 provides a corresponding visual output on the display panel 641 according to the type of the touch event. Although in fig. 6, the touch panel 631 and the display panel 641 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 631 and the display panel 641 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 650, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 641 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 641 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, the description is omitted here.
Audio circuit 660, speaker 661, and microphone 662 can provide an audio interface between a user and a cell phone. The audio circuit 660 may transmit the electrical signal converted from the received audio data to the speaker 661, and convert the electrical signal into an audio signal through the speaker 661 for output; on the other hand, the microphone 662 converts the collected sound signals into electrical signals, which are received by the audio circuit 660 and converted into audio data, which are processed by the audio data output processor 680 and then transmitted via the RF circuit 66 to, for example, another cellular phone, or output to the memory 620 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 670, and provides wireless broadband Internet access for the user. Although fig. 6 shows the WiFi module 670, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 680 is a control center of the mobile phone, and connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 620 and calling data stored in the memory 620, thereby performing overall monitoring of the mobile phone. Optionally, processor 680 may include one or more processing units; preferably, the processor 680 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 680.
The handset also includes a power supply 690 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 680 via a power management system, such that the power management system may manage charging, discharging, and power consumption.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which will not be described herein.
In the embodiment of the present application, the processor 680 included in the terminal further has the following functions:
in the process of downloading video fragments of a video source at a first code rate, uploading a downloading parameter for identifying network downloading quality to a server;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading the video fragments of the video source at the second code rate according to the switching information;
and if the preset condition is met, switching to the second code rate to play the video fragments of the video source at the second code rate.
In an embodiment, if a first video slice of the video source at a first code rate is being downloaded when the switching information is obtained, the downloading the video slice of the video source at a second code rate according to the switching information includes:
determining an identifier of a second video fragment according to the identifier of the first video fragment, wherein the second video fragment is the next video fragment of the first video fragment in the playing sequence;
after downloading the first video fragment of the video source at the first code rate, according to the switching information and the identifier of the second video fragment, starting to download the video fragment of the video source at the second code rate from the second video fragment.
In an embodiment, the switching to the second bitrate to play the video slices of the video source at the second bitrate if the preset condition is met includes:
and after the first video fragment of the video source at the first code rate is played, switching to the second code rate to play the second video fragment of the video source at the second code rate.
In an embodiment, if a first video slice of the video source at a first code rate is being downloaded when the switching information is obtained, the downloading the video slice of the video source at a second code rate according to the switching information includes:
and according to the switching information and the identifier of the first video fragment, starting to download the video fragments of the video source at a second code rate from the first video fragment.
In an embodiment, the switching to the second bitrate to play the video slices of the video source at the second bitrate if the preset condition is met includes:
determining the maximum playing time of the downloaded video source at a part of first video fragments under a first code rate;
when the part of the first video fragments of the video source under the first code rate is played to the maximum playing time, switching to the second code rate, and starting to play the first video fragments of the video source under the second code rate from the maximum playing time.
In an embodiment, the switching to the second bitrate to play the video slices of the video source at the second bitrate if the preset condition is met includes:
after the decoder parameters of the video source at a second code rate are obtained by downloading the video fragments of the video source at the second code rate, if the preset conditions are met, restarting a decoder according to the decoder parameters;
and switching to the second code rate to play the video fragments of the video source at the second code rate.
In one embodiment, the uploading, to a server, a download parameter for identifying a network download quality during video slicing at a first bitrate by the video source includes:
after downloading a video fragment of the video source at the first code rate, uploading a downloading parameter for identifying the network downloading quality of downloading the video fragment to the server.
In one embodiment, before downloading the video source video slices at the first bitrate, the method further comprises:
acquiring media index files of the video source at different code rates; the media index file under one code rate is used for identifying the downloading position of the video fragment under the code rate.
In the embodiment of the present application, the processor 680 included in the terminal further has the following functions:
playing video fragments of a video source at a first code rate when the video playing code rate is the first code rate;
uploading a downloading parameter for identifying network downloading quality to a server in the process of downloading the video source under the first code rate;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading the video fragments of the video source at the second code rate according to the switching information;
and if the preset condition is met, switching the video playing code rate to the second code rate, and playing the video fragments of the video source at the second code rate.
The embodiment of the present application provides a code rate switching device, which may be a server as shown in fig. 7. Fig. 7 is a schematic diagram of a server structure provided in an embodiment of the present application, where the server 700 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 722 (e.g., one or more processors) and a memory 732, and one or more storage media 730 (e.g., one or more mass storage devices) for storing applications 742 or data 744. Memory 732 and storage medium 730 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 730 may include one or more modules (not shown), each of which may include a series of instruction operations on a server. Further, the central processor 722 may be configured to communicate with the storage medium 730, and execute a series of instruction operations in the storage medium 730 on the server 700.
The server 700 may also include one or more power supplies 726, one or more wired or wireless network interfaces 750, one or more input-output interfaces 758, and/or one or more operating systems 741, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and so forth.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 7.
The CPU 722 is configured to execute the following steps:
acquiring a downloading parameter uploaded by a terminal, wherein the downloading parameter is used for identifying the network downloading quality of video fragments of a video source downloaded by the terminal at a first code rate;
determining a second code rate corresponding to the network downloading quality according to the downloading parameters;
and sending switching information carrying the identifier of the second code rate to the terminal to indicate the terminal to download the video fragments of the video source at the second code rate.
Referring to fig. 8, fig. 8 is a schematic diagram of an embodiment of a code rate switching system in an embodiment of the present application, where the code rate switching system may include a terminal 801 and a server 802;
an action performed by the terminal 801, for example, uploading a download parameter for identifying network download quality to the server in a process of downloading video source video clips at a first code rate; acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate; downloading the video fragments of the video source at the second code rate according to the switching information; if the preset condition is met, switching to the second code rate to play the video fragments of the video source at the second code rate;
an action performed by the server 802, for example, acquiring the download parameter uploaded by the terminal; determining the second code rate corresponding to the network downloading quality according to the downloading parameters; and sending the switching information to the terminal to instruct the terminal to download the video fragments of the video source at the second code rate.
As can be seen, the code rate switching system provided in the embodiment of the present application can upload the download parameters to the server in the process of playing the video segments at the first code rate by downloading the video segments of the video source at the first code rate, and because the download parameters can identify the network download quality of downloading the video segments at the first code rate, the switching information obtained from the server can indicate the code rate suitable for the download parameters or the network download quality, for example, the second code rate. And downloading the video fragments of the video source at the second code rate according to the switching information, and switching to the second code rate to play the video fragments of the video source at the second code rate when a preset condition is met. Therefore, the video fragments under the corresponding code rate can be flexibly downloaded through the switching information capable of indicating the current network downloading quality, and the code rate of the currently played video is automatically switched when the conditions are met. The method and the device have the advantages that the video fragments under the low code rate can be downloaded when the network downloading quality is poor, the high code rate originally selected by a user is automatically switched to the low code rate, manual switching by the user is not needed, the video fragments under the low code rate are downloaded before switching, the situation that the played video is blocked can be avoided to a certain extent, the user can watch the video without perceiving the influence caused by network fluctuation, and the watching experience of the user is improved.
An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium is configured to store a program code, and the program code is configured to execute any one implementation manner of the rate switching method described in the foregoing embodiments and any one implementation manner of the video playing method described in the foregoing embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The terms "first," "second," "third," "fourth," and the like (if any) in this application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (11)

1. A method for rate switching, the method comprising:
acquiring media index files of a video source at different code rates, wherein the media index file at one code rate is used for identifying the downloading positions of video fragments at the code rate, and the downloading positions corresponding to the media index files at different code rates are different;
uploading a downloading parameter for identifying the network downloading quality to a server in the process of downloading the video source video fragments at the first code rate according to the media index file at the first code rate;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading video fragments of the video source at a second code rate according to the switching information and the media index file at the second code rate;
resetting the internal state of a demultiplexing module according to the switching information, wherein the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for an audio and video digital television through a program mapping table, acquires decoder parameters of the video source at the second code rate, and sends the decoder parameters to a decoder, wherein the decoder parameters embody the characteristics of the video source providing video fragments;
if the preset condition is met, restarting the decoder according to the decoder parameter so as to decode the video fragments of the video source at the second code rate through the restarted decoder;
and playing the decoded video fragments.
2. The method of claim 1, wherein if the first video slice of the video source at the first bitrate is being downloaded when the switching information is obtained, the downloading the video slice of the video source at the second bitrate according to the switching information and the media index file at the second bitrate comprises:
determining an identifier of a second video fragment according to the identifier of the first video fragment, wherein the second video fragment is the next video fragment of the first video fragment in the playing sequence;
after downloading the first video fragment of the video source at the first code rate, according to the switching information, the media index file at the second code rate and the identifier of the second video fragment, starting to download the video fragment of the video source at the second code rate from the second video fragment.
3. The method of claim 1, wherein if the first video slice of the video source at the first bitrate is being downloaded when the switching information is obtained, the downloading the video slice of the video source at the second bitrate according to the switching information and the media index file at the second bitrate comprises:
and according to the switching information, the media index file at the second code rate and the identification of the first video fragment, starting to download the video fragment of the video source at the second code rate from the first video fragment.
4. The method according to any one of claims 1 to 3, wherein the uploading, to a server, a download parameter for identifying a network download quality during the downloading of the video source in the video slicing at the first bitrate comprises:
after downloading a video fragment of the video source at a first code rate, uploading a downloading parameter for identifying the network downloading quality of the video fragment to the server.
5. An apparatus for rate switching, the apparatus comprising: the device comprises an uploading module, an obtaining module, a downloading module and a switching module;
the acquisition module is used for acquiring media index files of a video source at different code rates, wherein the media index file at one code rate is used for identifying the downloading positions of video fragments at the code rate, and the downloading positions corresponding to the media index files at different code rates are different;
the uploading module is used for uploading downloading parameters for identifying the network downloading quality to a server in the process of downloading the video fragments of the video source at the first code rate according to the media index file at the first code rate;
the obtaining module is further configured to obtain switching information determined by the server according to the download parameter, where the switching information includes an identifier of a second code rate;
the downloading module is used for downloading the video fragments of the video source at a second code rate according to the switching information and the media index file at the second code rate;
the switching module is configured to reset an internal state of the demultiplexing module according to the switching information, the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for an audio and video digital television through a program mapping table, obtains a decoder parameter of the video source at the second code rate, and sends the decoder parameter to a decoder, where the decoder parameter represents a characteristic of a video source providing video fragmentation; if the preset condition is met, restarting the decoder according to the decoder parameter so as to decode the video fragments of the video source at the second code rate through the restarted decoder; and playing the decoded video fragments.
6. A code rate switching device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the code rate switching method of any of claims 1-4 according to instructions in the program code.
7. A video playback method, the method comprising:
acquiring media index files of a video source at different code rates, wherein the media index file at one code rate is used for identifying the downloading positions of video fragments at the code rates, and the downloading positions corresponding to the media index files at different code rates are different;
playing video fragments of a video source at a first code rate when the video playing code rate is the first code rate;
uploading a downloading parameter for identifying network downloading quality to a server in the process of downloading video fragments of the video source at a first code rate according to a media index file at the first code rate;
acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate;
downloading video fragments of the video source at a second code rate according to the switching information and the media index file at the second code rate;
resetting the internal state of a demultiplexing module according to the switching information, wherein the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for an audio and video digital television through a program mapping table, acquires decoder parameters of the video source at the second code rate, and sends the decoder parameters to a decoder, wherein the decoder parameters embody the characteristics of the video source providing video fragments;
if the preset condition is met, restarting the decoder according to the decoder parameter so as to decode the video fragments of the video source at the second code rate through the restarted decoder;
and playing the decoded video fragments.
8. A method for rate switching, the method comprising:
acquiring a downloading parameter uploaded by a terminal, wherein the downloading parameter is used for identifying the network downloading quality of video fragmentation of a terminal downloading video source at a first code rate;
determining a second code rate corresponding to the network downloading quality according to the downloading parameters;
sending switching information carrying an identifier of the second code rate to the terminal to indicate the terminal to download the video fragments of the video source at the second code rate according to the switching information and a media index file at the second code rate, wherein the media index file at one code rate is used for identifying the downloading positions of the video fragments at the code rate, the downloading positions corresponding to the media index files at different code rates are different, the terminal resets the internal state of a demultiplexing module according to the switching information, the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for a digital television of audio and video through a program mapping table, acquires decoder parameters of the video source at the second code rate, sends the decoder parameters to a decoder, the decoder parameters embody the characteristics of the video source providing the video fragments, and if preset conditions are met, the decoder is restarted according to the decoder parameters so that the decoder after the video source restarts the video fragment at the second code rate to play the decoded video fragments.
9. An apparatus for rate switching, the apparatus comprising: the device comprises an acquisition module, a determination module and a sending module;
the acquisition module is used for acquiring downloading parameters uploaded by a terminal, and the downloading parameters are used for identifying the network downloading quality of video fragmentation of a video source downloaded by the terminal under a first code rate;
the determining module is used for determining a second code rate corresponding to the network downloading quality according to the downloading parameters;
the sending module is configured to send switching information carrying an identifier of the second code rate to the terminal to instruct the terminal to download the video segments of the video source at the second code rate according to the switching information and a media index file at the second code rate, where the media index file at one code rate is used to identify download positions of the video segments at the code rate, and download positions corresponding to the media index files at different code rates are different, the terminal resets an internal state of the demultiplexing module according to the switching information, the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for digital televisions of audio and video through a program mapping table, obtains decoder parameters of the video source at the second code rate, sends the decoder parameters to a decoder, and the decoder parameters embody characteristics of the video source providing the video segments, and if a preset condition is met, according to the decoder parameters, the decoder is convenient for decoding the video segments restarted at the second code rate through the restarted decoder, and playing the decoded video segments.
10. A code rate switching system is characterized in that the system comprises a terminal and a server;
the terminal is used for acquiring media index files of a video source under different code rates, wherein the media index file under one code rate is used for identifying the downloading positions of video fragments under the code rate, and the downloading positions corresponding to the media index files under different code rates are different; uploading a downloading parameter for identifying the network downloading quality to the server in the process of downloading the video slicing of the video source at the first code rate according to the media index file at the first code rate; acquiring switching information determined by the server according to the downloading parameters, wherein the switching information comprises an identifier of a second code rate; downloading video fragments of the video source at a second code rate according to the switching information and the media index file at the second code rate; resetting the internal state of a demultiplexing module according to the switching information, wherein the demultiplexing module demultiplexes a program cluster table in a transport stream, searches for an audio and video digital television through a program mapping table, acquires decoder parameters of the video source at the second code rate, and sends the decoder parameters to a decoder, wherein the decoder parameters embody the characteristics of the video source providing video fragments; if the preset condition is met, restarting the decoder according to the decoder parameter so as to decode the video fragments of the video source at the second code rate through the restarted decoder; playing the decoded video slices;
the server is used for acquiring the downloading parameters uploaded by the terminal; determining the second code rate corresponding to the network downloading quality according to the downloading parameters; and sending the switching information to the terminal to instruct the terminal to download the video fragments of the video source at the second code rate.
11. A computer-readable storage medium for storing program code, wherein the program code when executed by a processor implements the bitrate switching method of any one of claims 1 to 4 or the video playing method of claim 7 or the bitrate switching method of claim 8.
CN201810509972.1A 2018-05-24 2018-05-24 Code rate switching method and device Active CN110536175B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810509972.1A CN110536175B (en) 2018-05-24 2018-05-24 Code rate switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810509972.1A CN110536175B (en) 2018-05-24 2018-05-24 Code rate switching method and device

Publications (2)

Publication Number Publication Date
CN110536175A CN110536175A (en) 2019-12-03
CN110536175B true CN110536175B (en) 2022-12-06

Family

ID=68656661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810509972.1A Active CN110536175B (en) 2018-05-24 2018-05-24 Code rate switching method and device

Country Status (1)

Country Link
CN (1) CN110536175B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259729B (en) * 2020-02-10 2023-07-14 北京字节跳动网络技术有限公司 Data switching method, server, system and storage medium
CN111866433B (en) * 2020-07-31 2021-06-29 腾讯科技(深圳)有限公司 Video source switching method, video source playing method, video source switching device, video source playing device, video source equipment and storage medium
CN112953922B (en) * 2021-02-03 2022-09-16 西安电子科技大学 Self-adaptive streaming media control method, system, computer equipment and application
CN113316005A (en) * 2021-04-20 2021-08-27 新华三技术有限公司 Method for adjusting video code rate and communication system
CN114040230B (en) * 2021-11-08 2024-03-29 北京达佳互联信息技术有限公司 Video code rate determining method and device, electronic equipment and storage medium thereof
CN114679443A (en) * 2022-03-03 2022-06-28 北京百度网讯科技有限公司 Method and device for downloading video data, electronic equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101696321B1 (en) * 2011-12-27 2017-01-13 한국전자통신연구원 Video conference control system and method for reservation video conference
CN105744299A (en) * 2014-12-08 2016-07-06 深圳Tcl数字技术有限公司 Dynamic code rate switching method, server and system
CN106878828A (en) * 2017-02-21 2017-06-20 微鲸科技有限公司 The method and device of automatic switchover multimedia code check
CN107071529B (en) * 2017-03-29 2018-10-26 咪咕视讯科技有限公司 A kind of HLS video broadcasting methods, terminal and server

Also Published As

Publication number Publication date
CN110536175A (en) 2019-12-03

Similar Documents

Publication Publication Date Title
CN110536175B (en) Code rate switching method and device
CN110139139B (en) Service processing method, terminal, server and storage medium
CN106791892B (en) Method, device and system for live broadcasting of wheelhouses
US9924205B2 (en) Video remote-commentary synchronization method and system, and terminal device
JP6877808B2 (en) Methods, devices, and systems for processing video stream data
CN111294638B (en) Method, device, terminal and storage medium for realizing video interaction
CN106792120B (en) Video picture display method and device and terminal
CN108259975B (en) Video playing method, storage medium and terminal
CN106803993B (en) Method and device for realizing video branch selection playing
CN106412691B (en) Video image intercepting method and device
US9904507B2 (en) Method and system for synchronizing functions of music player in smart device and bluetooth earphone
US11202066B2 (en) Video data encoding and decoding method, device, and system, and storage medium
CN103391473B (en) Method and device for providing and acquiring audio and video
EP3737101B1 (en) A method and a system for performing scrubbing in a video stream
US11178450B2 (en) Image processing method and apparatus in video live streaming process, and storage medium
CN111866433B (en) Video source switching method, video source playing method, video source switching device, video source playing device, video source equipment and storage medium
CN107333162B (en) Method and device for playing live video
CN108933964B (en) Bullet screen display method, playing device and control terminal
CN106791916B (en) Method, device and system for recommending audio data
CN112019929A (en) Volume adjusting method and device
CN110662090A (en) Video processing method and system
CN111741352A (en) Screen projection control method, screen projection playing method and related device
CN113453066A (en) Playing time determining method and related equipment
CN106817621B (en) Mobile terminal and video backup and play method and device thereof
CN111901482B (en) Function control method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant