Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a video playing method according to a first embodiment of the present invention, where the method may be performed by a video playing device, and the video playing device may be implemented in hardware and/or software, and the video playing device may be configured in a computing device. As shown in fig. 1, the method includes:
s110, when a video switching request is received, obtaining video parameters of the current video to be played, corresponding to the video switching request.
The video switching request refers to an instruction and a code for requesting video switching. The video parameters include standard playing bandwidth and standard resolution. The video parameters correspond to the videos themselves, and the video parameters of each video may be different or the same.
In this embodiment, when the user triggers another video link control during browsing one video, the server may be considered to receive a video switching request, or when one video is played, the system automatically triggers a control for playing the next video, and at this time, the system is considered to receive the video switching request. The video corresponding to the trigger video link control can be used as the video to be played currently. After the system receives the video switching request, the system acquires the video parameters configured by the current video to be played.
In practical application, when video playing of some APP is processed, m3u8 format is usually adopted for playing, or h.264 and vp9 formats are usually adopted for playing, and before playing, a playing link of the video is usually acquired, so that video parameters of the video are acquired based on the playing link.
Optionally, obtaining the video parameters of the video to be played currently corresponding to the video switching request includes analyzing the video switching request to obtain a resource locator corresponding to the video to be played currently carried in the video switching request, obtaining a parameter file corresponding to the resource locator, and analyzing the parameter file to obtain the video parameters.
Wherein the resource locator is referred to as URL (uniform resource locator). The parameter file may be a file in m3u8 format.
Specifically, the URL, namely the resource locator, corresponding to the current video to be played, carried in the video switching request can be obtained by analyzing the video switching request. And further loads a parameter file corresponding to the resource locator. The video parameters such as standard playing bandwidth, standard resolution and the like contained in the parameter file can be obtained by analyzing the parameter file.
For example, after determining the URL (i.e. the resource locator), the corresponding m3u8 file may be downloaded through the URL, including two files, master.m3u8 and media.m3u8, where master.m3u8 is a parameter file, and the data format in the parameter file may be as follows:
#EXT-X-STREAM-INF:BANDWIDTH=306568,CODECS="avc1.4D400C,mp4a.40.5",RESOLUTION=426x240,AUDIO="233",FRAME-RATE=25,VIDEO-RANGE=SDR,CLOSE D-CAPTIONS=NONE
The parameter file contains bandwidth value (i.e. standard playing bandwidth) 306568, coding mode (avc1.4D400C), resolution (i.e. standard resolution) 426x240, etc.
S120, determining the resolution to be used corresponding to the current video to be played based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video.
The previous history playing video refers to the video played before switching, that is, the video played before the current video to be played.
It should be noted that, in the existing video playing mode, when each video is just started to play, the default bandwidth value is zero, then the actual bandwidth is monitored after 10 seconds after the video is played, and then the corresponding resolution is selected according to the actual bandwidth, so that the resolution is switched every time when one video is played, and the problem of poor playing effect exists because the lower resolution is adopted about 10 seconds before the video is just started to play. In order to better solve the problem, in this embodiment, after determining the video parameter of the current video to be played, a suitable resolution is selected for the current video to be played by combining the standard playing bandwidth in the video parameter and the historical playing bandwidth corresponding to the previous historical playing video, and at this time, the historical playing bandwidth is closest to the network bandwidth loading the current video to be played at the current moment, so that the playing condition of the current video to be played can be well satisfied, and the situation that video is blocked or the video is unclear when the current video to be played starts to be played is prevented.
Specifically, the method comprises the steps of determining the resolution to be used corresponding to the current video to be played based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video, wherein if the standard playing bandwidth is smaller than the historical playing bandwidth corresponding to the previous historical playing video, the standard resolution is used as the resolution to be used of the current video to be played.
In this embodiment, the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video may be compared, if the standard playing bandwidth is smaller than the historical playing bandwidth, it may be stated that if the current video to be played is played with the standard resolution at the current moment, no play jam will occur, the playing condition of the current video to be played is satisfied, the resolution does not need to be adjusted, and the standard resolution in the video parameter may be used as the resolution to be used of the current video to be played, so that the current video to be played is played based on the resolution to be used.
In the actual playing process, how to detect that the historical playing bandwidth is not greater than the standard playing bandwidth 306568 is exemplified, the standard resolution is directly used for playing, and if the standard playing bandwidth is higher, the resolution corresponding to the historical playing bandwidth is selected for playing.
In the embodiment, the method comprises the steps of determining the resolution to be used corresponding to the current video to be played based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video, determining the resolution to be applied corresponding to the historical playing bandwidth if the standard playing bandwidth is larger than the historical playing bandwidth corresponding to the previous historical playing video, and taking the resolution to be applied as the resolution to be used of the current video to be played.
Specifically, if the standard playing bandwidth is greater than the historical playing bandwidth, it may be stated that if the current video to be played is played at the standard resolution at the current moment, a phenomenon of playing jam may occur, and the resolution needs to be adjusted. The resolution to be applied may be regarded as the resolution to be used. So that the current video to be played is played based on the resolution to be used, and the video playing fluency is improved.
And S130, playing the current video to be played based on the resolution to be used, and determining the current playing bandwidth when the current video to be played is played as the historical playing bandwidth, so that when the video switching request is received again, the resolution to be used corresponding to the next video to be played is determined based on the historical playing bandwidth and the standard playing bandwidth of the next video to be played.
In this embodiment, in the process of playing the current video to be played based on the resolution to be used, the current playing bandwidth during playing may be monitored in real time, the current playing bandwidth may change along with the playing middle of the video, and when the new real-time playing bandwidth is detected, the playing bandwidth recorded last time may be updated based on the time dimension, so that when the playing of the current video to be played is finished, the detected current playing bandwidth is the closest to the next switching video, that is, the switching time of the next video to be played is the closest. The current playing bandwidth can be used as the historical playing bandwidth, when the video switching request is received again next time, the resolution to be used corresponding to the video to be played next time can be determined based on the historical playing bandwidth and the standard playing bandwidth of the video to be played next time, and the playing effect of each video is improved in the process of playing the video stream.
It should be noted that, in the process of determining the current playing bandwidth when the current video to be played is played, the current playing network speed when the current video to be played is played can be determined, and the current playing bandwidth is determined based on the current playing network speed.
In this embodiment, the current playing network speed may be monitored in real time during the process of playing the current video to be played, and further, the current playing network speed may be converted into the network bandwidth, so as to obtain the current playing bandwidth.
In order to better meet the viewing experience of the user, a switching prompt can be given in the video switching process. Optionally, when receiving the video switching request, a video switching prompt message may be generated and displayed.
Specifically, when a video switching request is received, it is considered that video switching is performed at this time, a menu prompt may be added, and video switching prompt information is displayed in a switching area, and exemplary video switching prompt information may be "currently switching". It should be noted that the switching area may be any area of the display interface, and may be determined by a technician according to an actual working condition, which is not limited herein.
According to the technical scheme, when a video switching request is received, standard playing bandwidth and standard resolution of a current video to be played corresponding to the video switching request are obtained, the resolution to be used corresponding to the current video to be played is determined based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video, the current video to be played is played based on the resolution to be used, the current playing bandwidth when the current video to be played is determined to serve as the historical playing bandwidth, when the video switching request is received again, the resolution to be used corresponding to the next video to be played is determined based on the historical playing bandwidth and the standard playing bandwidth of the next video to be played, the problem that viewing experience of a user is affected due to the fact that the video resolution is manually adjusted by a user in the prior art is solved, the fact that the standard playing bandwidth of the current video to be played is determined when the video is switched, the historical playing bandwidth corresponding to the previous historical playing video is comprehensively considered, the current video to be the best suitable for the resolution to be used is determined, the current video to be played based on the resolution to be used is played, the effect of the video to be played is improved, and further, the viewing experience of the user is improved, and the technical effect of the user is achieved.
Example two
As an alternative embodiment of the foregoing embodiment, a specific application scenario example is given to make the technical solution of the embodiment of the present invention further clear to those skilled in the art. In particular, reference may be made to the following details.
For example, referring to fig. 2, fig. 2 may be represented as a schematic diagram of a video playing method, when playing video using an APP, a current network speed may be recorded after playing a first film source, and a corresponding bandwidth value is obtained, and if no network speed is detected, it is indicated that no network exists, and the video playing method is in a network card state. When video switching is performed, gstframework layers need to throw out messages to upper layers, the first message represents that resolution switching is ready at present, and the second message throws out the bandwidth value detected for the first time to the upper layer APP. After the upper layer receives the resolution switching information, then the menu is prompted, namely the menu is increased when the video is switched, the bandwidth value is recorded, then the bandwidth is set when the pipeline is constructed, the bandwidth of the first video is played again when the second video is played again, and the most suitable resolution is directly selected and the resolution is not switched, so that the requirement of a user can be met. The corresponding url can be obtained based on the video link through the system, and then the corresponding m3u8 file is downloaded through the url, wherein the m3u8 file comprises master.m3u8 (i.e. parameter file) and media.m3u8 (code stream fragment file). For example, the parameter file content may be
#EXT-X-STREAM-INF:BANDWIDTH=306568,CODECS="avc1.4D400C,mp4a.40.5",RESOLUTION=426x240,AUDIO="233",FRAME-RATE=25,VIDEO-RANGE=SDR,CLOSE D-CAPTIONS=NONE, The parameter file contains bandwidth value (i.e. standard playing bandwidth) 306568, coding mode (avc1.4D400C), resolution (i.e. standard resolution) 426x240, etc. In the actual playing process, how to detect that the historical playing bandwidth corresponding to the last historical playing video is larger than 306568 is directly used for playing 426x240, and if the standard playing bandwidth is higher, the most suitable link is selected for playing. And then through the corresponding link, the m3u8 file corresponding to the actual code stream can be downloaded, and the file contains the actual code stream fragment. It should be noted that, because the upper layer directly performs the network speed transfer, the function gst_hls_master_playlist_get_variant_for_bitrate(hlsdemux->master,NULL,demux->connection_speed) is directly executed, so that the resolution is not required to be switched, and the video playing effect is improved.
According to the technical scheme, when a video switching request is received, standard playing bandwidth and standard resolution of a current video to be played corresponding to the video switching request are obtained, the resolution to be used corresponding to the current video to be played is determined based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video, the current video to be played is played based on the resolution to be used, the current playing bandwidth when the current video to be played is determined to serve as the historical playing bandwidth, when the video switching request is received again, the resolution to be used corresponding to the next video to be played is determined based on the historical playing bandwidth and the standard playing bandwidth of the next video to be played, the problem that viewing experience of a user is affected due to the fact that the video resolution is manually adjusted by a user in the prior art is solved, the fact that the standard playing bandwidth of the current video to be played is determined when the video is switched, the historical playing bandwidth corresponding to the previous historical playing video is comprehensively considered, the current video to be the best suitable for the resolution to be used is determined, the current video to be played based on the resolution to be used is played, the effect of the video to be played is improved, and further, the viewing experience of the user is improved, and the technical effect of the user is achieved.
Example III
Fig. 3 is a schematic structural diagram of a video playing device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes a video parameter acquisition module 310, a resolution to be used determination module 320, and a bandwidth recording module 330.
The video switching module 310 is configured to obtain, when a video switching request is received, a video parameter of a current video to be played corresponding to the video switching request, where the video parameter includes a standard playing bandwidth and a standard resolution, the resolution to be used determining module 320 is configured to determine, based on the standard playing bandwidth and a historical playing bandwidth corresponding to a previous historical playing video, a resolution to be used corresponding to the current video to be played, and the bandwidth recording module 330 is configured to play the current video to be played based on the resolution to be used, and determine, when the current video to be played is played, a current playing bandwidth as a historical playing bandwidth, so that, when the video switching request is received again, the resolution to be used corresponding to the next video to be played is determined based on the historical playing bandwidth and the standard playing bandwidth of the next video to be played.
According to the technical scheme, when a video switching request is received, standard playing bandwidth and standard resolution of a current video to be played corresponding to the video switching request are obtained, the resolution to be used corresponding to the current video to be played is determined based on the standard playing bandwidth and the historical playing bandwidth corresponding to the previous historical playing video, the current video to be played is played based on the resolution to be used, the current playing bandwidth when the current video to be played is determined to serve as the historical playing bandwidth, when the video switching request is received again, the resolution to be used corresponding to the next video to be played is determined based on the historical playing bandwidth and the standard playing bandwidth of the next video to be played, the problem that viewing experience of a user is affected due to the fact that the video resolution is manually adjusted by a user in the prior art is solved, the fact that the standard playing bandwidth of the current video to be played is determined when the video is switched, the historical playing bandwidth corresponding to the previous historical playing video is comprehensively considered, the current video to be the best suitable for the resolution to be used is determined, the current video to be played based on the resolution to be used is played, the effect of the video to be played is improved, and further, the viewing experience of the user is improved, and the technical effect of the user is achieved.
On the basis of the above device, optionally, the video parameter obtaining module 310 includes a resource locator determining unit, a parameter file determining unit, and a video parameter determining unit.
The resource locator determining unit is used for analyzing the video switching request to obtain a resource locator corresponding to the current video to be played, which is carried in the video switching request;
A parameter file determining unit, configured to obtain a parameter file corresponding to the resource locator;
and the video parameter determining unit is used for analyzing the parameter file to obtain the video parameter.
On the basis of the above apparatus, optionally, the to-be-used resolution determining module 320 is further configured to use the standard resolution as the to-be-used resolution of the current to-be-played video if the standard playing bandwidth is smaller than the historical playing bandwidth corresponding to the previous historical playing video.
On the basis of the above device, optionally, the to-be-used resolution determining module 320 further includes a to-be-applied resolution determining unit and a to-be-used resolution determining unit.
The to-be-applied resolution determining unit is used for determining to-be-applied resolution corresponding to the historical playing bandwidth if the standard playing bandwidth is larger than the historical playing bandwidth corresponding to the previous historical playing video;
and the to-be-used resolution determining unit is used for taking the to-be-applied resolution as the to-be-used resolution of the current video to be played.
On the basis of the above device, optionally, the bandwidth recording module 330 includes a current playing network speed determining unit and a current playing bandwidth determining unit.
The current playing network speed determining unit is used for determining the current playing network speed when the video to be played currently is played;
and the current playing bandwidth determining unit is used for determining the current playing bandwidth based on the current playing network speed.
On the basis of the device, the device also comprises a switching prompt module.
And the switching prompt module is used for generating and displaying video switching prompt information when receiving the video switching request.
The video playing device provided by the embodiment of the invention can execute the video playing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Example IV
Fig. 4 is a schematic structural diagram of an electronic device implementing a video playing method according to an embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including an input unit 16, such as a keyboard, mouse, etc., an output unit 17, such as various types of displays, speakers, etc., a storage unit 18, such as a magnetic disk, optical disk, etc., and a communication unit 19, such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a video playback method.
In some embodiments, the video playback method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the video playback method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the video playback method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be a special or general purpose programmable processor, operable to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user, for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), a blockchain network, and the Internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.