CN107888975B - Video playing method, device and storage medium - Google Patents

Video playing method, device and storage medium Download PDF

Info

Publication number
CN107888975B
CN107888975B CN201711258470.8A CN201711258470A CN107888975B CN 107888975 B CN107888975 B CN 107888975B CN 201711258470 A CN201711258470 A CN 201711258470A CN 107888975 B CN107888975 B CN 107888975B
Authority
CN
China
Prior art keywords
key
decoding
frame
video
frames
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711258470.8A
Other languages
Chinese (zh)
Other versions
CN107888975A (en
Inventor
张斯剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kugou Computer Technology Co Ltd
Original Assignee
Guangzhou Kugou Computer Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Kugou Computer Technology Co Ltd filed Critical Guangzhou Kugou Computer Technology Co Ltd
Priority to CN201711258470.8A priority Critical patent/CN107888975B/en
Publication of CN107888975A publication Critical patent/CN107888975A/en
Application granted granted Critical
Publication of CN107888975B publication Critical patent/CN107888975B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Abstract

The invention discloses a video playing method, a video playing device and a storage medium, and belongs to the technical field of videos. The method comprises the following steps: starting to play a first segmented video corresponding to first segmented video data based on a first key decoding frame in a plurality of first key decoding frames, wherein the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance; in the process of playing a first segmented video, sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to a video frame sequence; and finishing the playing of the first segmented video based on the first non-key decoding frame obtained by decoding and the first key decoding frame after the first key decoding frame. The invention only needs to decode all key coding frames in the segmented video data before playing, thereby reducing the decoding time before playing and improving the video playing efficiency.

Description

Video playing method, device and storage medium
Technical Field
The embodiment of the invention relates to the technical field of videos, in particular to a video playing method, a video playing device and a storage medium.
Background
In the field of video technology, in order to save the storage space of a video, it is generally necessary to encode video data in advance and then store the encoded video data to reduce the data amount of the video data, so that when a video is played, the video data needs to be decoded before being played.
In the related art, a video playing method is provided, which includes: before playing a video, acquiring segmented video data corresponding to a segmented video within a preset time length after a current time point to be played starts from video data, decoding all key coding frames and non-key coding frames in the segmented video data to obtain all key decoding frames and non-key decoding frames, and playing the segmented video based on all key decoding frames and non-key decoding frames. The key coding frame is a coding frame obtained by coding the key frame, and the non-key coding frame is a coding frame obtained by coding the non-key frame. The key frame refers to a key and complete image in a video, and generally appears according to a frame rate, for example, when the frame rate is 30 frames per second, the 1 st frame and the 31 st frame are key frames, and so on; the non-key frame refers to a video frame except the key frame in the video, and is used for indicating the change and connection of the intermediate state image.
In the related art, for any segmented video in the video, it is necessary to decode all key encoded frames and non-key encoded frames in the segmented video data in advance before playing, and the decoding time before playing is long, which may cause that buffering and decoding are required to be performed continuously in the video playing process, and the playing efficiency is low.
Disclosure of Invention
In order to solve the problems of long decoding time and low playing efficiency before video playing in the related art, embodiments of the present invention provide a video playing method, apparatus and storage medium. The technical scheme is as follows:
in a first aspect, a video playing method is provided, where the method includes:
starting to play a first segmented video corresponding to the first segmented video data based on a first key decoding frame in the plurality of first key decoding frames;
the first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance;
in the process of playing the first segmented video, sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to the video frame sequence;
and finishing the playing of the first segmented video based on a first non-key decoding frame obtained by decoding and a first key decoding frame after the first key decoding frame.
Optionally, before completing the playing of the first segmented video, the method further includes:
in the process of playing the first segmented video, obtaining second segmented video data, wherein the second segmented video data refers to video data corresponding to a video in the target video within a preset time length after the playing ending time point of the first segmented video;
and decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
Optionally, the finishing the playing of the first segmented video based on the first non-key decoded frame obtained by decoding and the first key decoded frame after the first key decoded frame includes:
when a specified first key decoding frame is played completely and all first non-key encoding frames after the specified first key decoding frame and before a next first key decoding frame of the specified first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key encoding frames are played sequentially, wherein the specified first key decoding frame is any one of the plurality of first key decoding frames;
when a designated first key decoded frame is played out and all first non-key encoded frames after the designated first key decoded frame and before a next first key decoded frame of the designated first key decoded frame are not decoded out, playing the next first key decoded frame.
Optionally, the method further comprises:
and in the process of playing the next first key decoding frame, stopping decoding the first non-key coding frame before the next first key decoding frame, and sequentially decoding the non-first key coding frames after the next first key decoding frame according to the video frame sequence.
In a second aspect, a video playing apparatus is provided, where the apparatus includes:
the first playing module is used for starting to play a first segmented video corresponding to the first segmented video data based on a first key decoding frame in the plurality of first key decoding frames;
the first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance;
the first decoding model is used for sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to a video frame sequence in the process of playing the first segmented video;
and the second playing module is used for finishing the playing of the first segmented video based on the first non-key decoding frame obtained by decoding and the first key decoding frame after the first key decoding frame.
Optionally, the apparatus further comprises:
an obtaining module, configured to obtain second segment video data in a process of playing the first segment video, where the second segment video data is video data corresponding to a video in the target video within a preset time period after a playing end time point of the first segment video;
and the second decoding module is used for decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
Optionally, the second playing module is specifically configured to:
when a specified first key decoding frame is played completely and all first non-key encoding frames after the specified first key decoding frame and before a next first key decoding frame of the specified first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key encoding frames are played sequentially, wherein the specified first key decoding frame is any one of the plurality of first key decoding frames;
when a designated first key decoded frame is played out and all first non-key encoded frames after the designated first key decoded frame and before a next first key decoded frame of the designated first key decoded frame are not decoded out, playing the next first key decoded frame.
Optionally, the apparatus further comprises:
and the third decoding module is used for stopping decoding the first non-key coding frame before the next first key decoding frame in the process of playing the next first key decoding frame and sequentially decoding the non-first key coding frame after the next first key decoding frame according to the video frame sequence.
In a fourth aspect, a video playing apparatus is provided, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of any one of the video playback methods of the first aspect.
In a fifth aspect, a computer-readable storage medium is provided, which has instructions stored thereon, and is characterized in that the instructions, when executed by a processor, implement the steps of any of the video playing methods described in the first aspect.
In a sixth aspect, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the video playback methods of the first aspect described above.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
in the embodiment of the present invention, before playing a first segmented video in a target video, all key encoded frames in the first segmented video data may be decoded in advance to obtain a plurality of key decoded frames, and then, in the process of playing the first segmented video based on the plurality of key decoded frames, non-key encoded frames in the first segmented video data are sequentially decoded, that is, the non-key encoded frames are decoded while playing, so that the playing of the first segmented video may be completed based on the key decoded frames obtained by decoding in advance and the non-key decoded frames obtained by decoding in the playing process. Since all key coding frames in the segmented video data are only required to be decoded before playing, the decoding time before playing is reduced, and the video playing efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a video playing method according to an embodiment of the present invention;
fig. 2 is a flow chart of another video playing method provided by the embodiment of the present invention;
fig. 3 is a block diagram of a video playing apparatus according to an embodiment of the present invention;
fig. 4 is a block diagram of a terminal 400 according to an exemplary embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
First, an application scenario of the embodiment of the present invention is described.
The embodiment of the invention is applied to the scene of playing the locally stored video or the scene of playing the network video. For locally stored video, playing can be performed based on locally stored video data, and for network video, playing can be performed based on video data received through a network.
At present, in order to reduce the storage space of video data and improve the transmission efficiency of video data, the locally stored video data is usually the video data obtained by encoding the original video data in advance, and correspondingly, the video data transmitted through the network is also usually the video data obtained by encoding the original video data in advance. Therefore, when playing locally stored video or network video, it is usually necessary to decode locally stored video data or video data received via a network, and then play video based on the decoded video data.
Next, an implementation environment of the embodiment of the present invention will be described.
The embodiment of the invention is applied to the terminal, and the terminal can play the video based on the locally stored video data or the video data transmitted by the network. In practical application, the terminal may be a mobile phone, a tablet computer, or a computer.
Fig. 1 is a flowchart of a video playing method provided in an embodiment of the present invention, applied in a terminal, and referring to fig. 1, the method includes the following steps:
step 101: and starting playing the first segmented video corresponding to the first segmented video data based on the first key decoding frame in the plurality of first key decoding frames.
The first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance.
Step 102: and in the process of playing the first segmented video, sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to the video frame sequence.
Step 103: and finishing the playing of the first segmented video based on the first non-key decoding frame obtained by decoding and the first key decoding frame after the first key decoding frame.
In the embodiment of the present invention, before playing a first segmented video in a target video, all key encoded frames in the first segmented video data may be decoded in advance to obtain a plurality of key decoded frames, and then, in the process of playing the first segmented video based on the plurality of key decoded frames, non-key encoded frames in the first segmented video data are sequentially decoded, that is, the non-key encoded frames are decoded while playing, so that the playing of the first segmented video may be completed based on the key decoded frames obtained by decoding in advance and the non-key decoded frames obtained by decoding in the playing process. Since all key coding frames in the segmented video data are only required to be decoded before playing, the decoding time before playing is reduced, and the video playing efficiency is improved.
Optionally, before completing the playing of the first segmented video, the method further includes:
in the process of playing the first segmented video, obtaining second segmented video data, wherein the second segmented video data refers to video data corresponding to a video in the target video within a preset time length after the playing ending time point of the first segmented video;
and decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
Optionally, the playing the first segmented video based on the first non-key decoded frame obtained by decoding and the first key decoded frame after the first key decoded frame is completed, including:
when the appointed first key decoding frame is played completely and all first non-key coding frames after the appointed first key decoding frame and before the next first key decoding frame of the appointed first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key coding frames are played in sequence, wherein the appointed first key decoding frame is any one first key decoding frame in the plurality of first key decoding frames;
when the designated first key decoding frame is played completely and all first non-key encoded frames after the designated first key decoding frame and before the next first key decoding frame of the designated first key decoding frame are not decoded completely, playing the next first key decoding frame.
Optionally, the method further comprises:
and in the process of playing the next first key decoding frame, stopping decoding the first non-key coding frame before the next first key decoding frame, and sequentially decoding the non-first key coding frames after the next first key decoding frame according to the video frame sequence.
All the above optional technical solutions can be combined arbitrarily to form optional embodiments of the present disclosure, and the embodiments of the present disclosure are not described in detail again.
Fig. 2 is a flowchart of another video playing method provided by an embodiment of the present invention, where the method is applied in a terminal, and referring to fig. 2, the method includes the following steps:
step 201: and starting playing the first segmented video corresponding to the first segmented video data based on the first key decoding frame in the plurality of first key decoding frames.
The first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance. The target video may be a normal video or a high definition video.
In order to improve video playing efficiency, currently, when playing a video, video data of a partial time period is generally obtained from video data of an entire video, and the video data of the partial time period is decoded, and then the video of the partial time period is played based on the decoded video data. And in the process of playing the video in the part of the time period, the video data in the next time period can be decoded, so that when the video playing in the part of the time period is completed, the video in the next time period is played based on the decoded video data. In the embodiment of the present invention, for convenience of description, video data of a partial time period acquired each time is referred to as segmented video data.
The first segmented video data is video data of a preset time length acquired from the whole video of the target video before the first segmented video is played. The preset duration may be set by default by the terminal, or may be adjusted by the user, which is not limited in the embodiment of the present invention. In practical applications, the preset time period is usually between 3s and 10s, for example, the preset time period may be 4s, 5s, and the like.
For convenience of explanation, in the embodiment of the present invention, a key encoded frame included in the first segmented video data is referred to as a first key encoded frame, and a key encoded frame included in the second segmented video data is referred to as a second key encoded frame. The second segmented video data refers to video data corresponding to a video within a preset time length after the playing ending time point of the first segmented video in the target video, that is, video data corresponding to a segmented video to be played in a next time period after the playing of the first segmented video is completed.
In the related art, for any segmented video in a target video, it is necessary to decode all key coded frames and non-key coded frames in the segmented video data in advance before playing, and the decoding duration before playing is long. Especially, when the target video is a high-definition video, the decoding duration before playing is longer due to a larger video data amount, and a phenomenon that buffering and decoding are required to be performed continuously in the video playing process is likely to occur, so that the video watching experience is not good.
In order to solve the problem of long decoding time before playing in the related art, in the embodiment of the present invention, before playing the first segmented video, only all first key decoding frames in the first segmented video data may be decoded in advance. When the playing time point of the first segmented video is reached, the playing of the first segmented video may be started based on a first key decoding frame of all the first key decoding frames obtained by decoding, that is, the first key decoding frame is played first.
It should be noted that the first video frame in each segmented video in the target video is usually a key frame, so that the first key decoding frame can be played to start playing the first segmented video.
The first segmented video may be any segmented video to be played in the target video. Specifically, the first segmented video that needs to be played after the play instruction for the target video is received may be, or the intermediate segmented video after the first segmented video.
When the first segmented video is a first segmented video, the plurality of first key decoding frames may be obtained by acquiring the first segmented video data from the video data of the target video after receiving the play instruction of the target video and before playing the target video, and decoding all first key encoding frames in the first segmented video data. The first segmented video is a video within a preset time length after the time point to be played of the target video begins.
For example, taking the preset time length as 5s as an example, when a play instruction for the target video is received, 00: 00h to 00: and the first subsection video data corresponds to the video with the time length of 5s between 05h, and all the first key coding frames in the first subsection video data are decoded to obtain a plurality of first key decoding frames.
When the first segmented video is an intermediate segmented video, the plurality of first key decoding frames may obtain the first segmented video data in a process of playing a segmented video before the first segmented video, and decode all first key encoding frames in the first segmented video data. For example, all the first key coded frames in the first segmented video data may be decoded during the playing of the last segmented video of the first segmented video.
For example, taking the preset duration as 5s, when the first segment video data is 00: 05h to 00: for segmented video data between 10h, the ratio of 00: 00h to 00: and in the process of playing the segmented video between 05h, decoding all first key coding frames in the first segmented video data to obtain a plurality of first key decoding frames.
Step 202: and in the process of playing the first segmented video, sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to the video frame sequence.
Specifically, when the first key decoding frame is played, the first non-key encoding frames in the first segment of video data may start to be decoded sequentially according to the video frame sequence.
For the key coding frames and the non-key coding frames included in the video data, because the key coding frames are used for indicating the key state information of the video, and the non-key coding frames are used for indicating the intermediate state change and connection of the video, the data volume of the non-key coding frames is relatively small, and correspondingly, the decoding time is short, so that the non-key coding frames needing to be played can be quickly decoded in the video playing process, and the decoded non-key decoding frames can be played.
Further, when the first segmented video is the last segmented video to be played in the target video, step 204 is executed; when the first segment video is not the last segment video to be played in the target video, step 203 and step 206 are executed.
Step 203: and in the process of playing the first segmented video, acquiring second segmented video data, and decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
When the first segmented video is not the last segmented video to be played in the target video, in the process of playing the first segmented video, video data corresponding to the video within a preset time period after the playing ending time point of the first segmented video, that is, second segmented video data, can be acquired, and a plurality of second key encoding frames in the second segmented video data are decoded to obtain a plurality of second key decoding frames, so that when the playing of the first segmented video is completed, the second segmented video can be played based on the plurality of second key decoding frames.
And when the first segmented video is the last segmented video to be played in the target video, step 203 may not be executed, and step 204 may be directly executed.
Step 204: and finishing the playing of the first segmented video based on the first non-key decoding frame obtained by decoding and the first key decoding frame after the first key decoding frame.
The first non-key decoding frame obtained by decoding and the first key decoding frame after the first key decoding frame can be played according to the time sequence of the video frames, and when the first non-key decoding frame or the last non-key decoding frame is played, the playing of the first segmented video is finished.
Specifically, based on the decoded first non-key decoded frame and the first key decoded frame following the first key decoded frame, completing the playing of the first segment video may include: when the appointed first key decoding frame is played completely and all first non-key coding frames after the appointed first key decoding frame and before the next first key decoding frame of the appointed first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key coding frames are played in sequence; when the designated first key decoding frame is played completely and all first non-key encoded frames after the designated first key decoding frame and before the next first key decoding frame of the designated first key decoding frame are not decoded completely, playing the next first key decoding frame.
The specified first key decoding frame may be any one of the plurality of first key decoding frames. Specifically, the specified first key decoding frame may be the first key decoding frame, or may be any first key decoding frame after the first key decoding frame.
That is, when any one of the first key decoding frames is completely played, it may be firstly determined whether all the non-key encoded frames after the first key decoding frame and before the next first key decoding frame of the first key decoding frame are completely decoded. If all the non-key encoded frames are decoded, all the first non-key decoded frames obtained by decoding all the first non-key encoded frames can be played in sequence, and when the playing of the last non-key decoded frame in all the first non-key decoded frames is finished, the next first key decoded frame can be played in sequence. If the decoding of all the non-key encoded frames is not completed, frame skipping, i.e. skipping all the non-key encoded frames, can be selected to play the next first key decoded frame directly.
Since key frames can indicate key state information in the video, frame skipping when the decoding of all non-key encoded frames is not complete does not affect the viewer's acquisition of video content information. If the video does not jump to the next first key decoding frame for playing, frame jumping between non-key decoding frames may occur, and due to information incoherence caused by frame jumping between non-key decoding frames, a screen splash phenomenon of the played video may occur, and the viewing experience of audiences is influenced.
Further, when the designated first key decoding frame is completely played and all first non-key encoding frames after the designated first key decoding frame and before the next first key decoding frame of the designated first key decoding frame are not completely decoded, in the process of playing the next first key decoding frame, the decoding of the first non-key encoding frames before the next first key decoding frame may also be stopped, and the decoding of the non-first key encoding frames after the next first key decoding frame may be started in sequence according to the video frame order.
When the next first key decoding frame is played, the first non-key coding frame before the next first key decoding frame does not need to be played any more, and the decoding efficiency of the first non-key coding frame can be improved and the video playing effect is further improved by stopping decoding the first non-key coding frame before the next first key decoding frame and starting to sequentially decode the non-first key coding frames after the next first key decoding frame.
Step 205: and starting playing the second segmented video corresponding to the second segmented video data based on the first second key decoding frame in the plurality of second key decoding frames.
Specifically, according to the method in step 201, playing of the first segmented video corresponding to the first segmented video data may be started based on the first key decoding frame in the plurality of first key decoding frames, and playing of the second segmented video corresponding to the second segmented video data may be started based on the first second key decoding frame in the plurality of second key decoding frames. The specific implementation process of step 205 may refer to the related description of step 201, and is not described herein again in the embodiments of the present invention.
Step 206: and in the process of playing the second segmented video, sequentially decoding a plurality of second non-key coded frames in the second segmented video data according to the video frame sequence.
Specifically, the method may be performed according to step 202, in the process of playing the first segmented video, sequentially decoding a plurality of first non-key encoded frames in the first segmented video data according to the video frame order, and in the process of playing the second segmented video, sequentially decoding a plurality of second non-key encoded frames in the second segmented video data according to the video frame order. The specific implementation process of step 206 may refer to the related description of step 202, and is not described herein again in the embodiments of the present invention.
Step 207: and finishing the playing of the second segmented video based on the second non-key decoding frame obtained by decoding and a second key decoding frame after the first second key decoding frame.
Specifically, according to the method for playing the first segmented video based on the first non-key decoded frame obtained by decoding and the first key decoded frame after the first key decoded frame in step 204, the playing of the second segmented video may be completed based on the second non-key decoded frame obtained by decoding and the second key decoded frame after the first second key decoded frame. The specific implementation process of step 207 may refer to the related description of step 204, and is not described herein again in this embodiment of the present invention.
In addition, when the second segmented video is the last segmented video to be played in the target video, the playing of the target video can be stopped after the playing of the second segmented video is completed; when the second segmented video is not the last segmented video to be played in the target video, after the playing of the second segmented video is completed, the next segmented video of the second segmented video can be played according to the method for playing the second segmented video, and the playing of the target video is stopped until the playing of the last segmented video to be played in the target video is completed.
In the embodiment of the present invention, before playing a first segmented video in a target video, all key encoded frames in the first segmented video data may be decoded in advance to obtain a plurality of key decoded frames, and then, in the process of playing the first segmented video based on the plurality of key decoded frames, non-key encoded frames in the first segmented video data are sequentially decoded, that is, the non-key encoded frames are decoded while playing, so that the playing of the first segmented video may be completed based on the key decoded frames obtained by decoding in advance and the non-key decoded frames obtained by decoding in the playing process. Since all key coding frames in the segmented video data are only required to be decoded before playing, the decoding time before playing is reduced, and the video playing efficiency is improved.
Fig. 3 is a block diagram of a video playing apparatus according to an embodiment of the present invention, where the video playing apparatus may be a terminal such as a mobile phone, a tablet computer, or a computer, and referring to fig. 3, the apparatus includes a first playing module 301, a first decoding module 302, and a second playing module 303.
A first playing module 301, configured to start playing a first segmented video corresponding to the first segmented video data based on a first key decoding frame in the plurality of first key decoding frames;
the first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding a plurality of first key coding frames in the first segmented video data in advance;
a first decoding model 302, configured to sequentially decode, according to a video frame sequence, a plurality of first non-key encoded frames in the first segmented video data in a process of playing the first segmented video;
the second playing module 303 is configured to complete playing of the first segment video based on the first non-key decoded frame obtained by decoding and the first key decoded frame after the first key decoded frame.
Optionally, the apparatus further comprises:
the acquisition module is used for acquiring second segmented video data in the process of playing the first segmented video, wherein the second segmented video data refers to video data corresponding to a video in the target video within a preset time length after the playing ending time point of the first segmented video;
and the second decoding module is used for decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
Optionally, the second playing module 303 is specifically configured to:
when the appointed first key decoding frame is played completely and all first non-key coding frames after the appointed first key decoding frame and before the next first key decoding frame of the appointed first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key coding frames are played in sequence, wherein the appointed first key decoding frame is any one first key decoding frame in the plurality of first key decoding frames;
when the designated first key decoding frame is played completely and all first non-key encoded frames after the designated first key decoding frame and before the next first key decoding frame of the designated first key decoding frame are not decoded completely, playing the next first key decoding frame.
Optionally, the apparatus further comprises:
and the third decoding module is used for stopping decoding the first non-key coding frame before the next first key decoding frame in the process of playing the next first key decoding frame and sequentially decoding the non-first key coding frames after the next first key decoding frame according to the video frame sequence.
In the embodiment of the present invention, before playing a first segmented video in a target video, all key encoded frames in the first segmented video data may be decoded in advance to obtain a plurality of key decoded frames, and then, in the process of playing the first segmented video based on the plurality of key decoded frames, non-key encoded frames in the first segmented video data are sequentially decoded, that is, the non-key encoded frames are decoded while playing, so that the playing of the first segmented video may be completed based on the key decoded frames obtained by decoding in advance and the non-key decoded frames obtained by decoding in the playing process. Since all key coding frames in the segmented video data are only required to be decoded before playing, the decoding time before playing is reduced, and the video playing efficiency is improved.
It should be noted that: in the video playing apparatus provided in the foregoing embodiment, only the division of the functional modules is illustrated when playing video, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the video playing apparatus and the video playing method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 4 is a block diagram of a terminal 400 according to an exemplary embodiment of the present invention. The terminal 400 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The terminal 400 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
Generally, the terminal 400 includes: a processor 401 and a memory 402.
Processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor 401 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 401 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 402 is used to store at least one instruction for execution by processor 401 to implement the video playback method provided by the method embodiments herein.
In some embodiments, the terminal 400 may further optionally include: a peripheral interface 403 and at least one peripheral. The processor 401, memory 402 and peripheral interface 403 may be connected by bus or signal lines. Each peripheral may be connected to the peripheral interface 403 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 404, touch screen display 405, camera 406, audio circuitry 407, positioning components 408, and power supply 409.
The peripheral interface 403 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 401 and the memory 402. In some embodiments, processor 401, memory 402, and peripheral interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 401, the memory 402 and the peripheral interface 403 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 404 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 404 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 404 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 404 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 404 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 405 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to capture touch signals on or over the surface of the display screen 405. The touch signal may be input to the processor 401 as a control signal for processing. At this point, the display screen 405 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 405 may be one, providing the front panel of the terminal 400; in other embodiments, the display screen 405 may be at least two, respectively disposed on different surfaces of the terminal 400 or in a folded design; in still other embodiments, the display 405 may be a flexible display disposed on a curved surface or a folded surface of the terminal 400. Even further, the display screen 405 may be arranged in a non-rectangular irregular pattern, i.e. a shaped screen. The Display screen 405 may be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The camera assembly 406 is used to capture images or video. Optionally, camera assembly 406 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 406 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 407 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 401 for processing, or inputting the electric signals to the radio frequency circuit 404 for realizing voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 400. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 407 may also include a headphone jack.
The positioning component 408 is used to locate the current geographic position of the terminal 400 for navigation or LBS (location based Service). The positioning component 408 can be a positioning component based on the GPS (global positioning System) in the united states, the beidou System in china, or the galileo System in russia.
The power supply 409 is used to supply power to the various components in the terminal 400. The power source 409 may be alternating current, direct current, disposable or rechargeable. When the power source 409 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal 400 also includes one or more sensors 410. The one or more sensors 410 include, but are not limited to: acceleration sensor 411, gyro sensor 412, pressure sensor 413, fingerprint sensor 414, optical sensor 415, and proximity sensor 416.
The acceleration sensor 411 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 400. For example, the acceleration sensor 411 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 401 may control the touch display screen 405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 411. The acceleration sensor 411 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 412 may detect a body direction and a rotation angle of the terminal 400, and the gyro sensor 412 may cooperate with the acceleration sensor 411 to acquire a 3D motion of the terminal 400 by the user. From the data collected by the gyro sensor 412, the processor 401 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 413 may be disposed on a side bezel of the terminal 400 and/or a lower layer of the touch display screen 405. When the pressure sensor 413 is disposed on the side frame of the terminal 400, a user's holding signal to the terminal 400 can be detected, and the processor 401 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 413. When the pressure sensor 413 is disposed at the lower layer of the touch display screen 405, the processor 401 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 405. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 414 is used for collecting a fingerprint of the user, and the processor 401 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, processor 401 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 414 may be disposed on the front, back, or side of the terminal 400. When a physical key or vendor Logo is provided on the terminal 400, the fingerprint sensor 414 may be integrated with the physical key or vendor Logo.
The optical sensor 415 is used to collect the ambient light intensity. In one embodiment, the processor 401 may control the display brightness of the touch display screen 405 based on the ambient light intensity collected by the optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 405 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 405 is turned down. In another embodiment, the processor 401 may also dynamically adjust the shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 415.
A proximity sensor 416, also known as a distance sensor, is typically disposed on the front panel of the terminal 400. The proximity sensor 416 is used to collect the distance between the user and the front surface of the terminal 400. In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually decreases, the processor 401 controls the touch display screen 405 to switch from the bright screen state to the dark screen state; when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually becomes larger, the processor 401 controls the touch display screen 405 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 4 is not intended to be limiting of terminal 400 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
In another embodiment, a computer-readable storage medium is provided, which has instructions stored thereon, and when executed by a processor, the instructions implement any one of the video playing methods described in the embodiments of fig. 1 or fig. 2.
In another embodiment, a computer program product containing instructions is provided, which when run on a computer causes the computer to perform any of the video playback methods described in the embodiments of fig. 1 or fig. 2 above.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (8)

1. A video playback method, the method comprising:
starting to play a first segmented video corresponding to the first segmented video data based on a first key decoding frame in the plurality of first key decoding frames;
the first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding all first key coding frames in the first segmented video data in advance before the first segmented video is played;
in the process of playing the first segmented video, sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to the video frame sequence;
when a specified first key decoding frame is played completely and all first non-key encoding frames after the specified first key decoding frame and before a next first key decoding frame of the specified first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key encoding frames are played sequentially, wherein the specified first key decoding frame is any one of the plurality of first key decoding frames;
when a designated first key decoded frame is played out and all first non-key encoded frames after the designated first key decoded frame and before a next first key decoded frame of the designated first key decoded frame are not decoded out, playing the next first key decoded frame.
2. The method of claim 1, wherein prior to completing playback of the first segmented video, further comprising:
in the process of playing the first segmented video, obtaining second segmented video data, wherein the second segmented video data refers to video data corresponding to a video in the target video within a preset time length after the playing ending time point of the first segmented video;
and decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
3. The method of claim 1, wherein the method further comprises:
and in the process of playing the next first key decoding frame, stopping decoding the first non-key coding frame before the next first key decoding frame, and sequentially decoding the non-first key coding frames after the next first key decoding frame according to the video frame sequence.
4. A video playback apparatus, comprising:
the first playing module is used for starting to play a first segmented video corresponding to the first segmented video data based on a first key decoding frame in the plurality of first key decoding frames;
the first segmented video data is video data corresponding to a video with a preset time duration in a target video to be played, and the plurality of first key decoding frames are obtained by decoding all first key coding frames in the first segmented video data in advance before the first segmented video is played;
the first decoding model is used for sequentially decoding a plurality of first non-key coding frames in the first segmented video data according to a video frame sequence in the process of playing the first segmented video;
a second playing module, configured to complete playing of the first segmented video based on a first non-key decoded frame obtained by decoding and a first key decoded frame subsequent to the first key decoded frame;
wherein the second playing module is specifically configured to:
when a specified first key decoding frame is played completely and all first non-key encoding frames after the specified first key decoding frame and before a next first key decoding frame of the specified first key decoding frame are decoded completely, all first non-key decoding frames obtained by decoding all the first non-key encoding frames are played sequentially, wherein the specified first key decoding frame is any one of the plurality of first key decoding frames;
when a designated first key decoded frame is played out and all first non-key encoded frames after the designated first key decoded frame and before a next first key decoded frame of the designated first key decoded frame are not decoded out, playing the next first key decoded frame.
5. The apparatus of claim 4, wherein the apparatus further comprises:
an obtaining module, configured to obtain second segment video data in a process of playing the first segment video, where the second segment video data is video data corresponding to a video in the target video within a preset time period after a playing end time point of the first segment video;
and the second decoding module is used for decoding a plurality of second key coding frames in the second segmented video data to obtain a plurality of second key decoding frames.
6. The apparatus of claim 4, wherein the apparatus further comprises:
and the third decoding module is used for stopping decoding the first non-key coding frame before the next first key decoding frame in the process of playing the next first key decoding frame and sequentially decoding the non-first key coding frame after the next first key decoding frame according to the video frame sequence.
7. A video playback apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of any of the methods of claims 1-3.
8. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the steps of any of the methods of claims 1-3.
CN201711258470.8A 2017-11-30 2017-11-30 Video playing method, device and storage medium Active CN107888975B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711258470.8A CN107888975B (en) 2017-11-30 2017-11-30 Video playing method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711258470.8A CN107888975B (en) 2017-11-30 2017-11-30 Video playing method, device and storage medium

Publications (2)

Publication Number Publication Date
CN107888975A CN107888975A (en) 2018-04-06
CN107888975B true CN107888975B (en) 2020-02-21

Family

ID=61772870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711258470.8A Active CN107888975B (en) 2017-11-30 2017-11-30 Video playing method, device and storage medium

Country Status (1)

Country Link
CN (1) CN107888975B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111641824B (en) * 2019-03-01 2022-08-05 杭州海康威视数字技术股份有限公司 Video reverse playing method and device
CN112492384B (en) * 2019-09-12 2023-03-24 曙光信息产业(北京)有限公司 Video decoding method and device and computer equipment
CN113190357A (en) * 2021-05-17 2021-07-30 杭州小鱼互动科技有限公司 Desktop system capable of running under low-configuration and low-memory conditions

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103856812A (en) * 2014-03-25 2014-06-11 北京奇艺世纪科技有限公司 Video playing method and device
CN104717509A (en) * 2015-03-31 2015-06-17 北京奇艺世纪科技有限公司 Method and device for decoding video
CN105187895A (en) * 2015-09-17 2015-12-23 北京暴风科技股份有限公司 Data-caching method and system for playing videos on mobile platform by means of hardware acceleration
CN106254869A (en) * 2016-08-25 2016-12-21 腾讯科技(深圳)有限公司 The decoding method of a kind of video data, device and system
CN106792154A (en) * 2016-12-02 2017-05-31 广东赛特斯信息科技有限公司 The frame-skipping synchronization system and its control method of video player

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103856812A (en) * 2014-03-25 2014-06-11 北京奇艺世纪科技有限公司 Video playing method and device
CN104717509A (en) * 2015-03-31 2015-06-17 北京奇艺世纪科技有限公司 Method and device for decoding video
CN105187895A (en) * 2015-09-17 2015-12-23 北京暴风科技股份有限公司 Data-caching method and system for playing videos on mobile platform by means of hardware acceleration
CN106254869A (en) * 2016-08-25 2016-12-21 腾讯科技(深圳)有限公司 The decoding method of a kind of video data, device and system
CN106792154A (en) * 2016-12-02 2017-05-31 广东赛特斯信息科技有限公司 The frame-skipping synchronization system and its control method of video player

Also Published As

Publication number Publication date
CN107888975A (en) 2018-04-06

Similar Documents

Publication Publication Date Title
CN108391171B (en) Video playing control method and device, and terminal
CN108401124B (en) Video recording method and device
CN111372126B (en) Video playing method, device and storage medium
CN109348247B (en) Method and device for determining audio and video playing time stamp and storage medium
CN111147878B (en) Stream pushing method and device in live broadcast and computer storage medium
CN108966008B (en) Live video playback method and device
CN110022489B (en) Video playing method, device and storage medium
CN110324689B (en) Audio and video synchronous playing method, device, terminal and storage medium
CN111586431B (en) Method, device and equipment for live broadcast processing and storage medium
CN109635133B (en) Visual audio playing method and device, electronic equipment and storage medium
EP4007287A1 (en) Video processing method, device, terminal, and storage medium
CN112822522B (en) Video playing method, device, equipment and storage medium
CN107896337B (en) Information popularization method and device and storage medium
CN108845777B (en) Method and device for playing frame animation
CN111586444B (en) Video processing method and device, electronic equipment and storage medium
CN107888975B (en) Video playing method, device and storage medium
CN111092991B (en) Lyric display method and device and computer storage medium
CN111083526B (en) Video transition method and device, computer equipment and storage medium
CN110868642B (en) Video playing method, device and storage medium
CN112616082A (en) Video preview method, device, terminal and storage medium
CN109005359B (en) Video recording method, apparatus and storage medium
CN108966026B (en) Method and device for making video file
CN110543403A (en) power consumption evaluation method and device
CN111711841B (en) Image frame playing method, device, terminal and storage medium
CN111586433B (en) Code rate adjusting method, device, equipment and storage medium

Legal Events

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