CN110677727B - Audio and video playing method and device, electronic equipment and storage medium - Google Patents
Audio and video playing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110677727B CN110677727B CN201910858157.0A CN201910858157A CN110677727B CN 110677727 B CN110677727 B CN 110677727B CN 201910858157 A CN201910858157 A CN 201910858157A CN 110677727 B CN110677727 B CN 110677727B
- Authority
- CN
- China
- Prior art keywords
- slice
- audio
- video
- resolution
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 230000008859 change Effects 0.000 claims abstract description 40
- 230000015654 memory Effects 0.000 claims description 33
- 230000004044 response Effects 0.000 claims description 9
- 238000012544 monitoring process Methods 0.000 claims description 5
- 238000010276 construction Methods 0.000 claims description 4
- 230000000694 effects Effects 0.000 abstract description 8
- 230000008569 process Effects 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000013507 mapping Methods 0.000 description 2
- PEDCQBHIVMGVHV-UHFFFAOYSA-N Glycerine Chemical compound OCC(O)CO PEDCQBHIVMGVHV-UHFFFAOYSA-N 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
-
- 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
-
- 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/45—Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
- H04N21/458—Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations
- H04N21/4586—Content update operation triggered locally, e.g. by comparing the version of software modules in a DVB carousel to the version stored locally
-
- 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/45—Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
- H04N21/462—Content or additional data management, e.g. creating a master electronic program guide from data received from the Internet and a Head-end, controlling the complexity of a video stream by scaling the resolution or bit-rate based on the client capabilities
- H04N21/4621—Controlling the complexity of the content stream or additional data, e.g. lowering the resolution or bit-rate of the video stream for a mobile client with a small screen
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 invention relates to an audio and video playing method, an audio and video playing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; the resolution ratio can be automatically switched according to the network state, and the server does not need to be requested for slice addresses with different resolution ratios again, so that a system player does not need to be restarted when the resolution ratio is required to be switched in the audio and video playing process, the current playing interface is prevented from generating a black screen, the effect of smooth playing is achieved, and the experience of watching the audio and video by a user is improved.
Description
Technical Field
The embodiment of the invention relates to the field of audio and video processing, in particular to an audio and video playing method and device, electronic equipment and a storage medium.
Background
The dynamic bitrate adaptive technology (HTTP Live Streaming, HLS) is a hypertext transfer protocol (HTTP) -based media Streaming protocol implemented by Apple inc, which achieves the effect of appearing to play a stream by cutting the entire stream into small HTTP-downloadable media files, then providing a matching media list file, and providing the media list file to the client, and having the client pull the media files sequentially for playing. The HLS protocol is mainly used for data transmission of an M3U file (M3U8) format file in UTF-8 encoding format, and addresses of the M3U8 format file are usually stored in lists, such as a Media Playlist (Media Playlist) and a Master Playlist (Master Playlist), wherein the former supports a single bitrate, and the latter supports multiple bitrates. The Master Playlist is a so-called nested M3U8, which does not contain slice-related information and can describe different independent M3U8 files of the same source under different bandwidths.
When the audio/video APP is used, if a system player (MediaPlayer) is used for playing videos, a user is prompted to switch the resolution when the network is jammed. When the resolution is switched, the player is restarted to blank the screen for several seconds, and the recovered picture is often not consistent with the picture during switching, so that the user experience is influenced.
Disclosure of Invention
In view of this, to solve the above technical problems or some technical problems, embodiments of the present invention provide an audio and video playing method, an apparatus, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present invention provides an audio and video playing method, including:
acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request;
constructing an M3U8 playlist according to the slice address;
matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state;
and acquiring a slice corresponding to the target address to play the audio and video.
In one possible implementation, the constructing the M3U8 playlist according to the slice address includes:
determining code rate information corresponding to the slices with different resolutions;
correlating the code rate information with a resolution corresponding to the slice;
associating resolution information with the corresponding slice address;
and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
In a possible implementation manner, the matching, according to the change information of the network status, target information of a corresponding slice from the M3U8 playlist in real time includes:
monitoring the current network state, and determining the changed information sent by the network state;
matching a corresponding target resolution from the M3U8 playlist according to the change information;
and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
In a possible implementation manner, the obtaining of the slice corresponding to the target address to play the audio/video includes:
sending a slice acquisition request to a server, wherein the slice acquisition request carries the target address;
receiving the slice of the target resolution returned by the server in response to the slice acquisition request;
and playing the audio and video according to the slice with the target resolution.
In a second aspect, an embodiment of the present invention provides an audio/video playing apparatus, including:
the acquisition module is used for acquiring the slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request;
a construction module, configured to construct an M3U8 playlist according to the slice address;
the matching module is used for matching the target address of the corresponding slice from the M3U8 playlist in real time according to the change information of the network state;
and the playing module is used for acquiring the slices corresponding to the target addresses and playing the audio and video.
In a possible implementation manner, the building module is specifically configured to determine code rate information corresponding to the slices with different resolutions; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
In a possible implementation manner, the matching module is specifically configured to monitor a current network state, and determine that the network state sends changed information after the change; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
In a possible implementation manner, the playing module is specifically configured to send a slice acquisition request to a server, where the slice acquisition request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
In a third aspect, an embodiment of the present invention provides an electronic device, including: the processor is configured to execute an audio/video playing program stored in the memory, and the audio/video playing method according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where the storage medium stores one or more programs, and the one or more programs are executable by one or more processors, and the method for playing back an audio/video file according to any one of the above first aspects is described.
According to the audio and video playing scheme, slice addresses with multiple resolutions of the audio and video are obtained according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; the resolution ratio can be automatically switched according to the network state, and the server does not need to be requested for slice addresses with different resolution ratios again, so that a system player does not need to be restarted when the resolution ratio is required to be switched in the audio and video playing process, the current playing interface is prevented from generating a black screen, the effect of smooth playing is achieved, and the experience of watching the audio and video by a user is improved.
Drawings
Fig. 1 is an application scene diagram of an audio/video playing method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of an audio/video playing method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another audio/video playing method according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a mapping relationship between multi-resolution code stream data and corresponding code rates according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating the association between resolution information and slice addresses according to an embodiment of the present invention;
fig. 6 is a schematic flowchart of another audio/video playing method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an audio/video playing device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
For the convenience of understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Fig. 1 is an application scenario diagram of an audio/video playing method provided by an embodiment of the present invention, as shown in fig. 1, specifically including:
the audio and video playing method provided by the embodiment is applied to audio and video on demand, for example, a user carries out audio and video on demand through an intelligent television, the intelligent television is connected with a network through a network television box, the intelligent television receives an audio and video on demand instruction input by the user, the intelligent television obtains code stream data corresponding to the audio and video on demand request from a server through the network television box, and a local system player is used for playing the code stream data.
The server stores code stream data corresponding to different resolutions, the code stream data can be presented in a slice (TS) form, and the network television box or the player of the smart television supports HLS MasterPlaylist.
The audio and video playing method of the present application will be described in detail below with the network television box as an execution subject.
Fig. 2 is a schematic flow diagram of an audio and video playing method provided in an embodiment of the present invention, and as shown in fig. 2, the method specifically includes:
and S21, acquiring the slice addresses with multiple resolutions of the audio and video according to the audio and video on demand request.
According to the audio and video playing method provided by the embodiment, when a user inputs an audio and video on demand request to the smart television, a plurality of slice addresses with a plurality of resolutions of audio and video to be requested are requested to be acquired from the server through the network television box based on the audio and video on demand request.
It should be noted that, in this embodiment, when an audio/video is published, an audio/video file with multiple resolutions is published at the same time, the audio/video file with each resolution is divided into multiple slices, the slices are stored in the server, and an audio/video name is used as an identifier, and all resolutions corresponding to the identifier and a slice address of each resolution slice are recorded.
Specifically, according to the identifier of the audio and video in the audio and video on demand request, the identifier is queried to obtain a plurality of resolution information corresponding to the audio and video and the slice address of each resolution slice.
For example, the audio/video on demand request input by the user is: playing moon MI biography 20 th set, wherein the resolution corresponding to the episode is as follows: standard, High, 720p, 1080p, 2k and 4 k; the slice address corresponding to the episode resolution Standard, …, and the slice address corresponding to the episode resolution 4k are obtained.
S22, constructing the M3U8 playlist according to the slice address.
An M3U8 playlist is constructed from slice addresses of multiple resolutions, e.g., episode slices of different resolutions are contained in the M3U8 playlist.
And S23, matching the target address of the corresponding slice from the M3U8 playlist in real time according to the change information of the network state.
The network television box monitors the network state in real time, determines the change information of the network state when the network state changes, queries the M3U8 playlist according to the change information, and matches the target address of the slice matched with the changed network state from the M3U8 playlist, wherein the change information can be the network information after the network state changes.
For example, when the episode is played for 15min, the network tv box monitors that the network status changes, the download speed of the network decreases from 2M/s to 1M/s (the corresponding change information is that the download speed of the network is 1M/s), the network tv box switches the resolution from 1080p to 720p by querying the M3U8 playlist, and the resolution of the next slice downloaded by the network tv box is 720 p.
And S24, acquiring the slice corresponding to the target address to play the audio and video.
And the network television box acquires the slice corresponding to the target address from the server according to the target address, downloads and caches the slice, and decodes and plays the cached slice.
For example, when the episode is played for 15min, the network tv box monitors that the network state changes, the resolution of the currently played slice is 1080p, the resolution of the downloaded next slice is 720p, and after the playing of the slice with the resolution of 1080p is completed, the network tv box automatically switches to the resolution of 720p for playing.
According to the audio and video playing method, slice addresses of multiple resolutions of the audio and video are obtained according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; the resolution ratio can be automatically switched according to the network state, and the server does not need to be requested for slice addresses with different resolution ratios again, so that a system player does not need to be restarted when the resolution ratio is required to be switched in the audio and video playing process, the current playing interface is prevented from generating a black screen, the effect of smooth playing is achieved, and the experience of watching the audio and video by a user is improved.
Fig. 3 is a schematic flow diagram of another audio and video playing method provided in the embodiment of the present invention, and as shown in fig. 3, the method specifically includes:
and S31, acquiring the slice addresses with multiple resolutions of the audio and video according to the audio and video on demand request.
A user inputs an audio and video on demand request to the smart television, and when the smart television executes an audio and video on demand task based on the audio and video on demand request, the smart television requests the server to acquire a plurality of resolution slice addresses of audio and video to be on demand through the network television box.
Compared with the scheme that the conventional network television box can only determine one resolution according to the network state of the current network on the premise of not restarting the local player and acquire the slice address corresponding to the resolution, the resolution of the played slice can be adaptively adjusted according to the network state without restarting the local player.
Furthermore, the slices with multiple resolutions comprise slices with all resolutions corresponding to the audio and video stored on the server, and in order to ensure that no error occurs in the connection of the slices with different resolutions, when the code stream data corresponding to the audio and video is sliced, the slicing rules of the code stream data with different resolutions are consistent, and the positions of the key frames (I frames) of the slices corresponding to the different resolutions are consistent.
And S32, determining code rate information corresponding to the slices with different resolutions.
And S33, associating the code rate information with the resolution corresponding to the slice.
In the embodiment of the invention, before the audio and video slices are stored in front of a server, the code stream data with different resolutions are preset for definition, the code rate (bps) corresponding to the code stream data with each resolution is determined, the code stream data with each resolution is associated with the code rate corresponding to the code stream data with each resolution, and finally, a mapping relation table (refer to fig. 4) for the code stream data with multiple resolutions and the corresponding code rate is generated.
It should be noted that fig. 4 is only an illustration of customization, and may also be set according to specific actual requirements (a network state, a transmission rate of a data transmission interface, and the like), and this embodiment is not limited in particular.
And S34, associating the resolution information with the corresponding slice address.
After associating the bitrate information with the resolution, the slice address of the resolution corresponding to the resolution information is associated, specifically, the address of the M3U file in the UTF-8 encoding format corresponding to each bitrate is determined (see fig. 5).
S35, constructing an M3U8 playlist according to the incidence relation between the code rate information and the resolution and the incidence relation between the resolution information and the slice address.
And taking the association relationship between the code rate information and the resolution as a primary index, taking the association relationship between the resolution information and the slice address as a secondary index, associating the primary index and the secondary index through the resolution information, constructing an M3U8 playlist based on the primary index and the secondary index, and storing the constructed M3U8 playlist in the network television box.
In an alternative of the embodiment of the present invention, the multiple resolutions may be all resolutions or parts of all resolutions, and specifically, the corresponding bitrate range may be determined according to the network state, and then the resolution range is determined by the bitrate range.
Further, a code rate range and a resolution range are determined according to the historical network state, for example, the current network is 100M ray, the historical wire speed is 9M/s at the highest, the historical wire speed is 2M/s at the lowest, and the corresponding code rate range is determined to be 1.5M-8M according to 2M/s-9M/s, so that the corresponding multiple resolutions are 720p, 1080p, 2k and 4k (the determination rule is the maximum resolution which can be achieved when the wire speed is the lowest).
By means of judging the code rate range, the selection range of the resolution and the slice address can be reduced, the complexity of constructing an M3U8 playlist can be reduced, the efficiency of constructing an M3U8 playlist is improved, and the starting time of the audio and video is shortened.
And S36, monitoring the current network state, and determining the changed information sent by the network state.
The network television box monitors the current network state in real time, determines the network state of the current network based on the audio and video on demand request, inquires a primary index from a locally stored M3U8 playlist based on the network state to determine a corresponding code rate, inquires a secondary index based on the code rate to determine a slice address corresponding to the code rate, and accesses the slice address to perform slice downloading from a server and stores the slice address in a cache.
Judging whether the network state changes, if the network state changes, determining the change information of the network state, where the change information may be current network state information after the network state changes, or may also be difference information of the network state changes, for example, when the current network state is 20:00, the corresponding network speed is reduced from 8M/s to 6M/s, and the change information may be: the network speed of the current network is 6M/s, and can also be: the network speed is reduced by 2M/s.
And S37, matching out the corresponding target resolution from the M3U8 playlist according to the change information.
And inquiring a primary index from the M3U8 playlist according to the change information, determining a code rate (or code rate range, for example, the code rate range in which the network speed of 6M/s falls is 4M-8M) corresponding to the change information, and determining a corresponding target resolution according to the code rate (or code rate range).
For example, the variation information is 6M/s, the M3U8 playlist queries the primary index, and determines that the corresponding bitrate range is 4M-8M, so that the target resolution corresponding to the variation information is 2 k.
And S38, matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
And querying a secondary index from the M3U8 playlist according to the target resolution, and determining the address of the target corresponding to the target resolution slice.
In an alternative embodiment of the present invention, the contiguous download of slices of different resolutions is determined based on the identity of each slice.
For example, the network speed corresponding to the previous network state at 20:00 is reduced from 8M/s to 6M/s, and it is assumed that the slice corresponding to the playing at 20:00 is identified as 056, so that it can be known that the slice identified as 057 needs to change the resolution, the resolution corresponding to the slice identified as 057 is determined as 2k according to the change information, the secondary index is inquired from the M3U8 playlist, and the target address corresponding to the slice identified as 057 with the resolution of 2k is determined.
S39, sending a slice acquisition request to a server, wherein the slice acquisition request carries the target address.
And generating a slice acquisition request for accessing the target address and downloading a corresponding slice based on the target address, and sending the slice acquisition request to a server.
And S310, receiving the slice with the target resolution returned by the server in response to the slice acquisition request.
And S311, playing the audio and video according to the slice with the target resolution.
And the server calls the slice with the corresponding target resolution from the target address according to the slice acquisition request and sends the slice to the network television box, the network television box stores the slice in a cache, and after the previous slice is played, the slice with the target resolution is automatically accessed to play the audio and video.
According to the audio and video playing method, slice addresses of multiple resolutions of the audio and video are obtained according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; the method comprises the steps of acquiring a slice corresponding to a target address to play audio and video, when a network state changes, inquiring a primary index from an M3U8 play list according to change information, automatically matching a corresponding code rate, automatically switching the code rate according to the network state, determining a corresponding resolution according to the code rate, determining a corresponding slice address, and automatically switching a download address of the slice, and achieving the effect of smooth playing on the premise of not restarting a system player when resolution switching is needed in the audio and video playing process.
Fig. 6 is a schematic flowchart of another audio/video playing method provided in an embodiment of the present invention, and as shown in fig. 6, the method specifically includes:
and S61, the APP acquires the slice addresses with multiple resolutions of the audio and video according to the audio and video on demand request.
The audio and video playing method of the embodiment of the invention is not only applied to the above-mentioned audio and video on demand on the smart television through the television network box, but also applied to the audio and video on demand software (such as love art APP, Tencent video APP, Youkou APP, etc.) of the terminal, and will be introduced below with the application program as the execution subject.
The terminal may be a mobile terminal including a smartphone, a tablet computer, a notebook computer, a palmtop computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), and the like, and a fixed terminal such as a Digital TV, a desktop computer, and the like.
When receiving an audio and video on demand request input by a user, an application program acquires a plurality of resolutions of the audio and video and a slice address corresponding to each resolution from a server storing the audio and video file according to the audio and video on demand request.
S62, the APP constructs an M3U8 playlist according to the slice address.
Specifically, code rate information corresponding to the slices with different resolutions is determined; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
The steps of constructing the M3U8 playlist are similar to those of S32-S35 in fig. 3, except that the execution subjects are not consistent, and reference may be made to the related description of fig. 3 for brevity, which is not described herein again.
And S63, matching the target address of the corresponding slice from the M3U8 playlist in real time by the APP according to the change information of the network state.
Specifically, the current network state is monitored, and the changed information sent by the network state is determined; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
The steps of matching the target addresses of the slices are similar to those of S36-S38 in fig. 3, except that the execution subjects are not consistent, and reference may be made to the related description of fig. 3 for brevity, which is not repeated herein.
And S64, the APP acquires the slice corresponding to the target address to play the audio and video.
Specifically, a slice acquisition request is sent to a server, wherein the slice acquisition request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
The steps of playing the audio and video according to the corresponding slice of the target address are similar to those of S39-S311 in fig. 3, except that the execution subjects are inconsistent, and reference may be specifically made to the related description of fig. 3, which is for brevity, and no further description is given here.
In the audio and video playing method of the embodiment, when an application program on a terminal is used for audio and video frequency-point playing, slice addresses with multiple resolutions of audio and video are obtained according to an audio and video frequency-point playing request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; the resolution ratio can be automatically switched according to the network state, and the server does not need to be requested for slice addresses with different resolution ratios again, so that a system player does not need to be restarted when the resolution ratio is required to be switched in the audio and video playing process, the current playing interface is prevented from generating a black screen, the effect of smooth playing is achieved, and the experience of watching the audio and video by a user is improved.
Fig. 7 is a schematic structural diagram of an audio/video playing device according to an embodiment of the present invention, and as shown in fig. 7, the device specifically includes:
the acquisition module 701 is used for acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request;
a construction module 702, configured to construct an M3U8 playlist according to the slice address;
a matching module 703, configured to match a target address of a corresponding slice from the M3U8 playlist in real time according to change information of a network state;
and the playing module 704 is configured to obtain the slice corresponding to the target address and play the audio/video.
Optionally, the constructing module 702 is specifically configured to determine code rate information corresponding to the slices with different resolutions; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
Optionally, the matching module 703 is specifically configured to monitor a current network state, and determine that the network state sends changed information after the change; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
Optionally, the playing module 704 is specifically configured to send a slice obtaining request to a server, where the slice obtaining request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
The audio/video playing device provided in this embodiment may be the audio/video playing device shown in fig. 7, and may perform all the steps of the audio/video playing method shown in fig. 2 to 4, so as to achieve the technical effect of the audio/video playing method shown in fig. 2 to 4, and for brevity, it is specifically described with reference to fig. 2 to 4, which is not described herein again.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device may be a network television box or a terminal device, and the electronic device 800 shown in fig. 8 includes: at least one processor 801, memory 802, at least one network interface 804, and other user interfaces 803. The various components in the electronic device 800 are coupled together by a bus system 805. It is understood that the bus system 805 is used to enable communications among the components connected. The bus system 805 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 805 in fig. 8.
The user interface 803 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It will be appreciated that the memory 802 in embodiments of the invention may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (PROM), an erasable programmable Read-only memory (erasabprom, EPROM), an electrically erasable programmable Read-only memory (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM) which functions as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (staticiram, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (syncronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM ), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and direct memory bus RAM (DRRAM). The memory 802 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 802 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof as follows: an operating system 8021 and application programs 8022.
The operating system 8021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application 8022 includes various applications, such as a media player (MediaPlayer), a Browser (Browser), and the like, for implementing various application services. A program implementing a method according to an embodiment of the present invention may be included in application program 8022.
In the embodiment of the present invention, the processor 801 is configured to execute the method steps provided by each method embodiment by calling the program or instruction stored in the memory 802, specifically, the program or instruction stored in the application 8022, and for example, includes:
acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; and acquiring a slice corresponding to the target address to play the audio and video.
Optionally, determining code rate information corresponding to the slices with different resolutions; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
Optionally, monitoring the current network state, and determining that the network state sends changed information; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
Optionally, sending a slice acquisition request to a server, where the slice acquisition request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
The methods disclosed in the embodiments of the present invention described above may be implemented in the processor 801 or implemented by the processor 801. The processor 801 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 801. The processor 801 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 802, and the processor 801 reads the information in the memory 802, and combines the hardware to complete the steps of the method.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be the electronic device shown in fig. 8, and may execute all the steps of the audio and video playing method shown in fig. 2 to 4, so as to achieve the technical effect of the audio and video playing method shown in fig. 2 to 4, and please refer to the description related to fig. 2 to 4 for brevity, which is not described herein again.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium can be executed by one or more processors, the audio/video playing method executed on the audio/video playing device side is realized.
The processor is used for executing the audio and video playing program stored in the memory so as to realize the following steps of the audio and video playing method executed on the audio and video playing equipment side:
acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request; constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state; and acquiring a slice corresponding to the target address to play the audio and video.
Optionally, determining code rate information corresponding to the slices with different resolutions; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
Optionally, monitoring the current network state, and determining that the network state sends changed information; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
Optionally, sending a slice acquisition request to a server, where the slice acquisition request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (8)
1. An audio and video playing method is characterized in that the method is applied to a network television box and comprises the following steps:
acquiring slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request;
constructing an M3U8 playlist according to the slice address; matching a target address of a corresponding slice from the M3U8 playlist in real time according to the change information of the network state;
acquiring a slice corresponding to the target address to play the audio and video;
wherein the constructing an M3U8 playlist according to the slice address includes:
determining code rate information corresponding to the slices with different resolutions;
correlating the code rate information with a resolution corresponding to the slice;
associating resolution information with the corresponding slice address;
and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
2. The method of claim 1, wherein the matching target information of the corresponding slice from the M3U8 playlist in real time according to the change information of the network status comprises:
monitoring the current network state, and determining the changed information sent by the network state;
matching a corresponding target resolution from the M3U8 playlist according to the change information;
and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
3. The method according to claim 2, wherein the obtaining of the slice corresponding to the target address for playing the audio/video includes:
sending a slice acquisition request to a server, wherein the slice acquisition request carries the target address;
receiving the slice of the target resolution returned by the server in response to the slice acquisition request;
and playing the audio and video according to the slice with the target resolution.
4. An audio-video playback device, comprising:
the acquisition module is used for acquiring the slice addresses of multiple resolutions of the audio and video according to the audio and video on demand request;
a construction module, configured to construct an M3U8 playlist according to the slice address;
the matching module is used for matching the target address of the corresponding slice from the M3U8 playlist in real time according to the change information of the network state;
the playing module is used for obtaining the slices corresponding to the target addresses and playing the audio and video;
the construction module is specifically configured to determine code rate information corresponding to the slices with different resolutions; correlating the code rate information with a resolution corresponding to the slice; associating resolution information with the corresponding slice address; and constructing an M3U8 playlist according to the association relationship between the code rate information and the resolution and the association relationship between the resolution information and the slice address.
5. The apparatus according to claim 4, wherein the matching module is specifically configured to monitor a current network state, and determine that the network state sends changed information after the change; matching a corresponding target resolution from the M3U8 playlist according to the change information; and matching the target address of the corresponding slice from the M3U8 playlist according to the target resolution.
6. The apparatus according to claim 5, wherein the playing module is specifically configured to send a slice acquisition request to a server, where the slice acquisition request carries the target address; receiving the slice of the target resolution returned by the server in response to the slice acquisition request; and playing the audio and video according to the slice with the target resolution.
7. An electronic device, comprising: the processor is used for executing an audio and video playing program stored in the memory so as to realize the audio and video playing method of any one of claims 1-3.
8. A storage medium storing one or more programs executable by one or more processors to implement the audio-video playback method of any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910858157.0A CN110677727B (en) | 2019-09-10 | 2019-09-10 | Audio and video playing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910858157.0A CN110677727B (en) | 2019-09-10 | 2019-09-10 | Audio and video playing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110677727A CN110677727A (en) | 2020-01-10 |
CN110677727B true CN110677727B (en) | 2022-05-10 |
Family
ID=69077705
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910858157.0A Active CN110677727B (en) | 2019-09-10 | 2019-09-10 | Audio and video playing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110677727B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113542795B (en) * | 2020-04-21 | 2023-04-18 | 腾讯科技(深圳)有限公司 | Video processing method and device, electronic equipment and computer readable storage medium |
CN112104885B (en) * | 2020-09-09 | 2022-06-24 | 海看网络科技(山东)股份有限公司 | System and method for accelerating M3U8 initial playing speed in live broadcasting |
CN112468876A (en) * | 2020-12-16 | 2021-03-09 | 湖南新云网科技有限公司 | Resource playing method, device and system and readable storage medium |
CN115484505A (en) * | 2021-05-31 | 2022-12-16 | 华为技术有限公司 | Video transmission method, device, equipment, system and computer storage medium |
CN113411340A (en) * | 2021-06-22 | 2021-09-17 | 中国农业银行股份有限公司 | Video processing method, video processing apparatus, electronic device, storage medium, and program product |
CN113438513B (en) * | 2021-06-25 | 2023-05-02 | 深圳Tcl新技术有限公司 | Video resolution switching method, device, equipment and storage medium |
CN113259706B (en) * | 2021-06-28 | 2022-06-17 | 北京新唐思创教育科技有限公司 | Live broadcast processing method and device, electronic equipment and storage medium |
CN114157643B (en) * | 2021-12-20 | 2023-01-13 | 海看网络科技(山东)股份有限公司 | Method for fixing code rate parameters based on transcoder HLS protocol |
CN114339291B (en) * | 2021-12-31 | 2024-05-28 | 杭州当虹科技股份有限公司 | Method for scaling and playing streaming media video |
CN116506672B (en) * | 2023-06-29 | 2023-09-08 | 北京朝歌数码科技股份有限公司 | Audio and video synchronous playing method of intranet equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102123303A (en) * | 2011-03-25 | 2011-07-13 | 天脉聚源(北京)传媒科技有限公司 | Audio/video file playing method and system as well as transmission control device |
CN104010232A (en) * | 2014-05-23 | 2014-08-27 | 惠州Tcl移动通信有限公司 | Method and system for intelligently playing online videos, player and mobile terminal |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9344748B2 (en) * | 2014-03-31 | 2016-05-17 | Arris Enterprises, Inc. | Adaptive streaming transcoder synchronization |
CN105376642B (en) * | 2014-08-18 | 2019-12-03 | 深圳Tcl新技术有限公司 | Video playing resolution ratio switching method and system |
US10616633B2 (en) * | 2016-02-29 | 2020-04-07 | T1V, Inc. | System for connecting a mobile device and a common display |
CN105898408A (en) * | 2016-04-28 | 2016-08-24 | 乐视控股(北京)有限公司 | Video play method and device |
CN106131610A (en) * | 2016-06-28 | 2016-11-16 | 乐视控股(北京)有限公司 | The online broadcasting method of video, equipment and device |
US10785443B2 (en) * | 2017-12-18 | 2020-09-22 | Streem, Inc. | Augmented reality video stream synchronization across a network |
CN108848414A (en) * | 2018-06-26 | 2018-11-20 | 曜宇航空科技(上海)有限公司 | The switching method and player of a kind of playback method of video, clarity |
CN110213653B (en) * | 2019-06-14 | 2022-03-04 | 北京奇艺世纪科技有限公司 | Method and device for playing video |
-
2019
- 2019-09-10 CN CN201910858157.0A patent/CN110677727B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102123303A (en) * | 2011-03-25 | 2011-07-13 | 天脉聚源(北京)传媒科技有限公司 | Audio/video file playing method and system as well as transmission control device |
CN104010232A (en) * | 2014-05-23 | 2014-08-27 | 惠州Tcl移动通信有限公司 | Method and system for intelligently playing online videos, player and mobile terminal |
Also Published As
Publication number | Publication date |
---|---|
CN110677727A (en) | 2020-01-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110677727B (en) | Audio and video playing method and device, electronic equipment and storage medium | |
US11539989B2 (en) | Media content redirection | |
US9344517B2 (en) | Downloading and adaptive streaming of multimedia content to a device with cache assist | |
US12010158B2 (en) | Systems and methods for multi-device media broadcasting or recording with low-latency active control | |
EP3241327B1 (en) | Systems and methods for pre-caching media content | |
US10104143B1 (en) | Manifest segmentation | |
CN108933764B (en) | Method and device for realizing quick broadcast starting | |
US10911809B2 (en) | Communication apparatus, communication method, and program | |
US20170162229A1 (en) | Play method and device | |
US10116719B1 (en) | Customized dash manifest | |
CN109756749A (en) | Video data handling procedure, device, server and storage medium | |
CN110933517A (en) | Code rate switching method, client and computer readable storage medium | |
CN113141522B (en) | Resource transmission method, device, computer equipment and storage medium | |
US20160294903A1 (en) | Method and device for pushing resources to mobile communication terminal by smart television | |
CN107690093B (en) | Video playing method and device | |
CN112449250B (en) | Method, device, equipment and medium for downloading video resources | |
US10708648B2 (en) | System for providing hybrid user interfaces and method thereof | |
CN108737355B (en) | Streaming media playback based on user bandwidth | |
US11805290B2 (en) | Method for managing zapping of digital multimedia contents obtained by HTTP adaptive streaming (HAS), and corresponding management device, multimedia stream reader and computer program | |
US20140317245A1 (en) | Method for rendering a multimedia asset, a related system, media client and related media server | |
US11190835B2 (en) | Intelligent unload of broadcaster application on channel change | |
US11792461B2 (en) | Method for managing the reading of a digital content item within a multimedia content reader terminal connected to a rendering device | |
US20230421821A1 (en) | Method for Managing Playback of Multimedia Content | |
US9584572B2 (en) | Cloud service device, multi-image preview method and cloud service system | |
US10938939B2 (en) | Client-side quality-of-service (QOS) for viewing of adaptive bitrate (ABR) streams |
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 |