CN111372117A - Video playing method and device, electronic equipment and storage medium - Google Patents

Video playing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111372117A
CN111372117A CN201811589787.4A CN201811589787A CN111372117A CN 111372117 A CN111372117 A CN 111372117A CN 201811589787 A CN201811589787 A CN 201811589787A CN 111372117 A CN111372117 A CN 111372117A
Authority
CN
China
Prior art keywords
playing
played
image
buffer area
video
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811589787.4A
Other languages
Chinese (zh)
Other versions
CN111372117B (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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN201811589787.4A priority Critical patent/CN111372117B/en
Publication of CN111372117A publication Critical patent/CN111372117A/en
Application granted granted Critical
Publication of CN111372117B publication Critical patent/CN111372117B/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/44004Processing 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 video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47217End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Abstract

The invention provides a video playing method, a video playing device, electronic equipment and a storage medium, wherein the method comprises the following steps: determining a current playing mode according to a received video playing instruction; determining a target pre-play buffer area from the first pre-play buffer area and the second pre-play buffer area according to the play mode; judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode; if yes, playing the image to be played according to the playing mode and the playing sequence corresponding to the playing mode; the played image is stored in another pre-play buffer. In the invention, the image to be played and the played image can be buffered in two directions by setting the first pre-playing buffer area and the second pre-playing buffer area corresponding to different playing modes, when the video playing direction is switched, the image in the target pre-playing buffer area can be directly played, the corresponding code stream does not need to be buffered again, the buffering time is shortened, and the purpose of improving the user experience is achieved.

Description

Video playing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of multimedia playing technologies, and in particular, to a video playing method and apparatus, an electronic device, and a storage medium.
Background
In the prior art, when a video is being played, the process is as shown in fig. 1, that is, a code stream is obtained from a video file or a network, the obtained code stream is put into a buffer area before decoding, a decoder obtains the code stream from the buffer area before decoding to decode, a decoded image is put into a buffer area before playing, and then a timer plays the decoded image on a display according to a frame rate or a timestamp.
When the video is played backwards, the process is as shown in fig. 2, that is, the reverse code stream is obtained again from the video file or the network, the obtained reverse code stream is placed in the pre-decoding buffer area, the decoder obtains the reverse code stream from the pre-decoding buffer area to decode, the decoded image is placed in the post-decoding buffer area, a Group of GOPs (Group of pictures) in the post-decoding buffer area is turned over, the turned-over image is placed in the pre-playing buffer area, and then the turned-over image is played on the display by the timer according to the frame rate or the time stamp.
Because the buffer area in the prior art is unidirectional when buffering, when forward playback is switched to reverse playback, the forward playback stream needs to be emptied and the reverse playback stream needs to be re-buffered, and when reverse playback is switched to forward playback, the reverse playback stream also needs to be emptied, the forward playback stream needs to be re-buffered, and then decoding and playing are performed, so that the consumed time is long. If the user frequently switches the playing direction of the video, the user experience is poor.
Disclosure of Invention
The invention provides a video playing method, a video playing device, electronic equipment and a storage medium, which are used for solving the technical problem of poor user experience when a user frequently switches the playing direction of a video in the prior art.
To overcome the above technical problem, according to an aspect of the present invention, there is provided a video playing method, including:
determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode;
according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area;
judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode;
if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode;
the played image is stored in another pre-play buffer.
In the invention, a first pre-playing buffer area and a second pre-playing buffer area corresponding to a video forward playing mode and a video reverse playing mode are respectively arranged, when the playing mode corresponding to a video playing instruction is determined, a target pre-playing buffer area corresponding to the playing mode can be further determined, when the target pre-playing buffer area is judged to store the image to be played corresponding to the playing mode, the image to be played can be directly played according to the playing sequence corresponding to the playing mode, and the played image is stored in the other pre-playing buffer area. Therefore, the image to be played and the played image can be buffered in two directions through the first pre-playing buffer area and the second pre-playing buffer area, after a video playing instruction is received, one of the pre-playing buffer areas can be used as a target pre-playing buffer area, the image in the target pre-playing buffer area is directly played, even if the user switches the video playing direction in a frequency mode, the corresponding code stream does not need to be buffered again, the buffering time is shortened, and the user experience is improved.
Specifically, the determining whether the image to be played corresponding to the play mode is stored in the target pre-play buffer includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image of which the timestamp corresponds to the initial time point exists in the target buffer area before playing according to the timestamp of each frame of image in the target buffer area before playing;
if yes, determining each image to be played according to the time stamp of each frame of image in the buffer area before the target is played, the initial time point and the playing sequence corresponding to the playing mode.
After the target pre-playing buffer area is determined, whether an image to be played is stored in the target pre-playing buffer area needs to be judged, if the image to be played is not stored in the target pre-playing buffer area, the corresponding image needs to be buffered, and if the image to be played is stored in the target pre-playing buffer area, the image to be played which is stored in the target pre-playing buffer area is directly played, so that the aim of shortening the buffering time is fulfilled.
Specifically, the determining each image to be played according to the timestamp and the initial time point of each frame of image in the buffer before the target playing and the playing sequence corresponding to the playing mode includes:
when the playing mode is a video forward playing mode, determining the image with the time stamp being greater than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing;
and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Because the playing mode comprises a video forward playing mode and a video reverse playing mode, when the playing mode is the video forward playing mode, the image of the timestamp after the initial time point is determined as the image to be played, and when the playing mode is the video reverse playing mode, the image of the timestamp before the initial time point is determined as the image to be played, so that the playing is carried out according to the playing sequence corresponding to the playing mode.
Specifically, the method further comprises:
judging whether the number of frames of the image to be played stored in the buffer area before the target playing is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer area from the first pre-decoding buffer area and the second pre-decoding buffer area according to the play mode;
acquiring a video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played;
and storing the image acquired after decoding in the target pre-playing buffer area.
After each frame of image is played, the frame of image is cleared from the storage address in the target pre-playing buffer area and is stored in another pre-playing buffer area, so as to continuously reduce the number of images to be played in the target pre-playing buffer area, in order to ensure that the video can be continuously played, a first preset threshold value of the target pre-playing buffer area can be preset, that is, when the number of frames of the images to be played stored in the target pre-playing buffer area is smaller than the first preset threshold value, the target pre-decoding buffer area is automatically determined from the first pre-decoding buffer area and the second pre-decoding buffer area, the video frames to be played are obtained from the target pre-decoding buffer area, then the video frames are decoded, and the images obtained after decoding are stored in the target pre-playing buffer area.
Specifically, when the play mode is the video reverse play mode, the storing the image obtained after decoding in the target pre-decoding buffer includes:
and turning the images acquired after decoding by taking a group of GOPs as a unit, and storing the turned images in the target pre-playing buffer area.
When the playing mode is a video reverse playing mode, the video frames to be played are acquired from the buffer area before target decoding and are coded in a positive sequence, so the images to be played acquired after decoding are also coded in a positive sequence, and therefore, the images to be played are turned over by taking a group of GOPs as a unit, reverse-sequence storage of each frame of image in each group of GOPs can be realized, reverse playing of the video is realized, I frame loss can be prevented, and reverse playing of the video cannot be realized.
Specifically, after the images to be played are played according to the playing mode and the playing sequence corresponding to the playing mode, the method further includes:
the played video frame is stored into another pre-decode buffer.
According to the invention, the bidirectional buffering of the video frame to be played and the played video frame can be realized by respectively setting the first pre-decoding buffer area and the second pre-decoding buffer area corresponding to the video forward playing mode and the video reverse playing mode, and after a video playing instruction is received, the corresponding video frame does not need to be buffered again, so that the buffering time is shortened, and the user experience is improved.
Specifically, after storing the played video frame into another pre-decoding buffer, the method further includes:
judging whether the frame number of the played video frame stored in the other pre-decoding buffer area is greater than a second preset threshold value or not;
if yes, determining a first number of target video frames with earlier storage time according to the storage time of the played video frames of each frame, and deleting the target video frames.
In order to ensure smooth playing when the video playing direction is switched, it is necessary to delete the played video frame with earlier storage time to provide a storage space for the newly played video frame.
Specifically, after storing the played image in another pre-play buffer, the method further includes:
judging whether the frame number of the played images stored in the other buffer area before playing is larger than a third preset threshold value or not;
if yes, determining a second number of target images with earlier storage time according to the storage time of the played images of each frame, and deleting the target images.
Similarly, in order to ensure that the playing flow is smooth when the video playing direction is switched, the played image stored in another pre-playing buffer area needs to be the latest played image, and therefore, the played image with an earlier storage time needs to be deleted to provide a storage space for the latest played image.
According to another aspect of the present invention, there is also provided a video playback apparatus, including:
the device comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining a current playing mode according to a received video playing instruction, and the playing mode comprises a video forward playing mode and a video reverse playing mode;
a second determining module, configured to determine a target pre-play buffer area from the first pre-play buffer area and the second pre-play buffer area according to the play mode;
the first judgment module is used for judging whether the target pre-playing buffer area stores the image to be played corresponding to the playing mode;
the playing module is used for playing the images to be played according to the playing mode according to the playing sequence corresponding to the playing mode if the judgment result of the first judgment module is yes;
the first storage module is used for storing the played image into another buffer area before playing.
Specifically, the first determining module includes:
the first determining unit is used for determining the initial time point of video playing according to the playing instruction;
the judging unit is used for judging whether an image of which the timestamp corresponds to the initial time point exists in the target pre-playing buffer area or not according to the timestamp of each frame of image in the target pre-playing buffer area;
and the second determining unit is used for determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer area, the initial time point and the playing sequence corresponding to the playing mode if the judgment result of the judging unit is yes.
Specifically, the second determining unit is specifically configured to:
when the playing mode is a video forward playing mode, determining the image with the time stamp being greater than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing;
and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Specifically, the apparatus further comprises:
the second judgment module is used for judging whether the number of frames of the images to be played stored in the buffer area before the target playing is smaller than a first preset threshold value or not;
a third determining module, configured to determine, if the determination result of the second determining module is yes, a target pre-decoding buffer area from the first pre-decoding buffer area and the second pre-decoding buffer area according to the play mode;
the decoding module is used for acquiring the video frame to be played from the target pre-decoding buffer area and decoding the acquired video frame to be played;
and the second storage module is used for storing the image acquired after decoding into the target pre-playing buffer area.
Specifically, when the play mode is the video reverse play mode, the second storage module is specifically configured to invert the image obtained after decoding by using a group of GOPs as a unit, and store the inverted image in the target pre-play buffer.
Specifically, the apparatus further comprises:
and the third storage module is used for storing the played video frame into another buffer area before decoding after the images to be played are played according to the playing mode and the playing sequence corresponding to the playing mode.
Specifically, the apparatus further comprises:
the third judging module is used for judging whether the number of the played video frames stored in another pre-decoding buffer zone is larger than a second preset threshold value or not after the played video frames are stored in the other pre-decoding buffer zone;
and the first deleting module is used for determining a first number of target video frames with earlier storage time according to the storage time of each frame of played video frames and deleting the target video frames if the judgment result of the third judging module is positive.
Specifically, the apparatus further comprises:
the fourth judging module is used for judging whether the number of frames of the played images stored in another buffer area before playing is larger than a third preset threshold value or not after the played images are stored in the other buffer area before playing;
and the second deleting module is used for determining a second number of target images with earlier storage time according to the storage time of each frame of played images and deleting the target images if the judgment result of the fourth judging module is yes.
According to another aspect of the present invention, there is also provided an electronic apparatus, including: comprising a memory and a processor;
the processor is used for reading the program in the memory and executing the steps in the video playing method.
According to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program executable by an electronic device, the program causing the electronic device to perform the steps of the above-mentioned video playing method when running on the electronic device.
The invention has the following beneficial effects:
the invention provides a video method and a video device, wherein the method comprises the following steps: determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode; according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area; judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode; if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode; the played image is stored in another pre-play buffer. In the invention, through respectively arranging the first pre-playing buffer area and the second pre-playing buffer area corresponding to the video forward playing mode and the video reverse playing mode, after receiving a video playing instruction, one of the pre-playing buffer areas can be used as a target pre-playing buffer area, an image in the target pre-playing buffer area is directly played, and then the played image is stored in the other pre-playing buffer area, so that the image to be played and the played image can be bidirectionally buffered, a user does not need to buffer a corresponding code stream again when frequently switching the video playing direction, the buffering time is greatly shortened, and the user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a prior art video playback flow control;
FIG. 2 is a schematic diagram of the flow control of the video reverse playing in the prior art;
fig. 3 is a flowchart of a video playing method provided in an embodiment of the present invention;
fig. 4 is a flowchart of requesting to acquire an image to be played according to an embodiment of the present invention;
fig. 5 is a schematic flow control diagram of video playback provided in the embodiment of the present invention;
fig. 6 is a schematic flow control diagram of video reverse playing provided in the embodiment of the present invention;
fig. 7 is a flowchart illustrating a video playing method according to an embodiment of the present invention;
fig. 8 is a block diagram of a video playback device provided in the embodiment of the present invention;
fig. 9 is a block diagram of a first determining module provided in the embodiment of the present invention;
fig. 10 is an electronic device provided in an embodiment of the present invention.
Detailed Description
In the prior art, the buffer area is unidirectional when buffering, and when the buffer area reaches a preset maximum buffer value, the forward playing of the video is switched to the reverse playing of the video, or the reverse playing of the video is switched to the forward playing of the video, the code stream corresponding to the current playing mode needs to be buffered again, and the code stream is decoded to obtain an image, so that the consumed time is long. Therefore, the problem of poor user experience caused by frequent switching of the playing direction of the video exists in the prior art.
In order to overcome the above problems, embodiments of the present invention provide a video playing method, apparatus, electronic device, and storage medium, where the method includes: determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode; according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area; judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode; if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode; the played image is stored in another pre-play buffer.
As can be seen from the above description, in the embodiment of the present invention, by respectively providing the first pre-play buffer area and the second pre-play buffer area corresponding to the video forward-play mode and the video reverse-play mode, after receiving a video play instruction, one of the pre-play buffer areas can be used as a target pre-play buffer area, and an image in the target pre-play buffer area is directly played, and then the played image is stored in the other pre-play buffer area, so that bidirectional buffering can be performed on the image to be played and the played image, so that a user does not need to re-buffer a corresponding code stream when frequently switching the video play direction, buffering time is greatly shortened, and user experience is improved.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
fig. 3 is a schematic flowchart of a video playing method provided in an embodiment of the present invention, where the method includes:
step S301: and determining the current playing mode according to the received video playing instruction.
In the embodiment of the present invention, the video playing instruction may be a video forward playing instruction or a video reverse playing instruction, and accordingly, the playing mode may be a video forward playing mode or a video reverse playing mode.
Step S302: and determining a target pre-play buffer area from the first pre-play buffer area and the second pre-play buffer area according to the play mode.
In embodiments of the present invention, the first pre-playback buffer may correspond to a video forward mode, the second pre-playback buffer may correspond to a video reverse mode, and, accordingly, in the embodiment of the present invention, the first pre-playing buffer can be used to store the image to be played, the second pre-playing buffer can be used to store the played image, therefore, in the embodiment of the invention, the bidirectional buffering of the image to be played and the played image is realized by respectively setting the first pre-play buffer area and the second pre-play buffer area corresponding to the video forward-play mode and the video reverse-play mode, and when the current playing mode is determined to be the video normal playing mode, the first pre-playing buffer area is determined to be the target pre-playing buffer area, or when the current play mode is determined to be the video reverse play mode, determining the second pre-play buffer area as the target pre-play buffer area.
In the embodiment of the present invention, the second pre-play buffer area may also correspond to the video forward play mode, and the first pre-play buffer area may also correspond to the video reverse play mode, so that in the embodiment of the present invention, the second pre-play buffer area is used to store the image to be played, and the first pre-play buffer area is used to store the played image. Therefore, it should be noted that, in the embodiment of the present invention, the correspondence between the video playing mode and the pre-playing buffer area is not specifically limited, as long as different video playing modes can respectively correspond to different pre-playing buffer areas.
Step S303: and judging whether the target pre-playing buffer area stores the image to be played corresponding to the playing mode.
That is to say, after determining the target pre-play buffer, it needs to determine whether to store the image to be played in the target pre-play buffer, and if the image to be played is not stored in the target pre-play buffer, the image to be played needs to be buffered according to the current play mode.
If the image to be played is stored in the buffer before the target playing, the image to be played is played only according to the playing sequence corresponding to the playing mode, that is, step S304.
Step S304: if yes, playing the image to be played according to the playing mode and the playing sequence corresponding to the playing mode.
Taking the case that the first pre-play buffer area corresponds to the video forward playing mode and the second pre-play buffer area corresponds to the video reverse playing mode, when the current playing mode is the video forward playing mode, the first pre-play buffer area is determined as the target pre-play buffer area, and if the images to be played are stored in the first pre-play buffer area, the forward reading is performed on the first pre-play buffer area, so that the video forward playing can be realized. And when the current play mode is the video reverse play mode, determining the second pre-play buffer area as a target pre-play buffer area, and if the images to be played are stored in the second pre-play buffer area, reversely reading the second pre-play buffer area to realize the video reverse play.
Step S305, the played image is stored in another pre-playing buffer zone.
The played image is stored in another buffer area before playing, so that the played image which is played last can be stored, and the played image can be stored while being played according to the playing sequence corresponding to the current playing mode. Therefore, when the user switches the video playing direction, only the target pre-playing buffer area needs to be determined again, and the corresponding code stream does not need to be buffered again.
Therefore, in the invention, the bidirectional buffering of the image to be played and the played image can be realized by setting the first pre-playing buffer area and the second pre-playing buffer area, and even if a user frequently switches the video playing direction, the corresponding code stream does not need to be buffered again, thereby greatly shortening the image buffering time and improving the user experience.
When the video is played, if the video is being played, the image in the buffer area before the target playing needs to be read in the forward direction, and if the video is being played in the reverse direction, the image in the buffer area before the target playing needs to be read in the reverse direction.
Example two:
on the basis of the foregoing embodiment, in an embodiment of the present invention, the determining whether the image to be played corresponding to the play mode is stored in the target pre-play buffer includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image of which the timestamp corresponds to the initial time point exists in the target buffer area before playing according to the timestamp of each frame of image in the target buffer area before playing;
if yes, determining each image to be played according to the time stamp of each frame of image in the buffer area before the target is played, the initial time point and the playing sequence corresponding to the playing mode.
That is to say, after receiving a video playing instruction, an initial time point of video playing needs to be determined according to the video playing instruction, for example, a playing time length corresponding to the whole video is 10min, if a video playing instruction sent by a user is received at 5min, the initial time point of video playing is determined to be 5min, at this time, it needs to be determined whether an image corresponding to a timestamp and 5min exists in a buffer before target playing, and if so, each image to be played is determined according to the timestamp of each frame of image in the buffer before target playing, the initial time point and a playing sequence corresponding to the playing mode.
Specifically, determining each image to be played according to the timestamp and the initial time point of each frame of image in the buffer before the target playing and the playing sequence corresponding to the playing mode includes:
and when the playing mode is a video forward playing mode, determining the image with the time stamp being more than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Still in the above embodiment, for example, the first pre-play buffer corresponds to a video forward play mode, and the second pre-play buffer corresponds to a video reverse play mode, if the play mode is the video forward play mode, the corresponding target pre-play buffer is the first pre-play buffer, at this time, the image pre-buffered in the first pre-play buffer needs to be read in the forward direction, and if the timestamp corresponding to the image pre-buffered in the first pre-play buffer is greater than or equal to 5min, the image with the timestamp greater than or equal to 5min is determined as the image to be played.
And when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Still in the above embodiment, for example, the first pre-play buffer corresponds to a video forward play mode, and the second pre-play buffer corresponds to a video reverse play mode, if the play mode is the video reverse play mode, the corresponding target pre-play buffer is the second pre-play buffer, at this time, the image pre-buffered in the second pre-play buffer needs to be reversely read, and if the timestamp corresponding to the image pre-buffered in the second pre-play buffer is less than or equal to 5min, the image with the timestamp less than or equal to 5min is determined as the image to be played.
Example three:
to ensure that the image to be played stored in the target pre-play buffer can meet the requirement of the current play instruction, on the basis of the above embodiment, in an embodiment of the present invention, as shown in fig. 4, the method further includes:
step S401: and judging whether the frame number of the image to be played stored in the buffer area before the target playing is smaller than a first preset threshold value.
Step S402: if yes, according to the play-back mode, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone.
Step S403: and acquiring the video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played.
Step S404: and storing the image acquired after decoding in the target pre-playing buffer area.
It can be seen from the above embodiments that after each frame of image is played, the frame of image is cleared from the storage address in the target pre-playing buffer and stored in another pre-playing buffer, so that the number of images to be played in the target pre-playing buffer is continuously reduced, so as to ensure that the images to be played in the target pre-playing buffer can meet the requirement of the current playing instruction, after each frame of image is played, it is necessary to determine whether the number of frames of images to be played stored in the target pre-playing buffer is smaller than a first preset threshold, if the first preset threshold is 50, it is necessary to determine the number of frames of images to be played stored in the target pre-playing buffer is smaller than 50 after each frame of image is played, and if the number of frames of images to be played stored in the target pre-playing buffer is smaller than 50, it is necessary to determine the target pre-decoding buffer from the first pre-decoding buffer and the second pre-decoding buffer according to the current playing mode, and requesting to acquire the video frame to be played from the target pre-decoding buffer area, then decoding the acquired video frame to be played, and storing the image acquired after decoding into the target pre-playing buffer area.
Therefore, in the embodiment of the present invention, in the video playing process, when the number of frames of the to-be-played image stored in the target pre-playing buffer is smaller than the first preset threshold, the to-be-played video frame is requested to be acquired from the target pre-decoding buffer, so that the video can be ensured to be continuously played.
On the basis of the above embodiment, in the embodiment of the present invention, after the image to be played is played according to the playing mode and the playing sequence corresponding to the playing mode, as shown in fig. 4, the method further includes:
step S405: the played video frame is stored into another pre-decode buffer.
In embodiments of the present invention, the first pre-decode buffer may correspond to a video forward mode, the second pre-decode buffer may correspond to a video reverse mode, and, accordingly, in the embodiment of the present invention, the first pre-decoding buffer can be used for storing the video frames to be played, the second pre-decoding buffer can be used for storing the played video frames, therefore, by setting the first pre-decoding buffer and the second pre-decoding buffer corresponding to the video forward mode and the video reverse mode respectively in the embodiment of the present invention, the bidirectional buffering of the video frame to be played and the played video frame can be realized, and when the current playing mode is determined to be the video forward playing mode, the first pre-decoding buffer area is determined to be the target pre-decoding buffer area, or when the current play mode is determined to be the video reverse play mode, determining the second pre-decoding buffer area as a target pre-decoding buffer area.
Therefore, in the embodiment of the invention, the bidirectional buffering of the video frame to be played and the played video frame can be realized by respectively setting the first pre-decoding buffer area and the second pre-decoding buffer area, and even if a user frequently switches the video playing direction, the corresponding code stream does not need to be buffered again, so that the image buffering time can be greatly shortened, and the user experience can be improved.
In the embodiment of the present invention, the second pre-decoding buffer may also correspond to the forward video playing mode, and the first pre-decoding buffer may also correspond to the reverse video playing mode, so that in the embodiment of the present invention, the second pre-decoding buffer is used to store the video frames to be played, and the first pre-decoding buffer is used to store the played video frames. Therefore, it should be noted that, in the embodiment of the present invention, the correspondence between the video playback mode and the pre-decoding buffer is not specifically limited, as long as different video playback modes can respectively correspond to different pre-decoding buffers.
Specifically, in the embodiment of the present invention, taking as an example that the first pre-play buffer corresponds to the video forward playing mode, the second pre-play buffer corresponds to the video reverse playing mode, the first pre-decode buffer corresponds to the video forward playing mode, and the second pre-decode buffer corresponds to the video reverse playing mode, when the playing mode is the video forward playing mode, since the pre-stored video frames in the first pre-decode buffer are forward-sequence codes, the images to be played obtained after decoding by the decoder are also forward-sequence codes, and therefore the images to be played obtained after decoding can be directly stored in the first pre-play buffer.
On the basis of the foregoing embodiment, in the embodiment of the present invention, when the play mode is the video reverse play mode, since the stored video frames in the second pre-decoding buffer are encoded in the positive order, and when the video play is performed, the image in the second pre-decoding buffer needs to be reversely read, the storing the image obtained after decoding in the target pre-decoding buffer includes:
and turning the images acquired after decoding by taking a group of GOPs as a unit, and storing the turned images in the target pre-playing buffer area.
That is to say, since the video frames to be played obtained from the second pre-decoding buffer are coded in a positive sequence, the images to be played obtained after decoding are also coded in a positive sequence, and therefore, to implement video reverse playing, the images to be played need to be turned over in units of a group of GOPs, so as to implement reverse storage of each frame of image in each group of GOPs.
For example, the video frames to be played in the buffer area before the second decoding are stored in a non-full I-frame encoding manner, if the video frames included in a group of GOPs are I1, P2, P3, and P4 … P100, the images obtained after decoding the video frames are corresponding to image 1, image 2, image 3, and image 4 … image 100, and in order to realize the reverse playback of the video, image 100 should be preferentially stored, and then each frame of image is sequentially stored in a reverse order.
Because the I frame is a complete picture, and the P frame records the change relative to the I frame, the P frame can not be decoded without the I frame, therefore, in the embodiment of the invention, the images to be played are overturned by taking a group of GOPs as a unit, the reverse order storage of each frame of image in each group of GOPs can be realized, the video reverse playing can be realized, and meanwhile, the I frame loss can be prevented, and the video reverse playing can not be realized.
Example four:
in order to ensure that the playing flow is smoother when the video playing direction is switched, it is necessary to make the played image stored in another pre-playing buffer area be the latest played image, and the played video frame stored in another pre-decoding buffer area be the latest played video frame, so on the basis of the above embodiment, in the embodiment of the present invention, after the played video frame is stored in another pre-decoding buffer area, in order to ensure that the played video frame stored in another pre-decoding buffer area is the latest played video frame, the method further includes:
judging whether the frame number of the played video frame stored in the other pre-decoding buffer area is greater than a second preset threshold value or not;
if yes, determining a first number of target video frames with earlier storage time according to the storage time of the played video frames of each frame, and deleting the target video frames.
That is to say, after each frame of video frame is played, it is necessary to determine whether the number of frames of the played video frame stored in another pre-decoding buffer area is greater than a second preset threshold, if the preset second preset threshold is 50, the first number is 25, therefore, after each frame of video frame is played, it is necessary to determine whether the number of frames of the video frame to be played stored in another pre-decoding buffer area is greater than 50, and if the number of frames of the played video frame stored in another pre-decoding buffer area is greater than 50 at this time, it is necessary to determine the 25 frames of the played video frame with earlier storage time from another pre-decoding buffer area and delete the 25 frames of the played video frame with earlier storage time, so as to reserve a storage space for the newly played video frame.
Further, in order to ensure that the played image stored in the other pre-playing buffer area is the latest played image, after the played image is stored in the other pre-playing buffer area, the method includes:
judging whether the frame number of the played images stored in the other buffer area before playing is larger than a third preset threshold value or not;
if yes, determining a second number of target images with earlier storage time according to the storage time of the played images of each frame, and deleting the target images.
That is to say, after each frame of image is played, it is necessary to determine whether the number of frames of the played image stored in the other pre-play buffer is greater than a third preset threshold, and if the preset third preset threshold is 50 and the second number is 25, after each frame of image is played, it is necessary to determine whether the number of frames of the image to be played stored in the other pre-play buffer is greater than 50, and if the number of frames of the played image stored in the other pre-play buffer is greater than 50, it is necessary to determine the 25 played images with earlier storage time from the other pre-play buffer and delete them, so as to reserve a storage space for the newly played image.
When the user records, if the actual time for starting the recording is not the I frame, the subsequent P frame is stored but cannot be played due to the lack of the I frame. In the embodiment of the present invention, by setting the second preset threshold or the third preset threshold which is relatively reasonable, when the user records a video, the I frames of the previous group of GOPs can be continuously stored, so that the previous content is not lost during the video recording. When the video is played, if the P frame which is indicated by the mark and starts to be played is added, the whole group of GOPs is decoded normally, but the P frame indicated by the mark is not played before, so that the video frame can be positioned perfectly.
Example five:
in the embodiment of the present invention, the process of video forward playing and video reverse playing will be described with reference to fig. 5 and 6, respectively.
As can be seen from fig. 5 and fig. 6, the pre-decoding buffer is respectively provided with a first pre-decoding buffer and a second pre-decoding buffer, and the pre-playing buffer is respectively provided with a first pre-playing buffer and a second pre-playing buffer.
Specifically, when the video is being played, the process is as shown in fig. 5, that is, the first pre-decoding buffer area and the first pre-playing buffer area are respectively determined as the target pre-decoding buffer area and the target pre-playing buffer area, then the image to be played is acquired from the first pre-playing buffer area, the decoded image is played on the display by the timer according to the frame rate or the timestamp, and then the played video frame and the played image are respectively stored in the second pre-decoding buffer area and the second pre-decoding buffer area.
When the number of frames of the images to be played in the first pre-play buffer area is smaller than the request threshold (i.e. the first preset threshold in the above embodiment), the video frames to be played are automatically requested to be acquired from the first pre-decode buffer area, the decoder decodes the acquired video frames to be played, stores the decoded images in the first pre-play buffer area, and then the timer plays the decoded images on the display according to the frame rate or the timestamp. And when the frame number of the image to be played in the first pre-decoding buffer area is smaller than the request threshold, requesting to acquire a code stream from a video file or a network so as to ensure that the video playing process is played normally.
In the playing process, when the number of frames of the played video frames in the second pre-decoding buffer is greater than the discard threshold (i.e. the second preset threshold in the above embodiment), the played video frames with earlier storage time are automatically determined from the second pre-decoding buffer and deleted. When the number of frames of the played images in the second pre-play buffer is greater than the discarding threshold (i.e. the third preset threshold in the above embodiment), the played images with earlier storage time are determined from the second pre-play buffer and deleted.
Specifically, when the video is played backwards, the process is as shown in fig. 6, that is, the second pre-decoding buffer area and the second pre-playing buffer area are respectively determined as the target pre-decoding buffer area and the target pre-playing buffer area, then the image to be played is obtained from the second pre-playing buffer area, the decoded image is played on the display by the timer according to the frame rate or the timestamp, and then the played video frame and the played image are respectively stored in the first pre-decoding buffer area and the first pre-playing buffer area.
When the number of frames of the images to be played in the second pre-play buffer area is smaller than the request threshold (i.e. the first preset threshold in the above embodiment), the video frames to be played are automatically requested to be acquired from the second pre-decode buffer area, the decoder decodes the acquired video frames to be played, the decoded images are turned over in units of a group of GOPs and then stored in the second pre-play buffer area, and then the timer plays the decoded images on the display according to the frame rate or the timestamp. And when the frame number of the image to be played in the buffer area before the second decoding is smaller than the request threshold, requesting to acquire a code stream from a video file or a network so as to ensure that the video playing process is played normally.
In the playing process, when the number of frames of the played video frames in the first pre-decoding buffer is greater than the discard threshold (i.e. the second preset threshold in the above embodiment), the played video frames with earlier storage time are determined from the first pre-decoding buffer and deleted. When the number of frames of the played images in the first pre-play buffer is greater than the discard threshold (i.e. the third preset threshold in the above embodiment), the played images with earlier storage time are determined from the first pre-play buffer and deleted.
As can be seen from the above description, in the embodiment of the present invention, after the target pre-play buffer area is determined, when playing is performed according to the playing sequence corresponding to the playing mode, the played image can be stored while buffering the image to be played, so that when the user switches the video playing direction, only the target pre-play buffer area needs to be determined again, the corresponding code stream does not need to be buffered again, the buffering time is shortened, and the user experience is improved.
Example six:
on the basis of the above embodiments, in the embodiment of the present invention, the overall design flow is as shown in fig. 7.
Step S701: the pre-play buffer request threshold and the discard threshold, and the pre-decode buffer request threshold and the discard threshold are set in advance.
Step S702: the user sets the playing direction, and then the playing is carried out according to the playing direction set by the user.
Step S703: circularly judging whether the buffering playing direction before playing reaches a request threshold value, and if not, requesting data upstream; and judging whether the reverse direction of the playing buffer playing reaches a discarding threshold value, and discarding the buffer frame if the reverse direction of the playing buffer playing reaches the discarding threshold value.
Step S704: circularly judging the request threshold and the discard threshold of the buffering before decoding by using the same method, namely circularly judging whether the playing direction of the buffering before decoding reaches the request threshold, and requesting data upstream if the playing direction of the buffering before decoding reaches the request threshold; and judging whether the reverse direction of the buffering playing before decoding reaches a discarding threshold value, and discarding the corresponding frame if the reverse direction of the buffering playing before decoding reaches the discarding threshold value.
Step S705: and if the timer reaches the playing condition, playing the video, moving the corresponding iterator, and updating the buffer state.
The pre-playing buffer control logic specifically comprises the following steps: according to the current playing direction, firstly judging whether the number of frames of images to be played in a buffer area before playing is smaller than a preset request threshold, if so, decoding the video frames corresponding to a buffer request of a superior (buffer area before decoding); then judging the opposite playing direction, i.e. judging whether the frame number of the played image in another buffer area before playing reaches the discarding threshold value, if so, discarding the redundant image.
The pre-decoding buffer control logic is specifically as follows: according to the decoding direction corresponding to the current playing direction, firstly judging whether the frame number of the video frame to be played in the decoding direction is smaller than a preset request threshold value, if so, requesting the corresponding video frame to an upper-level buffer (network stream or file stream); then judging the opposite decoding direction, namely whether the frame number of the played video frame in the other buffer area before decoding reaches the discarding threshold value, if so, discarding the redundant video frame.
Therefore, in the embodiment of the invention, the buffering before decoding and the buffering before playing are both bidirectional buffering, and no matter the forward playing is switched into the reverse playing or the reverse playing is switched into the forward playing, the code stream does not need to be buffered again, so that the buffering time can be greatly shortened, and the user experience is improved.
Example seven:
according to another aspect of the present invention, there is also provided a video playback apparatus, as shown in fig. 8, the apparatus including:
a first determining module 801, configured to determine a current play mode according to a received video play instruction, where the play mode includes a video forward play mode and a video reverse play mode;
a second determining module 802, configured to determine a target pre-play buffer area from the first pre-play buffer area and the second pre-play buffer area according to the play mode;
a first determining module 803, configured to determine whether an image to be played corresponding to the play mode is stored in the target pre-play buffer;
a playing module 804, configured to play the image to be played according to the playing mode if the determination result of the first determining module 803 is yes;
a first storage module 805, configured to store the played image in another pre-play buffer.
Specifically, as shown in fig. 9, the first determining module 803 includes:
a first determining unit 8031, configured to determine an initial time point of video playing according to the playing instruction;
a judging unit 8032, configured to judge, according to a timestamp of each frame of image in the buffer area before the target playback, whether an image corresponding to the timestamp and the initial time point exists in the buffer area before the target playback;
a second determining unit 8033, configured to determine, if the determination result of the determining unit is yes, each image to be played according to the timestamp, the initial time point, and the playing sequence corresponding to the playing mode of each frame of image in the buffer area before the target playing.
Specifically, the second determining unit 8033 is specifically configured to:
when the playing mode is a video forward playing mode, determining the image with the time stamp being greater than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing;
and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Specifically, the apparatus further comprises:
a second judging module 806, configured to judge whether a number of frames of the to-be-played image stored in the buffer before the target playing is smaller than a first preset threshold;
a third determining module 807, configured to determine, if the determination result of the second determining module 806 is yes, a target pre-decoding buffer from the first pre-decoding buffer and the second pre-decoding buffer according to the play-back mode;
a decoding module 808, configured to acquire a video frame to be played from the target pre-decoding buffer and decode the acquired video frame to be played;
and the second storage module 809 is configured to store the image obtained after decoding in the target pre-playing buffer.
Specifically, when the play mode is the video reverse play mode, the second storage module 809 is specifically configured to flip images obtained after decoding by using a group of GOPs as a unit, and store the flipped images in the target pre-play buffer.
Specifically, the apparatus further comprises:
a third storage module 810, configured to store the played video frame in another pre-decoding buffer after the image to be played is played according to the playing mode and the playing order corresponding to the playing mode.
Specifically, the apparatus further comprises:
a third judging module 811, configured to judge whether the number of frames of the played video frames stored in another pre-decoding buffer is greater than a second preset threshold after the played video frames are stored in the another pre-decoding buffer;
a first deleting module 812, configured to determine, according to the storage time of each frame of played video frames, a first number of target video frames with an earlier storage time if the determination result of the third determining module 811 is yes, and delete the target video frames.
Specifically, the apparatus further comprises:
a fourth judging module 813, configured to judge whether the number of frames of the played images stored in another pre-play buffer area is greater than a third preset threshold after the played images are stored in the another pre-play buffer area;
a second deleting module 814, configured to determine a second number of target images with earlier storage time according to the storage time of each frame of played image if the determination result of the fourth determining module 814 is yes, and delete the target images.
Example eight:
according to another aspect of the present invention, there is also provided an electronic apparatus, as shown in fig. 10, including: a processor 1001 and a memory 1002;
the processor 1001 is configured to execute the program in the read memory 1002, and perform the following processes:
determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode;
according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area;
judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode;
if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode;
the played image is stored in another pre-play buffer.
Specifically, the processor 1001 is specifically configured to determine an initial time point of video playing according to the playing instruction; judging whether an image of which the timestamp corresponds to the initial time point exists in the target buffer area before playing according to the timestamp of each frame of image in the target buffer area before playing; if yes, determining each image to be played according to the time stamp of each frame of image in the buffer area before the target is played, the initial time point and the playing sequence corresponding to the playing mode.
Specifically, the processor 1001 is specifically configured to, when the play mode is a video forward play mode, determine, as the image to be played, an image whose timestamp is greater than or equal to the initial time point according to a timestamp of each frame of image in the target pre-play buffer; and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Specifically, the processor 1001 is further configured to determine whether a number of frames of the image to be played stored in the buffer before the target playing is smaller than a first preset threshold; if yes, determining a target pre-decoding buffer area from the first pre-decoding buffer area and the second pre-decoding buffer area according to the play mode; acquiring a video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played; and storing the image acquired after decoding in the target pre-playing buffer area.
Specifically, the processor 1001 is specifically configured to, when the play mode is the video reverse play mode, invert an image obtained after decoding in units of a group of GOPs, and store the inverted image in the target pre-play buffer.
Specifically, the processor 1001 is further configured to store a played video frame into another pre-decoding buffer after playing the to-be-played image according to the playing mode and the playing sequence corresponding to the playing mode.
Specifically, the processor 1001 is further configured to determine, after storing the played video frame in another pre-decoding buffer, whether the number of frames of the played video frame stored in the another pre-decoding buffer is greater than a second preset threshold; if yes, determining a first number of target video frames with earlier storage time according to the storage time of the played video frames of each frame, and deleting the target video frames.
Specifically, the processor 1001 is further configured to determine, after storing the played image in another pre-play buffer, whether the number of frames of the played image stored in the another pre-play buffer is greater than a third preset threshold; if yes, determining a second number of target images with earlier storage time according to the storage time of the played images of each frame, and deleting the target images.
In fig. 10, the bus architecture may include any number of interconnected buses and bridges, with one or more processors, represented by the processor 1001, and various circuits, represented by the memory 1002, being linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The processor 1001 is responsible for managing the bus architecture and general processing, and the memory 1002 may store data used by the processor 1001 in performing operations.
Alternatively, the processor 1001 may be a CPU (central processing unit), an ASIC (Application specific integrated Circuit), an FPGA (Field Programmable Gate Array), or a CPLD (Complex Programmable Logic Device).
Example nine:
according to another aspect of the present invention, there is also provided a storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the steps of:
determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode;
according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area;
judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode;
if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode;
the played image is stored in another pre-play buffer.
Specifically, the determining whether the image to be played corresponding to the play mode is stored in the target pre-play buffer includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image of which the timestamp corresponds to the initial time point exists in the target buffer area before playing according to the timestamp of each frame of image in the target buffer area before playing;
if yes, determining each image to be played according to the time stamp of each frame of image in the buffer area before the target is played, the initial time point and the playing sequence corresponding to the playing mode.
Specifically, the determining each image to be played according to the timestamp and the initial time point of each frame of image in the buffer before the target playing and the playing sequence corresponding to the playing mode includes:
when the playing mode is a video forward playing mode, determining the image with the time stamp being greater than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing;
and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
Specifically, the method further comprises:
judging whether the number of frames of the image to be played stored in the buffer area before the target playing is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer area from the first pre-decoding buffer area and the second pre-decoding buffer area according to the play mode;
acquiring a video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played;
and storing the image acquired after decoding in the target pre-playing buffer area.
Specifically, when the play mode is the video reverse play mode, the storing the image obtained after decoding in the target pre-decoding buffer includes:
and turning the images acquired after decoding by taking a group of GOPs as a unit, and storing the turned images in the target pre-playing buffer area.
Specifically, after the images to be played are played according to the playing mode and the playing sequence corresponding to the playing mode, the method further includes:
the played video frame is stored into another pre-decode buffer.
Specifically, after storing the played video frame into another pre-decoding buffer, the method further includes:
judging whether the frame number of the played video frame stored in the other pre-decoding buffer area is greater than a second preset threshold value or not;
if yes, determining a first number of target video frames with earlier storage time according to the storage time of the played video frames of each frame, and deleting the target video frames.
Specifically, after storing the played image into another pre-play buffer, the method includes:
judging whether the frame number of the played images stored in the other buffer area before playing is larger than a third preset threshold value or not;
if yes, determining a second number of target images with earlier storage time according to the storage time of the played images of each frame, and deleting the target images.
The computer readable storage medium in the above embodiments may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs), etc.
For the system/apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
It is to be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or operation from another entity or operation without necessarily requiring or implying any actual such relationship or order between such entities or operations.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely application embodiment, or an embodiment combining application and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (11)

1. A video playback method, the method comprising:
determining a current play mode according to a received video play instruction, wherein the play mode comprises a video forward play mode and a video reverse play mode;
according to the play mode, determining a target pre-play buffer area from a first pre-play buffer area and a second pre-play buffer area;
judging whether the target pre-playing buffer area stores an image to be played corresponding to the playing mode;
if yes, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode;
the played image is stored in another pre-play buffer.
2. The method as claimed in claim 1, wherein said determining whether the target pre-playback buffer stores the image to be played corresponding to the playback mode comprises:
determining an initial time point of video playing according to the playing instruction;
judging whether an image of which the timestamp corresponds to the initial time point exists in the target buffer area before playing according to the timestamp of each frame of image in the target buffer area before playing;
if yes, determining each image to be played according to the time stamp of each frame of image in the buffer area before the target is played, the initial time point and the playing sequence corresponding to the playing mode.
3. The method as claimed in claim 2, wherein the determining each image to be played according to the timestamp and the initial time point of each frame of image in the target pre-play buffer and the playing sequence corresponding to the playing mode comprises:
when the playing mode is a video forward playing mode, determining the image with the time stamp being greater than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing;
and when the playing mode is a video reverse playing mode, determining the image with the time stamp less than or equal to the initial time point as the image to be played according to the time stamp of each frame of image in the buffer area before the target playing.
4. The method of claim 1, wherein the method further comprises:
judging whether the number of frames of the image to be played stored in the buffer area before the target playing is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer area from the first pre-decoding buffer area and the second pre-decoding buffer area according to the play mode;
acquiring a video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played;
and storing the image acquired after decoding in the target pre-playing buffer area.
5. The method of claim 4, wherein when the playback mode is the video reverse playback mode, the storing the image obtained after decoding in the target pre-decoding buffer comprises:
and turning the images acquired after decoding by taking a group of GOPs as a unit, and storing the turned images in the target pre-playing buffer area.
6. The method as claimed in claim 4, wherein after playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode, the method further comprises:
the played video frame is stored into another pre-decode buffer.
7. The method of claim 6, wherein after storing the played video frame in another pre-decode buffer, the method further comprises:
judging whether the frame number of the played video frame stored in the other pre-decoding buffer area is greater than a second preset threshold value or not;
if yes, determining a first number of target video frames with earlier storage time according to the storage time of the played video frames of each frame, and deleting the target video frames.
8. The method of claim 1, wherein after storing the played image in another pre-play buffer, the method comprises:
judging whether the frame number of the played images stored in the other buffer area before playing is larger than a third preset threshold value or not;
if yes, determining a second number of target images with earlier storage time according to the storage time of the played images of each frame, and deleting the target images.
9. A video playback apparatus, comprising:
the device comprises a first determining module, a second determining module and a display module, wherein the first determining module is used for determining a current playing mode according to a received video playing instruction, and the playing mode comprises a video forward playing mode and a video reverse playing mode;
a second determining module, configured to determine a target pre-play buffer area from the first pre-play buffer area and the second pre-play buffer area according to the play mode;
the first judgment module is used for judging whether the target pre-playing buffer area stores the image to be played corresponding to the playing mode;
the playing module is used for playing the images to be played according to the playing mode according to the playing sequence corresponding to the playing mode if the judgment result of the first judgment module is yes;
the first storage module is used for storing the played image into another buffer area before playing.
10. An electronic device, characterized in that the electronic device comprises: comprising a memory and a processor;
the processor, reading the program in the memory, executing the steps of the method of any of claims 1-8.
11. A computer-readable storage medium, characterized in that it stores a computer program executable by an electronic device, which program, when run on the electronic device, causes the electronic device to carry out the steps of the method according to any one of claims 1-8.
CN201811589787.4A 2018-12-25 2018-12-25 Video playing method and device, electronic equipment and storage medium Active CN111372117B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811589787.4A CN111372117B (en) 2018-12-25 2018-12-25 Video playing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811589787.4A CN111372117B (en) 2018-12-25 2018-12-25 Video playing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111372117A true CN111372117A (en) 2020-07-03
CN111372117B CN111372117B (en) 2023-06-23

Family

ID=71211348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811589787.4A Active CN111372117B (en) 2018-12-25 2018-12-25 Video playing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111372117B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202751A (en) * 2020-09-25 2021-01-08 腾讯科技(深圳)有限公司 Animation processing method and device, electronic equipment and storage medium
CN112911389A (en) * 2021-01-18 2021-06-04 浙江大华技术股份有限公司 Video playing switching method, electronic equipment and computer storage medium

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0993540A (en) * 1995-09-21 1997-04-04 Nec Corp Special reproduction system for vod system
US20040252970A1 (en) * 2003-06-11 2004-12-16 Samsung Electronics Co., Ltd. Apparatus and method for controlling reverse-play for digital video bitstream
US20060008248A1 (en) * 2004-07-06 2006-01-12 Agrahara Aravind C Optimal buffering and scheduling strategy for smooth reverse in a DVD player or the like
US20060093317A1 (en) * 2004-10-29 2006-05-04 Ati Technologies, Inc. Video playback method and apparatus
US20070014531A1 (en) * 2005-07-15 2007-01-18 Streaming Networks (Pvt.) Ltd. Method and system for providing instant reverse play
CN101427569A (en) * 2006-04-28 2009-05-06 松下电器产业株式会社 Video reproduction device
EP2660819A1 (en) * 2012-05-01 2013-11-06 Eldon Technology Limited trading as Echostar Europe Method to play video in reverse and related entertainment device and computer program
US20150016807A1 (en) * 2012-02-29 2015-01-15 Advanced Digital Broadcast S.A. Video processing method and video appliance implementing the method
CN106331718A (en) * 2016-08-31 2017-01-11 浙江大华技术股份有限公司 Video back-playing method and device
CN106658155A (en) * 2016-12-29 2017-05-10 深圳Tcl数字技术有限公司 Method and device for switching and playing of player
CN107005743A (en) * 2014-10-07 2017-08-01 瑞典爱立信有限公司 For realizing the video bits stream process called in
CN107222779A (en) * 2017-06-08 2017-09-29 浙江大华技术股份有限公司 A kind of method and device of video play-reverse
US20180054649A1 (en) * 2016-08-17 2018-02-22 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and device for switching video streams
CN109005447A (en) * 2018-08-10 2018-12-14 高新兴科技集团股份有限公司 A kind of video recording of security protection high definition falls broadcasting method and device

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0993540A (en) * 1995-09-21 1997-04-04 Nec Corp Special reproduction system for vod system
US20040252970A1 (en) * 2003-06-11 2004-12-16 Samsung Electronics Co., Ltd. Apparatus and method for controlling reverse-play for digital video bitstream
US20060008248A1 (en) * 2004-07-06 2006-01-12 Agrahara Aravind C Optimal buffering and scheduling strategy for smooth reverse in a DVD player or the like
US20060093317A1 (en) * 2004-10-29 2006-05-04 Ati Technologies, Inc. Video playback method and apparatus
US20070014531A1 (en) * 2005-07-15 2007-01-18 Streaming Networks (Pvt.) Ltd. Method and system for providing instant reverse play
CN101427569A (en) * 2006-04-28 2009-05-06 松下电器产业株式会社 Video reproduction device
US20150016807A1 (en) * 2012-02-29 2015-01-15 Advanced Digital Broadcast S.A. Video processing method and video appliance implementing the method
EP2660819A1 (en) * 2012-05-01 2013-11-06 Eldon Technology Limited trading as Echostar Europe Method to play video in reverse and related entertainment device and computer program
US20130294526A1 (en) * 2012-05-01 2013-11-07 Kevin Thornberry Smooth reverse video playback on low-cost current generation set-top box hardware
CN107005743A (en) * 2014-10-07 2017-08-01 瑞典爱立信有限公司 For realizing the video bits stream process called in
US20180054649A1 (en) * 2016-08-17 2018-02-22 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and device for switching video streams
CN106331718A (en) * 2016-08-31 2017-01-11 浙江大华技术股份有限公司 Video back-playing method and device
CN106658155A (en) * 2016-12-29 2017-05-10 深圳Tcl数字技术有限公司 Method and device for switching and playing of player
CN107222779A (en) * 2017-06-08 2017-09-29 浙江大华技术股份有限公司 A kind of method and device of video play-reverse
CN109005447A (en) * 2018-08-10 2018-12-14 高新兴科技集团股份有限公司 A kind of video recording of security protection high definition falls broadcasting method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202751A (en) * 2020-09-25 2021-01-08 腾讯科技(深圳)有限公司 Animation processing method and device, electronic equipment and storage medium
CN112202751B (en) * 2020-09-25 2022-06-07 腾讯科技(深圳)有限公司 Animation processing method and device, electronic equipment and storage medium
CN112911389A (en) * 2021-01-18 2021-06-04 浙江大华技术股份有限公司 Video playing switching method, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN111372117B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
KR101034080B1 (en) Uniform video decoding and display
CN107948735B (en) Video playing method and device and electronic equipment
CN108495164B (en) Audio and video synchronization processing method and device, computer device and storage medium
WO2016131223A1 (en) Frame loss method for video frame and video sending apparatus
CN110366033B (en) Video playing method, device, equipment and storage medium
RU2008113747A (en) SYSTEM AND METHOD FOR EFFECTIVE ADAPTATION OF SCALABLE FLOWS
CN111372117B (en) Video playing method and device, electronic equipment and storage medium
CN105393544A (en) Dynamic track switching in media streaming
US20230074682A1 (en) Method and apparatus for video coding
CN109688407B (en) Reference block selection method and device for coding unit, electronic equipment and storage medium
US20150206596A1 (en) Managing a ring buffer shared by multiple processing engines
CN109996117B (en) Method and device for acquiring streaming media playing time
EP3809708A1 (en) Video data storage method and device in cloud storage system
CN111614997B (en) Far-end video playback method, device, equipment and medium
CN113923472B (en) Video content analysis method, device, electronic equipment and storage medium
US10674188B2 (en) Playback apparatus, method of controlling playback apparatus, playback method and server apparatus
US20070067568A1 (en) Data processing methods and systems
ES2364374T3 (en) METHOD AND APPARATUS FOR DATA DECODING.
WO2020063567A1 (en) Video recording playback method and apparatus, and computer-readable storage medium and electronic device
US7912349B1 (en) Validating frame dependency information
WO2020035036A1 (en) Program recording and playback method and device
JP3073948B2 (en) Digital video decoding apparatus and digital video decoding method
CN111726683B (en) Media playing method and device, electronic equipment and storage medium
CN109769129B (en) Decoding method for preventing analysis failure in automobile liquid crystal instrument
JP4289138B2 (en) Data processing apparatus and method and encoding apparatus

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