CN110933517A - Code rate switching method, client and computer readable storage medium - Google Patents

Code rate switching method, client and computer readable storage medium Download PDF

Info

Publication number
CN110933517A
CN110933517A CN201911209068.XA CN201911209068A CN110933517A CN 110933517 A CN110933517 A CN 110933517A CN 201911209068 A CN201911209068 A CN 201911209068A CN 110933517 A CN110933517 A CN 110933517A
Authority
CN
China
Prior art keywords
key frame
code rate
playing
current
downloading
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.)
Granted
Application number
CN201911209068.XA
Other languages
Chinese (zh)
Other versions
CN110933517B (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.)
China Mobile Communications Group Co Ltd
MIGU Video Technology Co Ltd
MIGU Culture Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
MIGU Video Technology Co Ltd
MIGU Culture Technology 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 China Mobile Communications Group Co Ltd, MIGU Video Technology Co Ltd, MIGU Culture Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911209068.XA priority Critical patent/CN110933517B/en
Publication of CN110933517A publication Critical patent/CN110933517A/en
Application granted granted Critical
Publication of CN110933517B publication Critical patent/CN110933517B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • 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/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/437Interfacing the upstream path of the transmission network, e.g. for transmitting client requests to a VOD server
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/438Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving MPEG 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440281Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the temporal resolution, e.g. by frame skipping
    • 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/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8543Content authoring using a description language, e.g. Multimedia and Hypermedia information coding Expert Group [MHEG], eXtensible Markup Language [XML]
    • 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/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Abstract

The embodiment of the invention relates to the technical field of multimedia, and discloses a code rate switching method, a client and a computer readable storage medium. In the present invention, the code rate switching method includes: acquiring label information of each key frame in a currently played video; if the preset trigger operation is detected, determining a target key frame according to the playing data of the current playing buffer area and the label information of each key frame; and performing code rate switching by taking the target key frame as a switching initial position, so that the effect of rapid and smooth switching can be realized, the probability and the duration of pause in the switching process are reduced, and the required download flow in the switching process is saved.

Description

Code rate switching method, client and computer readable storage medium
Technical Field
The embodiment of the invention relates to the technical field of multimedia, in particular to a code rate switching method, a client and a computer readable storage medium.
Background
In the multimedia field, in order to meet the requirements of users with different bandwidths, video definition services are divided into a plurality of grades, and standard definition, high definition, super definition and the like are common. In the process of watching videos, a user can subjectively switch code rates among video contents with different definitions according to the change condition of the network bandwidth of the user, so that the user can enjoy smooth film watching experience. Meanwhile, the client can also adopt a self-adaptive mode to perform code rate switching under the condition that the network bandwidth of the user is sufficient, so that higher-quality video service is provided for the user. In order to prevent screen from being lost, the code rate switching needs to use the key frame as a switching point, and the related art has the following methods for realizing the code rate switching: 1. selecting a switching time point to switch the code rate according to the condition of the key frame in the playing buffer area; 2. based on the fact that the first frame of a Transport Stream (TS) segment is a key frame, a certain TS segment is selected for code rate switching.
However, the inventors found that at least the following problems exist in the related art: in the first method, when there is no key frame in the play buffer, the downloading needs to wait until the relevant key frame in the play buffer, which may result in long time delay and more required downloading traffic. In the second method, if it is determined that the code rate switching needs to be performed in the nth TS segment, it is necessary to wait for the n-1 th TS segment to be played, that is, to wait for the downloading time, so that the switching duration is long. And if the actual first frame of the TS segment is a non-key frame, the screen splash phenomenon can occur. In summary, the rate switching schemes in the related art have inevitable defects in rapidity.
Disclosure of Invention
An object of embodiments of the present invention is to provide a code rate switching method, a client, and a computer-readable storage medium, which enable a fast and smooth switching effect to be achieved, reduce the probability and duration of stutter during a switching process, and save the download traffic required during the switching process.
In order to solve the above technical problem, an embodiment of the present invention provides a code rate switching method, including the following steps: acquiring label information of each key frame in a currently played video; if the preset trigger operation is detected, determining a target key frame according to the playing data of the current playing buffer area and the label information of each key frame; and performing code rate switching by taking the target key frame as a switching initial position.
An embodiment of the present invention further provides a client, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the code rate switching method as described above.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the code rate switching method.
Compared with the prior art, the method and the device for playing the video acquire the label information of each key frame in the currently played video; if the preset trigger operation is detected, determining a target key frame according to the playing data of the current playing buffer area and the label information of each key frame; and performing code rate switching by taking the target key frame as a switching initial position. Based on the label information of each key frame in the video and the playing data in the current playing buffer area, a reasonable target key frame can be conveniently selected for seamless code rate switching. And the target key frame is directly used as a switching initial position to switch the code rate without waiting for the switching time, thereby being beneficial to realizing the effect of rapid and smooth switching, reducing the probability and duration of pause in the switching process and saving the downloading flow required in the switching process.
In addition, the acquiring of the tag information of each key frame in the currently played video includes: acquiring an M3U8 file of the video; the M3U8 file comprises a download address of label information of each key frame; and downloading the label information of each key frame in the currently played video according to the downloading address. The method for acquiring the label information of each key frame quickly and conveniently is provided, and the existing M3U8 file is expanded to carry the download address, so that the client can acquire the download address by analyzing the M3U8 file when acquiring the M3U8 file, and then download the label information of each key frame. Because the M3U8 file is a file which needs to be downloaded by the client when the client plays a video, the client can conveniently and quickly analyze and obtain the download address after the client downloads the M3U8 file by expanding the M3U8 file, and the space occupied by the download address is small, so that the size of the existing M3U8 file cannot be greatly influenced.
In addition, the downloading, according to the download address, the tag information of each key frame in the currently played video specifically includes: and when the first frame of the video is completely rendered, downloading the label information of each key frame in the currently played video according to the downloading address. The downloading opportunity of the label information is provided, and the situation that the unnecessary bandwidth is occupied if the label information is downloaded before the first frame is rendered is considered; if the tag information is downloaded after the first frame is rendered, the rate switching speed may be affected, that is, the tag information may not be downloaded when the tag information of each key frame needs to be queried. Therefore, the downloading is started after the first frame is rendered, and the effect of quick playing is achieved while unnecessary bandwidth is not occupied. The main playing performance index, namely the performance index of fast playing start, is not influenced, so that the user experience is improved.
In addition, the tag information includes: the index sequence number of each key frame, the TS segment sequence number of each key frame, the timestamp of each key frame, and the position offset of the TS segment of each key frame. Compared with the description information of the key frame in the related technology, the format has less carried information and reduces the cost of media asset storage and CDN cache, thereby saving the download flow of a user and improving the playing performance.
In addition, the determining a target key frame according to the playing data of the current playing buffer and the queried key frame includes: if no key frame is detected in the playing data of the current playing buffer area, selecting a key frame corresponding to a time stamp before the current time stamp as the target key frame according to the time stamp of the inquired key frame; if detecting the relevant key frame in the playing data of the current playing buffer area, estimating the downloading time length required from the last key frame to the current playing position according to the current downloading rate, and estimating the playing time length required from the current playing position to the next key frame; the last key frame is a key frame corresponding to a timestamp before a current timestamp selected according to the timestamp of the queried key frame, and the next key frame is a key frame in the current playing buffer area; if the downloading time length is less than the playing time length, determining the last key frame as the target key frame; and if the downloading time length is greater than the playing time length, determining the next key frame as the target key frame. The method and the device have the advantages that the specific implementation mode of determining the target key frame under the condition that no key frame exists in the playing data of the current playing buffer area and the key frame exists is provided, the key frame index table is inquired to reasonably and dynamically select the target key frame for switching based on the playing data in the current playing buffer area and the current downloading rate, the probability of blockage in the switching process is favorably reduced, and the downloading flow of a user is saved.
In addition, the performing code rate switching by using the target key frame as a switching start position includes: inquiring the position offset of the TS segment where the target key frame is located; downloading playing data corresponding to the switched code rate according to the inquired position offset; and determining the code rate after switching according to the triggering operation. The position offset of the target key frame can be conveniently and quickly obtained by inquiring the key frame index table, and the playing data can be directly downloaded according to the position offset of the target key frame. Compared with the related art, the embodiment of the invention does not need to sequentially download the playing data according to the time sequence, and the playing data corresponding to the switched code rate is downloaded only when the playing data comprising the key frame is detected, thereby being beneficial to saving the downloading flow of a user and reducing the code rate switching time.
Drawings
One or more embodiments are illustrated by the corresponding figures in the drawings, which are not meant to be limiting.
FIG. 1 is a flowchart of a code rate switching method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a code rate switching method according to a second embodiment of the present invention;
fig. 3 is an interaction flowchart of a server and a client when performing rate switching according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of a client according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments. The following embodiments are divided for convenience of description, and should not constitute any limitation to the specific implementation manner of the present invention, and the embodiments may be mutually incorporated and referred to without contradiction.
The first embodiment of the invention relates to a code rate switching method which is applied to a client. The client can be an electronic device such as a mobile phone and a computer, an application program for playing videos is installed in the client, and the application program can play the videos online when being connected with the internet. When playing video, a client generally downloads an M3U8 file corresponding to a current bitrate, where the M3U8 file stores download addresses of a plurality of TS segments, and the TS segments are files containing playing data. The client downloads the playing data in the TS segments according to the download addresses of the TS segments in the M3U8 file, and stores the downloaded playing data in the playing buffer area. And the client plays the corresponding TS segments according to the playing sequence of the video. If the network environment changes, the client can switch the code rate of the played video so as to achieve the aim of smoothly playing the video. The following describes implementation details of the code rate switching method of the present embodiment in detail, and the following is only provided for easy understanding and is not necessary to implement the present embodiment. As shown in fig. 1, a flow chart of the code rate switching method of the present embodiment may include:
step 101: and acquiring label information of each key frame in the currently played video.
The tag information of each key frame, that is, the tag information of all key frames in the video, may be generated in advance by the media asset management system.
In one example, the tag information of each key frame may be obtained as follows:
first, the client acquires an M3U8 file of a currently played video, and the M3U8 file includes a download address of tag information of each key frame. The download address can be added to the existing M3U8 file by extending a streaming media network transport protocol (HTTP live streaming, abbreviated as HLS) of HTTP. For example, the download address is defined using a predetermined tag, and the HLS protocol is combined with the download address. The preset label may be set according to actual needs, and this embodiment is not particularly limited thereto. In the following, the preset label is an EXT-X-DEFINE label, which is a label reserved by the authority and is easier to pass the authority authentication. An example of an M3U8 file in this example may be as follows:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-DEFINE:keyframeurl=http://XXXXXX.xml
#EXT-X-INF:10.000,ts
0001.ts
......
#ENDLIST
compared with the existing M3U8 file, the M3U8 file in this example further includes a download address of the tag information of each key frame, that is, a "# EXT-X-DEFINE: keyframe ═ http:// xxxxxx.xml" is added, which indicates that the download address of the tag information of each key frame is http:// xxxx.xml.
Then, the client can download the tag information of each key frame in the currently played video according to the download address of the tag information of each key frame. Specifically, when the user watches the video, the client may send a play request to the server, requesting to download the M3U8 file of the currently played video. After receiving the play request, the server returns the M3U8 file to the client. The client analyzes the M3U8 file to obtain the download address of the label information of each key frame. The client uses the analyzed download address to download by the server, and the server returns the label information of each key frame to the client. In a specific implementation, the server may also directly send the tag information of each key frame to the client after receiving the play request of the client, or send the download address of the tag information of each key frame to the client.
In one example, the tag information of each key frame may be stored in a key frame index table, where the key frame index table includes the tag information of each key frame, that is, the description information of all key frames in the video is stored. The key frame index table may be generated in advance by a media asset management system, and a storage format of the key frame index table may be Extensible Markup Language (xml). Based on the characteristics of lightweight file storage and support of multiple platforms and multiple codes in the xml format, the key frame index table in the example is stored and analyzed in the xml format. The key frame index table stored in xml format is hereinafter referred to as xml file. It should be noted that the storage format of the key frame index table in this example is only an xml format, which is not limited in the specific implementation, and a person skilled in the art may select the storage format according to actual needs.
In an example, in order to ensure the validity of xml file data, the embodiment provides a new definition format of a key frame tag, which can effectively reduce the size of an xml file, and reduce the caching cost of a media asset storage and Content Delivery Network (CND), thereby saving the download traffic of a user and improving the playing performance. Under this new format: the tag information of each key frame may include: the index sequence number id of each key frame, the sequence number seq of the TS segment of each key frame, the timestamp pts (unit: millisecond) of each key frame, and the position offset of the TS segment of each key frame. In a specific implementation, the tag information may further include picture information of each key frame, that is, a custom information string info, for describing relevant information of the key frame picture, such as image information description of the key frame, according to actual needs. The picture information of each key frame is selectable so as to expand the label information of the key frame according to actual needs. For ease of understanding, an example of a key frame index table is given below:
<keyframes>
<id=“11”seq=“41”pts=“40”offset=“0”info=“XXXXXX”/>
<id=“12”seq=“41”pts=“2040”offset=“1024”info=“XXXXXX”/>
<id=“13”seq=“42”pts=“4040”offset=“2048”info=“XXXXXX”/>
<id=“14”seq=“42”pts=“6040”offset=“3072”info=“XXXXXX”/>
<id=“15”seq=“43”pts=“8040”offset=“4096”info=“XXXXXX”/>
<id=“16”seq=“43”pts=“10040”offset=“5100”info=“XXXXXX”/>
......
</keyframes>
it should be noted that, for convenience of understanding, the key frame index table lists the tag information of the 11 th to 16 th key frames in the video exemplarily, and the tag information of each key frame in the video is included in the key frame index table in a specific implementation.
It is understood that, if the tag information of each key frame is stored in the form of a key frame index table, the download address of the tag information of each key frame included in the M3U8 file may be specifically the download address of the key frame index table. After the client downloads the key frame index table, the client can obtain the label information of each key frame through analysis.
Step 102: and if the preset trigger operation is detected, determining the target key frame according to the playing data of the current playing buffer area and the label information of each key frame.
In one example, the preset trigger operation may be: the clicking operation of the user, namely the triggering operation, is a manual triggering operation. For example, when the client plays a video, a virtual key for code rate switching is usually available on a playing interface, and a user can select switching to standard definition, high definition or super definition according to an actual network environment. If the client detects that the virtual key for code rate switching is clicked, it can be determined that a preset trigger operation is detected. It can be understood that a video website often provides video streams with multiple code rates, the higher the code rate is, the higher the video definition is, but the same video has a larger data volume and requires more traffic; conversely, the lower the code rate, the lower the video definition, but the same video has a smaller data size and requires less traffic. The standard definition, the high definition or the super definition can respectively represent three code rates which are sequentially increased, and represent that the definition of the video is higher and higher.
In another example, the preset trigger operation may be: the current network bandwidth is not matched with the current code rate of the played video, namely the triggering operation is the self-adaptive triggering operation. Specifically, if it is detected that the current network bandwidth does not match the current bitrate, it may be considered that a preset trigger operation is detected. The method for determining whether the current network bandwidth is matched with the current code rate may be: judging whether the absolute value of the difference between the current network bandwidth and the current code rate is smaller than a preset value, if so, considering that the current network bandwidth is matched with the current code rate, otherwise, considering that the current network bandwidth is not matched; the preset value may be set according to actual needs, and this embodiment is not particularly limited to this. For example, if the current network bandwidth is 1024kbps and the current code rate is 720kbps, it can be determined that the current network bandwidth is not matched with the current code rate; the trigger operation may indicate that: the current code rate needs to be switched to a code rate higher than the current code rate, i.e. a code rate matching the current network bandwidth. For another example, if the current network bandwidth is 780kbps and the current code rate is 1028kbps, it may be determined that the current network bandwidth does not match the current code rate; the trigger operation may indicate that: the current code rate needs to be switched to a code rate lower than the current code rate, i.e. a code rate matching the current network bandwidth.
In one example, the specific implementation manner of determining the target key frame according to the playing data of the current playing buffer and the tag information of each key frame may be as follows:
first, the sequence number of the currently played TS segment may be determined. It can be understood that the currently played video includes several TS segments, and if a preset trigger operation is detected, the sequence number seq of the TS segment to which the currently played video content belongs may be determined. Referring to the above example of the key frame index table, it is assumed that the determined sequence number of the currently playing TS segment is 41, i.e. it indicates that the currently playing TS segment is 41 th.
Next, the key frame corresponding to the serial number of the TS segment being played is queried according to the query key frame index table, that is, according to the tag information of each key frame, for example, the key frame corresponding to the serial number of the TS segment being played can be queried in the key frame index table. Referring to the above example of the key frame index table, assuming that the currently played TS segment 41, that is, seq ═ 41 ", the corresponding key frames to be searched are key frames with index sequence numbers id ═ 11" and id ═ 12 ", and hereinafter, the key frames 11 and 12 are respectively used for representation.
Then, according to the playing data of the current playing buffer area and the inquired key frame, the target key frame is determined.
In one example, if it is detected that there is no key frame in the playing data of the current playing buffer, a key frame corresponding to a time stamp before the current time stamp is selected as the target key frame according to the time stamp of the queried key frame. For example, referring to the above example of the key frame index table, assuming that the current timestamp pts is "1040", the timestamp pts of the key frame 11 is "40" and the timestamp pts of the key frame 12 is "2040" may be obtained through query of the key frame index table. It can be seen that the time stamp pts of the key frame 11 is "40" before the current time stamp pts is "1040", and the key frame 11 can be determined to be the target key frame.
In another example, if the relevant key frame in the playing data of the current playing buffer is detected, estimating the downloading time length required from the last key frame to the current playing position according to the current downloading rate, and estimating the playing time length required from the current playing position to the next key frame; the last key frame is the key frame corresponding to the timestamp before the current timestamp selected according to the timestamp of the queried key frame, and the next key frame is the key frame in the current playing buffer area. If the downloading time length is less than the playing time length, determining the last key frame as a target key frame; and if the downloading time length is greater than the playing time length, determining the next key frame as the target key frame. In a specific implementation, if the download duration is equal to the play duration, the previous key frame may be determined as the target key frame, or the next key frame may be determined as the target key frame, which is not specifically limited in this embodiment. For example, referring to the example of the key frame index table, assuming that the current timestamp pts is "1040", i.e. pts at the current playing position is "1040", the timestamp pts of the key frame 11 is "40" and the timestamp pts of the key frame 12 is "2040" may be obtained through querying the key frame index table. It can be seen that the time stamp pts of the key frame 11 is "40" before the current time stamp pts of "1040", the key frame 11 can be determined as the last key frame, and then the download duration from the key frame 11 to the current playing position is estimated according to the current download rate. And taking the detected key frame of the current playing buffer area as the next key frame, and predicting the playing time required by the key frame from the current playing position to the previous playing buffer area. And finally, determining which key frame is used as the target key frame according to the downloading time length and the playing time length.
For further ease of understanding, reference may be made to the following examples: assume that the current playing position is 2 seconds, the position of the previous key frame (searched by the key frame index table) is 0 seconds, and the position of the next key frame (existing in the current buffer) is 5 seconds. If the current downloading speed is high, so that the downloading time is short, the key frame at the position of 0 second can be used as the target key frame, and the client can not continue to play the playing data in the current buffer region for 2 to 5 seconds, and directly downloads the playing data at the position of 0 second corresponding to the switched code rate. If the current downloading speed is relatively slow, so that the downloading time is long, the key frame at the position of 5 seconds can be used as the target key frame, the client can continue to play the playing data in the current buffer region for 2 seconds to 5 seconds, and then the playing data at the position of 5 seconds corresponding to the switched code rate is downloaded.
In a specific implementation, if the key frame index table includes the custom information string info, the info may be used to describe picture information of a certain key frame, so that the info may also be used as a reference for determining a target key frame, for example, performing code rate switching when a certain action picture is specified.
Step 103: and taking the target key frame as a switching initial position to switch the code rate.
In one example, first, the position offset of the TS segment where the target key frame is located may be queried according to the tag information of each key frame. Referring to the example of the key frame index table, assuming that the target key frame is the key frame 11, the position offset of the TS segment where the target key frame is located is "0". Then, according to the inquired position offset, downloading the playing data corresponding to the switched code rate; namely, for the playing data corresponding to the switched code rate, downloading and playing are started from the inquired position offset.
And determining the code rate after switching according to the triggering operation. For example, the preset trigger operation is: clicking operation of a user; the current code rate of the video is the code rate corresponding to the standard definition grade, and if the user clicks to switch to the high definition grade, the switched code rate is the code rate corresponding to the high definition grade. For another example, the preset triggering operation is: self-adaptive triggering operation; and if the current network bandwidth is not matched with the current code rate of the played video, the code rate after switching is the code rate matched with the current network bandwidth.
The above examples in the present embodiment are only for convenience of understanding, and do not limit the technical aspects of the present invention.
Compared with the prior art, the method and the device have the advantage that the reasonable target key frame can be conveniently selected for seamless code rate switching based on the label information of each key frame in the video and the playing data in the current playing buffer area. And the code rate switching is directly carried out by taking the target key frame as the switching initial position without waiting for the switching time, thereby being beneficial to realizing the effect of rapid and smooth switching, reducing the probability and the time length of pause in the switching process and saving the downloading flow required in the switching process. Moreover, a new definition format of the tag information of the key frame is provided, compared with the description information of the key frame in the related technology, the format has less carried information, the space occupied by the key frame index table in the xml format can be effectively reduced, the media resource storage and CDN cache cost can be reduced, the download flow of a user can be saved, and the playing performance can be improved.
A second embodiment of the present invention relates to a code rate switching method. The following describes implementation details of the code rate switching method of the present embodiment in detail, and the following is only provided for easy understanding and is not necessary to implement the present embodiment. As shown in fig. 2, a flow chart of the code rate switching method of the present embodiment may include:
step 201: an M3U8 file of the currently playing video is obtained.
Step 202: and analyzing the M3U8 file to obtain the download address of the label information of each key frame.
Step 203: and when the first frame of the video is completely rendered, downloading the label information of each key frame in the currently played video according to the downloading address.
Specifically, after downloading the playing data and storing the playing data into the playing buffer area, the client starts a decoder to decode the playing data, and then renders and plays the playing data. And when the first frame picture is rendered and played, the client downloads the label information of each key frame by using the analyzed download address. For example, after the client analyzes the download address at the beginning, the download address may be cached, and after the rendering of the first frame picture is detected, the client starts to download the first frame picture according to the download address to obtain the tag information of each key frame.
Step 204: and if the preset trigger operation is detected, determining the target key frame according to the playing data of the current playing buffer area and the label information of each key frame.
Step 205: and taking the target key frame as a switching initial position to switch the code rate.
In the above steps 201 to 205, except for step 203, which are described in detail in the first embodiment, reference may be made to the related description in the first embodiment, and in order to avoid repetition, the present embodiment is not described in detail again.
To further facilitate understanding of the code rate switching method in this embodiment, a specific interaction diagram of the client and the server is described below, where the tag information of each key frame is stored in the key frame index table as an example. Referring to fig. 3, the interactive process of the code rate switching method includes:
s301, the client sends a playing request to the server. That is, when the user watches the video, the client detects that the user clicks a control for starting playing, and sends a playing request to the server to request to download the M3U8 file.
S302, the server returns the M3U8 file to the client. That is, after receiving the play request sent by the client, the server returns the M3U8 file of the video to the client.
S303, the client analyzes the M3U8 file to obtain the download address of the key frame index table. In addition, the download address of the playing data can be obtained by analyzing the M3U8 file client, so that the playing data can be downloaded and stored in the playing buffer area, and the decoder is started to render and play after decoding.
S304, after the client detects that the rendering of the first frame is finished, the client requests to download the key frame index table.
S305, the server returns the key frame index table to the client. The client can analyze the label information of each key frame according to the defined format of the key frame index table.
S306, the client detects the preset trigger operation, and selects the target key frame as a switching starting point to request for playing data. For example, when the user clicks to perform seamless bitrate switching operation, the client selects a target key frame to perform seamless bitrate switching based on an irrelevant key frame in a current playing buffer and the current downloading rate. The client may use the target key frame as a switching start point, and request the server for the playing data corresponding to the switched code rate.
Compared with the prior art, the embodiment provides a downloading time of the tag information of each key frame, and considers that if the tag information is downloaded before the first frame is rendered, unnecessary bandwidth is occupied; if the tag information is downloaded after the first frame is rendered, the rate switching speed may be affected, that is, the tag information may not be downloaded when the tag information needs to be queried. Therefore, the downloading is started after the first frame is rendered, and the effect of quick playing is achieved while unnecessary bandwidth is not occupied. The main playing performance index, namely the performance index of fast playing start, is not influenced, so that the user experience is improved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A third embodiment of the present invention relates to a client, as shown in fig. 4, including: at least one processor 401; and a memory 402 communicatively coupled to the at least one processor 401; the memory 402 stores instructions executable by the at least one processor 401, and the instructions are executed by the at least one processor 401, so that the at least one processor 401 can execute the code rate switching method in the first or second embodiment.
Where the memory 402 and the processor 401 are coupled by a bus, which may include any number of interconnected buses and bridges that couple one or more of the various circuits of the processor 401 and the memory 402 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 401 may be transmitted over a wireless medium via an antenna, which may receive the data and transmit the data to the processor 401.
The processor 401 is responsible for managing the bus and general processing and may provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 402 may be used to store data used by processor 401 in performing operations.
A fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (10)

1. A method for rate switching, comprising:
acquiring label information of each key frame in a currently played video;
if the preset trigger operation is detected, determining a target key frame according to the playing data of the current playing buffer area and the label information of each key frame;
and performing code rate switching by taking the target key frame as a switching initial position.
2. The method for switching code rate according to claim 1, wherein the obtaining of the label information of each key frame in the currently played video comprises:
acquiring an M3U8 file of the video; the M3U8 file comprises a download address of label information of each key frame;
and downloading the label information of each key frame in the currently played video according to the downloading address.
3. The code rate switching method according to claim 2, wherein the downloading, according to the download address, the tag information of each key frame in the currently played video specifically includes:
and when the first frame of the video is completely rendered, downloading the label information of each key frame in the currently played video according to the downloading address.
4. The code rate switching method according to any of claims 1 to 3, wherein the label information comprises: the index sequence number of each key frame, the sequence number of the TS segment where each key frame is located, the timestamp of each key frame, and the position offset of the TS segment where each key frame is located.
5. The code rate switching method according to claim 4, wherein the determining a target key frame according to the playing data of the current playing buffer and the label information of each key frame comprises:
determining the sequence number of the TS fragment currently played;
inquiring the key frame corresponding to the serial number of the currently played TS segment according to the label information of each key frame;
and determining a target key frame according to the playing data of the current playing buffer area and the inquired key frame.
6. The code rate switching method according to claim 5, wherein the determining a target key frame according to the playing data of the current playing buffer and the queried key frame comprises:
if no key frame is detected in the playing data of the current playing buffer area, selecting a key frame corresponding to a time stamp before the current time stamp as the target key frame according to the time stamp of the inquired key frame;
if detecting the relevant key frame in the playing data of the current playing buffer area, estimating the downloading time length required from the last key frame to the current playing position according to the current downloading rate, and estimating the playing time length required from the current playing position to the next key frame; the last key frame is a key frame corresponding to a timestamp before a current timestamp selected according to the timestamp of the queried key frame, and the next key frame is a key frame in the current playing buffer area;
if the downloading time length is less than the playing time length, determining the last key frame as the target key frame;
and if the downloading time length is greater than the playing time length, determining the next key frame as the target key frame.
7. The code rate switching method according to claim 4, wherein the performing code rate switching with the target key frame as a switching start position comprises:
inquiring the position offset of the TS segment where the target key frame is located;
downloading playing data corresponding to the switched code rate according to the inquired position offset; and determining the code rate after switching according to the triggering operation.
8. The code rate switching method of claim 4, wherein the label information further comprises: picture information of each of the key frames.
9. A client, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a code rate switching method as claimed in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the code rate switching method of any of claims 1 to 8.
CN201911209068.XA 2019-11-30 2019-11-30 Code rate switching method, client and computer readable storage medium Active CN110933517B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911209068.XA CN110933517B (en) 2019-11-30 2019-11-30 Code rate switching method, client and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911209068.XA CN110933517B (en) 2019-11-30 2019-11-30 Code rate switching method, client and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110933517A true CN110933517A (en) 2020-03-27
CN110933517B CN110933517B (en) 2022-04-29

Family

ID=69848407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911209068.XA Active CN110933517B (en) 2019-11-30 2019-11-30 Code rate switching method, client and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110933517B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111526387A (en) * 2020-03-30 2020-08-11 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN112165636A (en) * 2020-09-10 2021-01-01 东北大学 D2D network multimedia stream code rate adjusting method and multimedia stream real-time transmission system
CN112637661A (en) * 2020-12-22 2021-04-09 广州博冠信息科技有限公司 Video stream switching method and device, computer storage medium and electronic equipment
CN113438513A (en) * 2021-06-25 2021-09-24 深圳Tcl新技术有限公司 Video resolution switching method, device, equipment and storage medium
CN114125576A (en) * 2021-11-29 2022-03-01 广州繁星互娱信息科技有限公司 Multimedia resource synchronization method and device, storage medium and electronic equipment
CN114339291A (en) * 2021-12-31 2022-04-12 杭州当虹科技股份有限公司 Method for zooming and playing streaming media video
CN115002544A (en) * 2022-06-17 2022-09-02 中国电信股份有限公司 Video playing method and device, nonvolatile storage medium and electronic equipment
CN116150428A (en) * 2021-11-16 2023-05-23 腾讯科技(深圳)有限公司 Video tag acquisition method and device, electronic equipment and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778104A (en) * 2009-12-29 2010-07-14 常州中流电子科技有限公司 System and method for playing stream media by using self-adaption bandwidth
CN102256173A (en) * 2011-07-30 2011-11-23 冠捷显示科技(厦门)有限公司 PVR (Personal Video Record)-based television program playback marking method, playback mark using method and playback mark deletion method
CN102957672A (en) * 2011-08-25 2013-03-06 中国电信股份有限公司 Method, client side and system for self-adaptive playing of FLV (flash video) media streams
CN105979404A (en) * 2015-12-01 2016-09-28 乐视致新电子科技(天津)有限公司 Streaming media processing method and device
CN107071529A (en) * 2017-03-29 2017-08-18 咪咕视讯科技有限公司 A kind of HLS video broadcasting methods, terminal and server
CN107438202A (en) * 2016-05-26 2017-12-05 中兴通讯股份有限公司 A kind of method and device for realizing code check switching
CN108737862A (en) * 2018-05-23 2018-11-02 浙江大华技术股份有限公司 A kind of method and apparatus generating video code flow segment
CN109168078A (en) * 2018-09-10 2019-01-08 苏宁智能终端有限公司 A kind of video definition switching method and device
CN109862403A (en) * 2019-02-19 2019-06-07 未来电视有限公司 Self-adaption code rate switching method, device, electronic equipment and storage medium
US20190306220A1 (en) * 2018-03-28 2019-10-03 Netgear, Inc. System for Video Monitoring with Adaptive Bitrate to Sustain Image Quality
CN110446072A (en) * 2019-08-14 2019-11-12 咪咕视讯科技有限公司 Video stream switching method, electronic equipment and storage medium
CN110493324A (en) * 2019-07-29 2019-11-22 咪咕视讯科技有限公司 Method for down loading, downloader and computer readable storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101778104A (en) * 2009-12-29 2010-07-14 常州中流电子科技有限公司 System and method for playing stream media by using self-adaption bandwidth
CN102256173A (en) * 2011-07-30 2011-11-23 冠捷显示科技(厦门)有限公司 PVR (Personal Video Record)-based television program playback marking method, playback mark using method and playback mark deletion method
CN102957672A (en) * 2011-08-25 2013-03-06 中国电信股份有限公司 Method, client side and system for self-adaptive playing of FLV (flash video) media streams
CN105979404A (en) * 2015-12-01 2016-09-28 乐视致新电子科技(天津)有限公司 Streaming media processing method and device
CN107438202A (en) * 2016-05-26 2017-12-05 中兴通讯股份有限公司 A kind of method and device for realizing code check switching
CN107071529A (en) * 2017-03-29 2017-08-18 咪咕视讯科技有限公司 A kind of HLS video broadcasting methods, terminal and server
US20190306220A1 (en) * 2018-03-28 2019-10-03 Netgear, Inc. System for Video Monitoring with Adaptive Bitrate to Sustain Image Quality
CN108737862A (en) * 2018-05-23 2018-11-02 浙江大华技术股份有限公司 A kind of method and apparatus generating video code flow segment
CN109168078A (en) * 2018-09-10 2019-01-08 苏宁智能终端有限公司 A kind of video definition switching method and device
CN109862403A (en) * 2019-02-19 2019-06-07 未来电视有限公司 Self-adaption code rate switching method, device, electronic equipment and storage medium
CN110493324A (en) * 2019-07-29 2019-11-22 咪咕视讯科技有限公司 Method for down loading, downloader and computer readable storage medium
CN110446072A (en) * 2019-08-14 2019-11-12 咪咕视讯科技有限公司 Video stream switching method, electronic equipment and storage medium

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111526387A (en) * 2020-03-30 2020-08-11 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN111526387B (en) * 2020-03-30 2022-09-23 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN112165636A (en) * 2020-09-10 2021-01-01 东北大学 D2D network multimedia stream code rate adjusting method and multimedia stream real-time transmission system
CN112165636B (en) * 2020-09-10 2021-12-14 东北大学 D2D network multimedia stream code rate adjusting method and multimedia stream real-time transmission system
CN112637661A (en) * 2020-12-22 2021-04-09 广州博冠信息科技有限公司 Video stream switching method and device, computer storage medium and electronic equipment
CN112637661B (en) * 2020-12-22 2022-08-05 广州博冠信息科技有限公司 Video stream switching method and device, computer storage medium and electronic equipment
CN113438513A (en) * 2021-06-25 2021-09-24 深圳Tcl新技术有限公司 Video resolution switching method, device, equipment and storage medium
CN113438513B (en) * 2021-06-25 2023-05-02 深圳Tcl新技术有限公司 Video resolution switching method, device, equipment and storage medium
CN116150428A (en) * 2021-11-16 2023-05-23 腾讯科技(深圳)有限公司 Video tag acquisition method and device, electronic equipment and storage medium
CN114125576A (en) * 2021-11-29 2022-03-01 广州繁星互娱信息科技有限公司 Multimedia resource synchronization method and device, storage medium and electronic equipment
CN114339291A (en) * 2021-12-31 2022-04-12 杭州当虹科技股份有限公司 Method for zooming and playing streaming media video
CN115002544A (en) * 2022-06-17 2022-09-02 中国电信股份有限公司 Video playing method and device, nonvolatile storage medium and electronic equipment

Also Published As

Publication number Publication date
CN110933517B (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN110933517B (en) Code rate switching method, client and computer readable storage medium
EP2797287B1 (en) Method and apparatus for supporting time shift playback in adaptive HTTP streaming transmission solution
CN108063769B (en) Method and device for realizing content service and content distribution network node
US10110507B2 (en) Push-based transmission of resources and correlated network quality estimation
EP2493191B1 (en) Method, device and system for realizing hierarchically requesting content in http streaming system
US20160134900A1 (en) Streaming media processing method, apparatus, and system
CN108933764B (en) Method and device for realizing quick broadcast starting
EP3047627B1 (en) Dash representations adaptations in network
JP2016519895A (en) Media file reception and media file transmission method, apparatus, and system
CN113141522B (en) Resource transmission method, device, computer equipment and storage medium
WO2015120766A1 (en) Video optimisation system and method
WO2017202373A1 (en) Streaming media quick start method, device and system
CN107690093B (en) Video playing method and device
WO2016018572A1 (en) Systems and methods for selective transport accelerator operation
CN112243136B (en) Content playing method, video storage method and device
US20230269445A1 (en) Method of processing an error during the rendering of a digital content
CN112672227B (en) Service processing method, device, node and storage medium based on edge node
CN113438513B (en) Video resolution switching method, device, equipment and storage medium
CN115297095A (en) Return source processing method and device, computing equipment and storage medium
KR102611253B1 (en) Receiving devices, transmitting devices and data processing methods
TW201501526A (en) Method for providing a content part of a multimedia content to a client terminal, corresponding cache
KR102237900B1 (en) Method for retrieving, by a client terminal, a content part of a multimedia content
CN115834925A (en) Video transcoding method, device, equipment and 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