CN110213653A - A kind of method and device playing video - Google Patents
A kind of method and device playing video Download PDFInfo
- Publication number
- CN110213653A CN110213653A CN201910515996.2A CN201910515996A CN110213653A CN 110213653 A CN110213653 A CN 110213653A CN 201910515996 A CN201910515996 A CN 201910515996A CN 110213653 A CN110213653 A CN 110213653A
- Authority
- CN
- China
- Prior art keywords
- video
- file
- code rate
- mapping address
- video code
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 44
- 238000013507 mapping Methods 0.000 claims abstract description 122
- 238000004891 communication Methods 0.000 claims description 19
- 230000005540 biological transmission Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 7
- 238000005516 engineering process Methods 0.000 abstract description 2
- 239000003795 chemical substances by application Substances 0.000 description 46
- 230000008569 process Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 238000013500 data storage Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/238—Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/238—Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
- H04N21/23805—Controlling the feeding rate to the network, e.g. by controlling the video pump
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/25—Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
- H04N21/266—Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
- H04N21/2662—Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/438—Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving encoded video stream packets from an IP network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
- H04N21/440281—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream 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
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The embodiment of the present application provides a kind of method and device for playing video, is related to field of computer technology, method includes: to generate virtual m3u8 file when detecting player plays video.According to the first video mapping address in virtual m3u8 file, the corresponding first transport stream TS file of the first video mapping address is downloaded, the first video mapping address is the video mapping address of the first TS file in remote server.When the first TS file finishes, however, it is determined that the first video code rate is switched to the second video code rate, it is determined that the corresponding second video mapping address of the second video code rate.The corresponding 2nd TS file of the second video mapping address is downloaded, and the 2nd TS file is stored into virtual m3u8 file, so that player reads the 2nd TS file and played out from virtual m3u8 file.User experience switching at runtime video code rate, the smooth purpose for playing video of realization can be substantially increased when user watches video using the application.
Description
Technical field
This application involves field of computer technology, more particularly to a kind of method and device for playing video.
Background technique
Currently, user can install the application program for playing video in the terminal, application program can be mutual in connection
Video is played when networking online.Since network environment is bad, it is slack that electronic equipment is likely encountered broadcasting when playing video
Situation, therefore, electronic equipment can realize the smooth purpose for playing video by automatically adjusting video code rate.
In the prior art, m3u8 file is a kind of video file, can be used for storing several TS (Transport
Stream, transport stream) file download address, TS file be the file comprising video data, wherein in a m3u8 file
TS file is the TS file of same video code rate.Electronic equipment needs first to download the m3u8 of a certain code rate when playing video
Then file downloads TS file by the download address in m3u8 file again, then electronic equipment is broadcast according to video playing sequence
Corresponding TS file is put to play video.
However, when electronic equipment by the inclusion of the m3u8 file of TS file download address to play video when, it is every play one
Secondary video can only obtain a m3u8 file.Electronic equipment is during playing video, if necessary to Switch Video code rate, then
Electronic equipment must restart player to reacquire the corresponding m3u8 file of other code rates.Restarting player and is reacquiring
During m3u8 file, user can be appreciated that the video clip of black state, cause video playing not smooth.
Summary of the invention
The embodiment of the present application is designed to provide a kind of method and device for playing video, to improve user experience.Tool
Body technique scheme is as follows:
In a first aspect, providing a kind of method for playing video, the method is applied to electronic equipment, the method packet
It includes:
When detecting player plays video, virtual m3u8 file is generated;
According to the first video mapping address in the virtual m3u8 file, it is corresponding to download the first video mapping address
The first transport stream TS file, the first video mapping address is that the video of the first TS file in remote server reflects
Penetrate address;
When the first TS file finishes, however, it is determined that first video code rate is switched to second video
Code rate, it is determined that the corresponding second video mapping address of second video code rate;
The corresponding 2nd TS file of the second video mapping address is downloaded, and the 2nd TS file is stored to described
In virtual m3u8 file, so that the player reads the 2nd TS file and is broadcast from the virtual m3u8 file
It puts.
Optionally, described when detecting player plays video, generate virtual m3u8 file, comprising:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
Optionally, described if it is determined that first video code rate is switched to second video code rate, it is determined that it is described
The corresponding second video mapping address of second video code rate, comprising:
When the first TS file finishes, determine electronic equipment download the first TS file first it is average under
Carry speed;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average downloading speed is determined
Spend corresponding second video code rate;
If first video code rate and second video code rate be not identical, it is determined that second video code rate pair
The the second video mapping address answered.
Optionally, described if it is determined that first video code rate is switched to second video code rate, it is determined that it is described
The corresponding second video mapping address of second video code rate, comprising:
If it is determined that first video code rate is switched to second video code rate, then video is sent to remote server
The acquisition request of mapping address carries the text of second video code rate and preset 2nd TS file in the acquisition request
Part mark, so that the remote server according to second video code rate and the file identification, determines that the second video maps
Address;
Receive the second video mapping address that the remote server is sent.
Second aspect, provides a kind of device for playing video, and described device is applied to electronic equipment, described device packet
It includes:
Generation module, for when detecting player plays video, generating virtual m3u8 file;
First download module, for according to the first video mapping address in the virtual m3u8 file, downloading described the
The corresponding first transport stream TS file of one video mapping address, the first video mapping address are described in remote server
The video mapping address of first TS file;
Determining module, for when the first TS file finishes, however, it is determined that switch first video code rate
For second video code rate, it is determined that the corresponding second video mapping address of second video code rate;
Second download module, for downloading the corresponding 2nd TS file of the second video mapping address, and by described
Two TS files are stored into the virtual m3u8 file, so that the player reads described from the virtual m3u8 file
Two TS files simultaneously play out.
Optionally, the generation module, is specifically used for:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
Optionally, the determining module, is specifically used for:
When the first TS file finishes, determine electronic equipment download the first TS file first it is average under
Carry speed;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average downloading speed is determined
Spend corresponding second video code rate;
If first video code rate and second video code rate be not identical, it is determined that second video code rate pair
The the second video mapping address answered.
Optionally, the determining module, is specifically used for:
If it is determined that first video code rate is switched to second video code rate, then video is sent to remote server
The acquisition request of mapping address carries the text of second video code rate and preset 2nd TS file in the acquisition request
Part mark, so that the remote server according to second video code rate and the file identification, determines that the second video maps
Address;
Receive the second video mapping address that the remote server is sent.
The third aspect provides a kind of electronic equipment, including processor, communication interface, memory and communication bus,
In, processor, communication interface, memory completes mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes method and step described in first aspect.
Fourth aspect provides a kind of computer readable storage medium, is stored in the computer readable storage medium
Computer program realizes method and step described in first aspect when the computer program is executed by processor.
5th aspect, provides a kind of computer program product comprising instruction, when run on a computer, so that
Computer executes method described in above-mentioned first aspect.
A kind of method and device playing video provided by the embodiments of the present application, when acting on behalf of component detection to player plays
When video, virtual m3u8 file is generated.Agent components are according to the first video mapping address in the virtual m3u8 file, downloading
The corresponding first TS file of the first video mapping address, the first video mapping address are described in remote server
The video mapping address of first TS file.When the first TS file finishes, if Agent components are determined described first
Video code rate is switched to second video code rate, it is determined that the corresponding second video mapping address of second video code rate.
Agent components download the corresponding 2nd TS file of the second video mapping address, and the 2nd TS file are transmitted to described
In virtual m3u8 file, so that the player reads the 2nd TS file and is broadcast from the virtual m3u8 file
It puts.In this way, Agent components can generate a virtual m3u8 file and be supplied to player in player plays video, group is acted on behalf of
Part can determine and obtain different video code rate corresponding TS File Mapping address.Therefore it is different that switching may be implemented in Agent components
The file of video code rate reaches Switch Video code rate under the premise of not restarting player without reacquiring m3u8 file.With
Family when watching video, can smooth broadcasting video, substantially increase user experience.
Certainly, implement the application any product or method it is not absolutely required to and meanwhile reach all the above excellent
Point.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of method flow diagram for playing video provided by the embodiments of the present application;
Fig. 2 is a kind of method flow diagram for playing video provided by the embodiments of the present application;
Fig. 3 is a kind of structural schematic diagram of device for playing video provided by the embodiments of the present application;
Fig. 4 is the structural schematic diagram of a kind of electronic equipment provided by the embodiments of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
The embodiment of the present application provides a kind of method for playing video, and this method can be applied to Agent components, wherein generation
Managing component is the software module in electronic equipment, and player is the software module of the broadcasting video in electronic equipment.
It is detailed to a kind of method progress for playing video provided by the embodiments of the present application below in conjunction with specific embodiment
Explanation, as shown in Figure 1, the specific steps are as follows:
Step 101, when detecting player plays video, generate virtual m3u8 file.
Wherein, virtual m3u8 file is a kind of video file, can store several video mappings ground in virtual m3u8 file
Location, video mapping address can be certain video code rate with the download address of TS file in mapped Remote server, TS file
Several files comprising video data.In practical applications, a video may exist the TS file of multiple video code rates, each
There is the TS file of corresponding code rate in video code rate.The data bits of unit time transmission when video code rate is data transmission, often
It is kbps (kilobit is per second) with unit, the data bits transmitted in the unit time is bigger, and precision is higher, the video text dealt
Part is closer to original document.
Client for playing video can be installed, which can be in the embodiment of the present application, in electronic equipment
Including player and Agent components.User can select the video for wanting to play in client, and it is right that client then can receive
Should video play instruction, and the play instruction is transmitted to player, so that player is to receive the play instruction laggard
The processing of row video playing.At this point, Agent components can detecte player plays video, sends to obtain to remote server and preset
Video code rate file request, and obtain from remote server the video mapping ground of the TS file of a certain video code rate
Location, meanwhile, Agent components can create a file, and multiple video mapping address storage that remote server is obtained is so far
In file, virtual m3u8 file is formed.
Optionally, when detecting player plays video, the concrete processing procedure for the step of generating virtual m3u8 file
It can be with are as follows: when receiving the video playing request of player transmission, generate virtual m3u8 file.
It, can be to Agent components when player receives the broadcasting video instructions of client transmissions in the embodiment of the present application
Transmission plays video request.The purpose that player transmission plays video request is to obtain virtual m3u8 file.Work as Agent components
When receiving the request of player transmission, virtual m3u8 file can be generated, virtual m3u8 file includes preset multiple videos
Mapping address, each video mapping address can be the download address of the TS file in a remote server.Therefore, group is acted on behalf of
Part can download TS file by the video mapping address in virtual m3u8 file, and TS file is the file comprising video data,
One section of complete video can be formed by multiple TS files that the video mapping address in virtual m3u8 file is downloaded.Work as broadcasting
Device can play video after obtaining virtual m3u8 file.
Step 102, according to the first video mapping address in virtual m3u8 file, it is corresponding to download the first video mapping address
The first transport stream TS file.
Wherein, the first video mapping address is the video mapping address of the first TS file in remote server.
In the embodiment of the present application, after player obtains virtual m3u8 file, Agent components can be according to broadcasting TS file
Sequencing, determine the corresponding first video mapping address of the first TS file in virtual m3u8 file, and the first video is reflected
The first TS file download in the corresponding remote server in address is penetrated to locally.
Step 103, when the first TS file finishes, however, it is determined that the first video code rate is switched to the second video codes
Rate, it is determined that the corresponding second video mapping address of the second video code rate.
In the embodiment of the present application, when the first TS file finishes, Agent components can judge according to current network environment
Whether the video of player plays should switching code rate.The purpose judged is to be matched to be suitble to code rate as player according to network environment
TS file, reach player can smooth broadcasting video under the premise of, play the highest video of code rate.If Agent components are sentenced
Disconnected result is that the first video code rate is switched to the second video code rate, then Agent components can pass through Switch Video mapping address
First video code rate is switched to the second video code rate by mode.
Optionally, the process for judging whether switching code rate, can specifically include following steps:
Step 1: when the first TS file finishes, under determining that the first of electronic equipment the first TS file of downloading is average
Carry speed.
In the embodiment of the present application, when the first TS file finishes, Agent components can determine the number of the first TS file
According to the time of the first TS file of amount size and downloading, the ratio of the data volume Yu the time is calculated, obtains electronic equipment downloading
The average speed of download of first TS file.Average speed of download reacts current network environment, and Agent components can be average according to this
Speed of download judges whether switching code rate.
Step 2: determining the first average downloading speed according to the corresponding relationship of preset average speed of download and video code rate
Spend corresponding second video code rate.
In the embodiment of the present application, the corresponding relationship of average speed of download and video code rate are as follows: a speed of download section pair
Answer a video code rate.Agent components determine current speed of download section averagely where speed of download, and then according to preset
The corresponding relationship of average speed of download and video code rate, determines corresponding second video code rate in this speed of download section.
The embodiment of the present application provides a kind of example of averagely corresponding relationship of speed of download and video code rate, specific example
It may include: in this example, there are two kinds of code rates: 350Kbps (smooth code rate) and 800Kbps (high definition code rate).When acting on behalf of group
When the average speed of download that part determines is greater than smooth code rate and is less than high definition code rate, Agent components can be cut current video code rate
It is changed to smooth code rate, when the average speed of download that Agent components determine is greater than high definition code rate, Agent components can will work as forward sight
Frequency code rate is switched to high definition code rate.If the average speed of download that Agent components determine at this time is 560K/S (560Kbps is per second),
Current situation is that the average speed of download that Agent components determine is greater than smooth code rate and is less than high definition code rate, and Agent components can be with
Current video code rate is switched to smooth code rate.
Step 3: if the first video code rate and the second video code rate be not identical, it is determined that the second video code rate is corresponding
Second video mapping address.
In the embodiment of the present application, if the first video code rate and the second video code rate be not identical, Agent components are determined the
One video code rate is switched to the second video code rate.After first video code rate is switched to the second video code rate by Agent components determination,
The request for obtaining the 2nd TS file can be sent to remote server by acting on behalf of group, remote server upon receiving a request, by the
The corresponding second video mapping address of two video code rates is sent to Agent components.
Optionally, the process for obtaining the second video mapping address, can specifically include following steps:
Step 1: if it is determined that the first video code rate is switched to the second video code rate, then to remote server transmission video
The acquisition request of mapping address.
Wherein, the file identification that the second video code rate and preset 2nd TS file are carried in acquisition request, so that far
Journey server determines the second video mapping address according to the second video code rate and file identification.
In the embodiment of the present application, when Agent components determine, and the first video code rate is switched to the second video code rate, Xiang Yuan
Journey server the second video code rate of request corresponding 2nd TS file carries the second video code rate and pre- in acquisition request
If the 2nd TS file file identification.When remote server receives request, arrived according to the identification retrieval that Agent components provide
2nd TS file, and determine the second video mapping address of the 2nd TS file.
Step 2: receiving the second video mapping address that remote server is sent.
It, can be by after remote server determines the second video mapping address of the 2nd TS file in the embodiment of the present application
Second video mapping address of two TS files is sent to Agent components, and Agent components obtain the second video mapping of the 2nd TS file
Behind address, the 2nd TS file can be downloaded by the second video mapping address.
Step 104, the corresponding 2nd TS file of the second video mapping address of downloading, and the 2nd TS file is transmitted to virtually
In m3u8 file, so that player reads the 2nd TS file and is played out from virtual m3u8 file.
In the embodiment of the present application, after Agent components determine the second video mapping address, it can be reflected by the second video
It penetrates address and downloads the 2nd TS file, after Agent components download the 2nd TS file, player can be from virtual m3u8 file
It reads the 2nd TS file and plays.Therefore player meeting played in order TS file when playing video is played in the first TS file
After finishing, player can obtain most suitable 2nd TS file from virtual m3u8 file, to reach the mesh of smooth broadcasting
's.
As shown in Fig. 2, the embodiment of the present application provides a kind of specific example for playing video, specific steps may include:
As shown in Table 1, a kind of example of averagely corresponding relationship of speed of download and video code rate is provided for this example, this
Corresponding relationship is a kind of preset corresponding relationship, and Agent components can be that average speed of download matching is suitble to according to this preset relation
Code rate.
Table one
Code rate title | Code rate (bps) |
It is smooth | 350K |
High definition | 800K |
It is super clear | 1.5M |
Step 201, when detecting player plays video, generate virtual m3u8 file.
Step 202, according to the first video mapping address in virtual m3u8 file, it is corresponding to download the first video mapping address
The first TS file.
Step 203, when the first TS file finishes, obtain downloading the first TS file when the first average speed.
Step 204, according to preset corresponding relationship, judge the first average corresponding second video code rate of speed of download.If
First average speed of download is less than 800K/bps, thens follow the steps 205, if the first average speed of download is greater than 800K/bps and small
In 1.5M/bps, 206 are thened follow the steps, if the first average speed of download is greater than 1.5M, thens follow the steps 207.
Step 205 sends the smooth code rate mapping address request of acquisition to remote server.
Step 206 sends acquisition high definition code rate mapping address request to remote server.
Step 207 sends the super clear code rate mapping address request of acquisition to remote server.
Step 208 receives the second video mapping address that remote server is sent.
Step 209, the corresponding 2nd TS file of the second video mapping address of downloading, and the 2nd TS file is stored to virtual
In m3u8 file, so that player reads the 2nd TS file and is played out from virtual m3u8 file.
A kind of method and device playing video provided by the embodiments of the present application, when acting on behalf of component detection to player plays
When video, virtual m3u8 file is generated.Agent components are according to the first video mapping address in the virtual m3u8 file, downloading
The corresponding first TS file of the first video mapping address, the first video mapping address are described in remote server
The video mapping address of first TS file.When the first TS file finishes, if Agent components are determined described first
Video code rate is switched to second video code rate, it is determined that the corresponding second video mapping address of second video code rate.
Agent components download the corresponding 2nd TS file of the second video mapping address, and the 2nd TS file are transmitted to described
In virtual m3u8 file, so that the player reads the 2nd TS file and is broadcast from the virtual m3u8 file
It puts.In this way, Agent components can generate virtual m3u8 file and be supplied to player, and Agent components can in player plays video
To determine and downloading different video code rate corresponding TS File Mapping address.Therefore switching different video may be implemented in Agent components
The file of code rate reaches Switch Video code rate under the premise of not restarting player without reacquiring m3u8 file.User exists
Watch video when, can smooth broadcasting video, substantially increase user experience.
Based on the same technical idea, the embodiment of the present application also provides a kind of devices for playing video, as shown in figure 3,
The device includes:
Generation module 301, for when detecting player plays video, generating virtual m3u8 file;
First download module 302, for according to the first video mapping address in the virtual m3u8 file, described in downloading
The corresponding first transport stream TS file of first video mapping address, the first video mapping address are the institute in remote server
State the video mapping address of the first TS file;
Determining module 303, for when the first TS file finishes, however, it is determined that cut first video code rate
It is changed to second video code rate, it is determined that the corresponding second video mapping address of second video code rate;
Second download module 304, for downloading the corresponding 2nd TS file of the second video mapping address, and will be described
2nd TS file is stored into the virtual m3u8 file, so that described in the player reads from the virtual m3u8 file
2nd TS file simultaneously plays out.
Optionally, the generation module 301, is specifically used for:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
Optionally, the determining module 303, is specifically used for:
When the first TS file finishes, determine electronic equipment download the first TS file first it is average under
Carry speed;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average downloading speed is determined
Spend corresponding second video code rate;
If first video code rate and second video code rate be not identical, it is determined that second video code rate pair
The the second video mapping address answered.
Optionally, the determining module 303, is specifically used for:
If it is determined that first video code rate is switched to second video code rate, then video is sent to remote server
The acquisition request of mapping address carries the text of second video code rate and preset 2nd TS file in the acquisition request
Part mark, so that the remote server according to second video code rate and the file identification, determines that the second video maps
Address;
Receive the second video mapping address that the remote server is sent.
A kind of method and device playing video provided by the embodiments of the present application, when acting on behalf of component detection to player plays
When video, virtual m3u8 file is generated.Agent components are according to the first video mapping address in the virtual m3u8 file, downloading
The corresponding first TS file of the first video mapping address, the first video mapping address are described in remote server
The video mapping address of first TS file.When the first TS file finishes, if Agent components are determined described first
Video code rate is switched to second video code rate, it is determined that the corresponding second video mapping address of second video code rate.
Agent components download the corresponding 2nd TS file of the second video mapping address, and the 2nd TS file are transmitted to described
In virtual m3u8 file, so that the player reads the 2nd TS file and is broadcast from the virtual m3u8 file
It puts.In this way, Agent components can generate virtual m3u8 file and be supplied to player, and Agent components can in player plays video
To determine and downloading different video code rate corresponding TS File Mapping address.Therefore switching different video may be implemented in Agent components
The file of code rate reaches Switch Video code rate under the premise of not restarting player without reacquiring m3u8 file.User exists
Watch video when, can smooth broadcasting video, substantially increase user experience.
The embodiment of the present application also provides a kind of electronic equipment, as shown in figure 4, include processor 401, communication interface 402,
Memory 403 and communication bus 404, wherein processor 401, communication interface 402, memory 403 are complete by communication bus 404
At mutual communication,
Memory 403, for storing computer program;
Processor 401 when for executing the program stored on memory 403, realizes following steps:
When detecting player plays video, virtual m3u8 file is generated;
According to the first video mapping address in the virtual m3u8 file, it is corresponding to download the first video mapping address
The first transport stream TS file, the first video mapping address is the downloading of the first TS file in remote server
The corresponding video mapping address in location;
When the first TS file finishes, however, it is determined that first video code rate is switched to second video
Code rate, it is determined that the corresponding second video mapping address of second video code rate;
The corresponding 2nd TS file of the second video mapping address is downloaded, and the 2nd TS file is stored to described
In virtual m3u8 file, so that the player reads the 2nd TS file and is broadcast from the virtual m3u8 file
It puts.
Optionally, described when detecting player plays video, generate virtual m3u8 file, comprising:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
Optionally, described if it is determined that first video code rate is switched to second video code rate, it is determined that it is described
The corresponding second video mapping address of second video code rate, comprising:
When the first TS file finishes, determine electronic equipment download the first TS file first it is average under
Carry speed;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average downloading speed is determined
Spend corresponding second video code rate;
If first video code rate and second video code rate be not identical, it is determined that second video code rate pair
The the second video mapping address answered.
Optionally, described if it is determined that first video code rate is switched to second video code rate, it is determined that it is described
The corresponding second video mapping address of second video code rate, comprising:
If it is determined that first video code rate is switched to second video code rate, then video is sent to remote server
The acquisition request of mapping address carries the text of second video code rate and preset 2nd TS file in the acquisition request
Part mark, so that the remote server according to second video code rate and the file identification, determines that the second video maps
Address;
Receive the second video mapping address that the remote server is sent.
The communication bus that the above-mentioned network equipment is mentioned can be Peripheral Component Interconnect standard (English: Peripheral
Component Interconnect, referred to as: PCI) bus or expanding the industrial standard structure (English: Extended Industry
Standard Architecture, referred to as: EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control
Bus processed etc..Only to be indicated with a thick line in figure convenient for indicating, it is not intended that an only bus or a type of total
Line.
Communication interface is for the communication between the above-mentioned network equipment and other equipment.
Memory may include random access memory (English: Random Access Memory, abbreviation: RAM), can also
To include nonvolatile memory (English: Non-Volatile Memory, abbreviation: NVM), for example, at least a disk storage
Device.Optionally, memory can also be that at least one is located remotely from the storage device of aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (English: Central Processing
Unit, referred to as: CPU), network processing unit (English: Network Processor, referred to as: NP) etc.;It can also be digital signal
Processor (English: Digital Signal Processing, abbreviation: DSP), specific integrated circuit (English: Application
Specific Integrated Circuit, referred to as: ASIC), field programmable gate array (English: Field-
Programmable Gate Array, referred to as: FPGA) either other programmable logic device, discrete gate or transistor logic
Device, discrete hardware components.
Based on the same technical idea, the embodiment of the present application also provides a kind of computer readable storage medium, the meters
Computer program is stored in calculation machine readable storage medium storing program for executing, the computer program realizes above-mentioned broadcasting view when being executed by processor
The method and step of frequency.
Based on the same technical idea, the embodiment of the present application also provides a kind of computer program product comprising instruction,
When run on a computer, so that computer executes the method and step of above-mentioned broadcasting video.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present application.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
Solid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely the preferred embodiments of the application, are not intended to limit the protection scope of the application.It is all
Any modification, equivalent replacement, improvement and so within spirit herein and principle are all contained in the protection scope of the application
It is interior.
Claims (10)
1. a kind of method for playing video, which is characterized in that the method is applied to the Agent components in videoconference client, described
Videoconference client further includes player, which comprises
When detecting player plays video, virtual m3u8 file is generated;
According to the first video mapping address in the virtual m3u8 file, the first video mapping address corresponding the is downloaded
One transport stream TS file, the first video mapping address are that the video of the first TS file in remote server maps ground
Location;
When the first TS file finishes, however, it is determined that first video code rate is switched to second video codes
Rate, it is determined that the corresponding second video mapping address of second video code rate;
The corresponding 2nd TS file of the second video mapping address is downloaded, and the 2nd TS file is stored to described virtual
In m3u8 file, so that the player reads the 2nd TS file and is played out from the virtual m3u8 file.
2. generation is empty the method according to claim 1, wherein described when detecting player plays video
Quasi- m3u8 file, comprising:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
3. the method according to claim 1, wherein described if it is determined that first video code rate is switched to institute
State the second video code rate, it is determined that the corresponding second video mapping address of second video code rate, comprising:
When the first TS file finishes, determine that electronic equipment downloads the first average downloading speed of the first TS file
Degree;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average speed of download pair is determined
The second video code rate answered;
If first video code rate and second video code rate be not identical, it is determined that second video code rate is corresponding
Second video mapping address.
4. the method according to claim 1, wherein described if it is determined that first video code rate is switched to institute
State the second video code rate, it is determined that the corresponding second video mapping address of second video code rate, comprising:
If it is determined that first video code rate is switched to second video code rate, then video mapping is sent to remote server
The acquisition request of address carries the files-designated of second video code rate and preset 2nd TS file in the acquisition request
Know, so that the remote server determines the second video mapping address according to second video code rate and the file identification;
Receive the second video mapping address that the remote server is sent.
5. a kind of device for playing video, which is characterized in that described device is applied to the Agent components in videoconference client, described
Videoconference client further includes player, and described device includes:
Generation module, for when detecting player plays video, generating virtual m3u8 file;
First download module, for downloading first view according to the first video mapping address in the virtual m3u8 file
The corresponding first transport stream TS file of frequency mapping address, the first video mapping address are described first in remote server
The video mapping address of TS file;
Determining module, for when the first TS file finishes, however, it is determined that first video code rate is switched to institute
State the second video code rate, it is determined that the corresponding second video mapping address of second video code rate;
Second download module, for downloading the corresponding 2nd TS file of the second video mapping address, and by the 2nd TS
File is stored into the virtual m3u8 file, so that the player reads the 2nd TS from the virtual m3u8 file
File simultaneously plays out.
6. device according to claim 5, which is characterized in that the generation module is specifically used for:
When receiving the video playing request of the player transmission, virtual m3u8 file is generated.
7. device according to claim 5, which is characterized in that the determining module is specifically used for:
When the first TS file finishes, determine that electronic equipment downloads the first average downloading speed of the first TS file
Degree;
According to the corresponding relationship of the preset average speed of download and video code rate, the described first average speed of download pair is determined
The second video code rate answered;
If first video code rate and second video code rate be not identical, it is determined that second video code rate is corresponding
Second video mapping address.
8. device according to claim 5, which is characterized in that the determining module is specifically used for:
If it is determined that first video code rate is switched to second video code rate, then video mapping is sent to remote server
The acquisition request of address carries the files-designated of second video code rate and preset 2nd TS file in the acquisition request
Know, so that the remote server determines the second video mapping address according to second video code rate and the file identification;
Receive the second video mapping address that the remote server is sent.
9. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 1-4.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium
Program realizes claim 1-4 any method and step when the computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910515996.2A CN110213653B (en) | 2019-06-14 | 2019-06-14 | Method and device for playing video |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910515996.2A CN110213653B (en) | 2019-06-14 | 2019-06-14 | Method and device for playing video |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110213653A true CN110213653A (en) | 2019-09-06 |
CN110213653B CN110213653B (en) | 2022-03-04 |
Family
ID=67792868
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910515996.2A Active CN110213653B (en) | 2019-06-14 | 2019-06-14 | Method and device for playing video |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110213653B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110677727A (en) * | 2019-09-10 | 2020-01-10 | 北京奇艺世纪科技有限公司 | Audio and video playing method and device, electronic equipment and storage medium |
CN111417031A (en) * | 2020-04-28 | 2020-07-14 | 北京金山云网络技术有限公司 | File transmission method and device and electronic equipment |
CN112887786A (en) * | 2019-11-29 | 2021-06-01 | 腾讯科技(深圳)有限公司 | Video playing method and device and computer readable medium |
CN114189715A (en) * | 2021-12-07 | 2022-03-15 | 北京奇艺世纪科技有限公司 | Download address switching method and related equipment |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410901A (en) * | 2014-11-18 | 2015-03-11 | 上海天脉聚源文化传媒有限公司 | Play method and play device of M3U8 format live stream |
CN104519372A (en) * | 2014-12-19 | 2015-04-15 | 深圳市九洲电器有限公司 | Switching method and switching system for streaming media playing |
CN104581207A (en) * | 2014-12-23 | 2015-04-29 | 乐视致新电子科技(天津)有限公司 | Online video playing method and system as well as play application proxy equipment |
CN104602032A (en) * | 2015-01-13 | 2015-05-06 | 乐视致新电子科技(天津)有限公司 | Video playing processing method, playing application proxy device and playing server |
CN105306966A (en) * | 2014-07-30 | 2016-02-03 | 深圳国微技术有限公司 | Live video data processing method, live video data processing device and live video data processing system |
CN105578201A (en) * | 2015-12-23 | 2016-05-11 | 武汉市烽视威科技有限公司 | System and method for implementing dynamic adjustment of HLS live bit rate number |
CN105898408A (en) * | 2016-04-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Video play method and device |
CN106658226A (en) * | 2015-10-28 | 2017-05-10 | 中兴通讯股份有限公司 | Play method and apparatus |
CN106686036A (en) * | 2015-11-10 | 2017-05-17 | 中兴通讯股份有限公司 | Multimedia data downloading method and system, client and server |
US20170164020A1 (en) * | 2015-12-08 | 2017-06-08 | Le Holdings (Beijing) Co., Ltd. | Content delivery method for content delivery network platform and scheduling proxy server |
WO2017096830A1 (en) * | 2015-12-08 | 2017-06-15 | 乐视控股(北京)有限公司 | Content delivery method and scheduling proxy server for cdn platform |
-
2019
- 2019-06-14 CN CN201910515996.2A patent/CN110213653B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105306966A (en) * | 2014-07-30 | 2016-02-03 | 深圳国微技术有限公司 | Live video data processing method, live video data processing device and live video data processing system |
CN104410901A (en) * | 2014-11-18 | 2015-03-11 | 上海天脉聚源文化传媒有限公司 | Play method and play device of M3U8 format live stream |
CN104519372A (en) * | 2014-12-19 | 2015-04-15 | 深圳市九洲电器有限公司 | Switching method and switching system for streaming media playing |
CN104581207A (en) * | 2014-12-23 | 2015-04-29 | 乐视致新电子科技(天津)有限公司 | Online video playing method and system as well as play application proxy equipment |
CN104602032A (en) * | 2015-01-13 | 2015-05-06 | 乐视致新电子科技(天津)有限公司 | Video playing processing method, playing application proxy device and playing server |
CN106658226A (en) * | 2015-10-28 | 2017-05-10 | 中兴通讯股份有限公司 | Play method and apparatus |
CN106686036A (en) * | 2015-11-10 | 2017-05-17 | 中兴通讯股份有限公司 | Multimedia data downloading method and system, client and server |
US20170164020A1 (en) * | 2015-12-08 | 2017-06-08 | Le Holdings (Beijing) Co., Ltd. | Content delivery method for content delivery network platform and scheduling proxy server |
WO2017096830A1 (en) * | 2015-12-08 | 2017-06-15 | 乐视控股(北京)有限公司 | Content delivery method and scheduling proxy server for cdn platform |
CN105578201A (en) * | 2015-12-23 | 2016-05-11 | 武汉市烽视威科技有限公司 | System and method for implementing dynamic adjustment of HLS live bit rate number |
CN105898408A (en) * | 2016-04-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Video play method and device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110677727A (en) * | 2019-09-10 | 2020-01-10 | 北京奇艺世纪科技有限公司 | Audio and video playing method and device, electronic equipment and storage medium |
CN112887786A (en) * | 2019-11-29 | 2021-06-01 | 腾讯科技(深圳)有限公司 | Video playing method and device and computer readable medium |
CN111417031A (en) * | 2020-04-28 | 2020-07-14 | 北京金山云网络技术有限公司 | File transmission method and device and electronic equipment |
CN114189715A (en) * | 2021-12-07 | 2022-03-15 | 北京奇艺世纪科技有限公司 | Download address switching method and related equipment |
Also Published As
Publication number | Publication date |
---|---|
CN110213653B (en) | 2022-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110213653A (en) | A kind of method and device playing video | |
KR101137173B1 (en) | Systems and methods for targeted advertising on wireless devices based on device location and current user interests | |
CN107872353A (en) | A kind of Fault Locating Method and device | |
CN110225417A (en) | Data processing method and server, the method and server that detect Caton | |
US8892608B2 (en) | Highly reliable cross-session web application instrumentation | |
CN105477857A (en) | Gamepad adapting method, device and system | |
CN103327121A (en) | P2P (Peer-to-Peer Network) network resource transmission method and device for same | |
CN103634687A (en) | Method and system of providing video retrieval results in intelligent television | |
CN110022259B (en) | Message arrival rate determining method and device, data statistics server and storage medium | |
CN110247986A (en) | A kind of document transmission method, device and electronic equipment | |
CN109379445A (en) | A kind of sending method and device of PUSH message | |
CN108632675A (en) | A kind of direct playing and playback method, apparatus and equipment | |
CN108156257B (en) | Information pushing method and device | |
CN108235075B (en) | Video quality grade matching method, computer readable storage medium and terminal | |
CN107454454A (en) | Method for information display and device | |
CN105701168B (en) | Data storage method and device and electronic equipment | |
US20110312425A1 (en) | Video game system | |
CN110213671B (en) | Hotspot short video determination method and device | |
CN109446445A (en) | A kind of resource acquiring method and device | |
CN104025086A (en) | Triggering social pages | |
CN109788326B (en) | Video resource pre-pushing method, device and system | |
CN101448136B (en) | Method for realizing video on-demand function and system thereof | |
CN113849125B (en) | CDN server disk reading method, device and system | |
CN109842661A (en) | A kind of data transmission method, device, electronic equipment and storage medium | |
CN101437028A (en) | Method, system and apparatus for generating multiple addresses |
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 |