CN111372117B - 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
CN111372117B
CN111372117B CN201811589787.4A CN201811589787A CN111372117B CN 111372117 B CN111372117 B CN 111372117B CN 201811589787 A CN201811589787 A CN 201811589787A CN 111372117 B CN111372117 B CN 111372117B
Authority
CN
China
Prior art keywords
playing
played
image
video
target
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
CN201811589787.4A
Other languages
Chinese (zh)
Other versions
CN111372117A (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 or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Television Signal Processing For Recording (AREA)

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 the received video playing instruction; determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode; judging whether an image to be played corresponding to a playing mode is stored in a buffer area before target playing; 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, by setting the first playing front buffer zone and the second playing front buffer zone corresponding to different playing modes, bidirectional buffering of the images to be played and the played images can be realized, when the video playing direction is switched, the images in the target playing front buffer zone can be directly played without rebuffering the corresponding code stream, and the buffer time is shortened, so that the aim of improving the user experience is fulfilled.

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, a video playing device, 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 before decoding, a decoder obtains the code stream from the buffer before decoding to decode, the decoded image is put into a buffer before playing, and then the decoded image is played on a display by a timer according to the frame rate or the time stamp.
When the video is inverted, the process is as shown in fig. 2, that is, the inverted code stream is obtained from the video file or the network again, and the obtained inverted code stream is put into the buffer area before decoding, the decoder obtains the inverted code stream from the buffer area before decoding to decode, the decoded image is put into the buffer area after decoding, after a group of GOP (Group of Pictures ) of the buffer area after decoding is overturned, the overturned image is put into the buffer area before playing, and then the overturned 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 the forward playing is switched to the backward playing, the forward playing code stream needs to be emptied and the backward playing code stream needs to be rebuffered, and when the backward playing is switched to the forward playing, the backward playing code stream needs to be emptied and the forward playing code stream needs to be rebuffered, and then decoding and playing are carried out again, so that the time consumption 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.
In order to overcome the above technical problems, according to one aspect of the present invention, there is provided a video playing method, including:
determining a current playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode;
judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not;
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 playing front buffer zone and a second playing front buffer zone which correspond to a video forward playing mode and a video backward playing mode are respectively arranged, when the playing mode corresponding to a video playing instruction is determined, a target playing front buffer zone corresponding to the playing mode can be further determined, when the target playing front buffer zone is judged to store images to be played corresponding to the playing mode, the images to be played can be directly played according to the playing sequence corresponding to the playing mode, and the played images are stored in another playing front buffer zone. Therefore, the invention can realize the bidirectional buffering of the image to be played and the played image through the first playing front buffer zone and the second playing front buffer zone, when receiving the video playing instruction, one of the playing front buffer zones is used as the target playing front buffer zone, and the image in the target playing front buffer zone is directly played, even if the user frequency changes the video playing direction, the corresponding code stream does not need to be rebuffered, the buffering time is shortened, and the user experience is improved.
Specifically, the determining whether the target play front buffer area stores the image to be played corresponding to the play mode includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image with a time stamp corresponding to the initial time point exists in the target playing front buffer area or not according to the time stamp of each frame of image in the target playing front buffer area;
if yes, determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer zone, the initial time point and the playing sequence corresponding to the playing mode.
After the target playing front buffer zone is determined, whether the target playing front buffer zone stores the image to be played or not is required to be judged, if the target playing front buffer zone does not store the image to be played, the corresponding image is required to be buffered, and if the target playing front buffer zone stores the image to be played, the stored image to be played in the target playing front buffer zone is required to be directly played, so that the aim of shortening the buffering time is achieved.
Specifically, the determining 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 image in the target pre-playing buffer zone includes:
When the playing mode is a video forward playing mode, determining an image with a time stamp 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 before target playing;
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 before target playing.
Because the playing mode comprises a video forward playing mode and a video backward playing mode, when the playing mode is the video forward playing mode, the image with the time stamp after the initial time point is determined to be the image to be played, and when the playing mode is the video backward playing mode, the image with the time stamp before the initial time point is determined to be the image to be played, so that playing according to the playing sequence corresponding to the playing mode is realized.
Specifically, the method further comprises:
judging whether the frame number of the image to be played stored in the target playing front buffer area is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the playing 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 decoded image in the target playing front buffer zone.
Since each time a frame image is played, the frame image is cleared from the storage address in the target play front buffer area and stored in the other play front buffer area, as the image to be played in the target play front buffer area is continuously reduced, a first preset threshold value of the target play front buffer area can be preset to ensure that the video can be continuously played, that is, when the number of frames of the image to be played stored in the target play front buffer area is smaller than the first preset threshold value, the target play front buffer area is automatically determined from the first and second play front buffer areas, the video frame to be played is acquired from the target play front buffer area, then the video frame to be played is decoded, and the image acquired after decoding is stored in the target play front buffer area.
Specifically, when the play mode is a video reverse play mode, the storing the image obtained after decoding in the target play front buffer area includes:
And turning over the decoded image by taking a group of GOPs as a unit, and storing the turned-over image in the target pre-playing buffer zone.
When the playing mode is a video reverse playing mode, the video frames to be played are obtained from the target pre-decoding buffer area to be positive-sequence encoded, so that the images to be played obtained after decoding are also positive-sequence encoded, and therefore, by turning over the images to be played in units of one group of GOPs, each frame of image in each group of GOPs can be stored in reverse order, video reverse playing is realized, I frame deletion can be prevented, and video reverse playing cannot be realized.
Specifically, after the image to be played is played according to the playing mode and the playing sequence corresponding to the playing mode, the method further includes:
the played video frames are stored into another pre-decoding buffer.
According to the invention, the first pre-decoding buffer area and the second pre-decoding buffer area corresponding to the video forward-playing mode and the video backward-playing mode are respectively arranged, so that the bidirectional buffering of the video frames to be played and the video frames already played can be realized, and after receiving the video playing instruction, the corresponding video frames do not need to be buffered again, thereby shortening the buffering time and improving the user experience.
Specifically, after the storing of the played video frames in another pre-decoding buffer, the method further comprises:
judging whether the frame number of the played video frames stored in the other pre-decoding buffer area is larger than a second preset threshold value or not;
if so, 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 that the playing is smoother when the video playing direction is switched, the played video frames stored in the buffer area before the other decoding are required to be played up to date, so that the played video frames with earlier storage time are required to be deleted for providing a storage space for the video frames which are played up to date.
Specifically, after the played image is stored in the other pre-play buffer, the method further includes:
judging whether the frame number of the played image stored in the other buffer area before playing is larger than a third preset threshold value or not;
if so, 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 process is smoother when the video playing direction is switched, the played image stored in the buffer before another playing is required to be the latest played image, so that the played image with earlier storage time is also required to be deleted for providing a storage space for the latest played image.
According to another aspect of the present invention, there is also provided a video playing device, including:
the first determining module is used for determining a current playing mode according to the received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
the second determining module is used for determining a target playing front buffer zone from the first playing front buffer zone and the second playing front buffer zone according to the playing mode;
the first judging module is used for judging whether the target playing front buffer area stores an image to be played corresponding to the playing mode or not;
the playing module is used for playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode if the judging result of the first judging module is yes;
And the first storage module is used for storing the played image into another pre-play buffer zone.
Specifically, the first judging module includes:
the first determining unit is used for determining an initial time point of video playing according to the playing instruction;
the judging unit is used for judging whether the image with the timestamp corresponding to the initial time point exists in the target playing front buffer area according to the timestamp of each frame of image in the target playing front 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 buffer before target playing, the initial time point and the playing sequence corresponding to the playing mode if the judging 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 an image with a time stamp 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 before target playing;
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 before target playing.
Specifically, the device further comprises:
the second judging module is used for judging whether the frame number of the image to be played stored in the target playing front buffer area 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 a 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 images acquired after decoding in the target playing front buffer area.
Specifically, when the playing mode is a video reverse playing mode, the second storage module is specifically configured to invert the image obtained after decoding in units of a group of GOPs, and store the inverted image in the target pre-playing buffer.
Specifically, the device further comprises:
and the third storage module is used for storing the played video frames into another pre-decoding buffer zone after playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode.
Specifically, the device further comprises:
a third judging module, 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 other pre-decoding buffer;
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 the played video frames of each frame if the judgment result of the third judging module is yes, and deleting the target video frames.
Specifically, the device further comprises:
a fourth judging module, configured to judge whether a frame number of the played image stored in the other pre-play buffer is greater than a third preset threshold after the played image is stored in the other pre-play buffer;
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 the played images of each frame 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 configured to read the program in the memory, and execute 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, which when run on the electronic device, causes the electronic device to perform the steps in the video playback method described above.
The beneficial effects of the invention are as follows:
the invention provides a video method and a device, wherein the method comprises the following steps: determining a current playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode; determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode; judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not; 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, by respectively arranging the first playing front buffer zone and the second playing front buffer zone corresponding to the video forward playing mode and the video backward playing mode, after receiving the video playing instruction, one of the playing front buffer zones is used as the target playing front buffer zone, the images in the target playing front buffer zone are directly played, and then the played images are stored in the other playing front buffer zone, so that bidirectional buffering of the images to be played and the played images can be realized, and the corresponding code streams do not need to be rebuffered when the video playing direction is frequently changed by a user, thereby greatly shortening the buffering time and improving the user experience.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow control diagram of video forward-play in the prior art;
fig. 2 is a schematic flow control diagram of video playback in the prior art;
fig. 3 is a flowchart of a video playing method according to an embodiment of the present invention;
fig. 4 is a flowchart of a request for obtaining an image to be played provided in an embodiment of the present invention;
fig. 5 is a schematic flow control diagram of video forward playback provided in an embodiment of the present invention;
fig. 6 is a schematic flow control diagram of video playback according to an embodiment of the present invention;
fig. 7 is a design flow chart of a video playing method according to an embodiment of the present invention;
fig. 8 is a block diagram of a video playing device according to an embodiment of the present invention;
fig. 9 is a block diagram of a first judging module according to an embodiment of the present invention;
Fig. 10 is an electronic device provided in an embodiment of the present invention.
Detailed Description
Because the buffer area in the prior art is unidirectional when buffering, and the buffer area reaches the preset buffering maximum value, when the video is switched from the video forward playing to the video backward playing or from the video backward playing to the video forward playing, the code stream corresponding to the current playing mode needs to be rebuffered, and the code stream is decoded to obtain the image, so that the time consumption is long. Therefore, the prior art has the problem of poor user experience caused by frequent switching of the playing direction of the video.
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 playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode; determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode; judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not; 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 foregoing, in the embodiment of the present invention, by respectively providing the first play front buffer and the second play front buffer corresponding to the video forward play mode and the video reverse play mode, after receiving the video play instruction, one of the play front buffers may be used as the target play front buffer, and the image in the target play front buffer is directly played, and then the played image is stored in the other play front buffer, so that bidirectional buffering of the image to be played and the played image can be achieved, so that the user does not need to rebuffering the corresponding code stream when the user frequently switches the video play direction, thereby greatly shortening the buffering time and improving the user experience.
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Embodiment one:
fig. 3 is a flowchart of a video playing method according to an embodiment of the present invention, where the method includes:
Step S301: and determining a current playing mode according to the received video playing instruction.
In the embodiment of the invention, the video playing instruction can be a video forward playing instruction or a video backward playing instruction, and the playing mode can be a video forward playing mode or a video backward playing mode correspondingly.
Step S302: and determining a target pre-playing buffer zone from the first pre-playing buffer zone and the second pre-playing buffer zone according to the playing mode.
In the embodiment of the invention, the first playing front buffer zone can correspond to a video forward playing mode, the second playing front buffer zone can correspond to a video backward playing mode, and correspondingly, in the embodiment of the invention, the first playing front buffer zone can be used for storing images to be played, and the second playing front buffer zone can be used for storing played images, so that bidirectional buffering of the images to be played and the played images is realized by respectively setting the first playing front buffer zone and the second playing front buffer zone which correspond to the video forward playing mode and the video backward playing mode, and when the current playing mode is determined to be the video forward playing mode, the first playing front buffer zone is determined to be the target playing front buffer zone, or when the current playing mode is determined to be the video backward playing mode, the second playing front buffer zone is determined to be the target playing front buffer zone.
In the embodiment of the present invention, the second pre-playing buffer zone may also correspond to a video forward playing mode, and the first pre-playing buffer zone may also correspond to a video reverse playing mode, so that the second pre-playing buffer zone is used for storing an image to be played, and the first pre-playing buffer zone is used for storing a played image. Therefore, in the embodiment of the present invention, the correspondence between the video playing mode and the pre-playing buffer area is not particularly limited, as long as different video playing modes can be respectively corresponding to different pre-playing buffer areas.
Step S303: and judging whether the target playing front buffer area stores the image to be played corresponding to the playing mode.
That is, after the target play front buffer area is determined, it is required to determine whether the target play front buffer area stores the image to be played, and if the target play front buffer area does not store the image to be played, the image to be played needs to be buffered according to the current play mode, which is the same as the video playing method in the prior art, so that the description thereof is omitted.
If the target playing front buffer area stores the image to be played, the image to be played is only directly played according to the playing sequence corresponding to the playing mode, that is, step S304.
Step S304: and if so, playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode.
Taking the first playing front buffer area corresponding to the video forward playing mode as an example, the second playing front buffer area corresponding to the video backward playing mode, when the current playing mode is the video forward playing mode, determining the first playing front buffer area as a target playing front buffer area, and if the first playing front buffer area stores the image to be played, reading the first playing front buffer area in the forward direction, so that the video forward playing can be realized. And when the current playing mode is a video reverse playing mode, determining the second playing front buffer zone as a target playing front buffer zone, and if the second playing front buffer zone stores images to be played, realizing video reverse playing by reversely reading the second playing front buffer zone.
Step S305, storing the played image in another pre-play buffer.
By storing the played image in another pre-play buffer, the played image which is played up to date 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, the user only needs to re-determine the target pre-playing buffer area and does not need to re-buffer the corresponding code stream.
Therefore, in the invention, by setting the first playing front buffer zone and the second playing front buffer zone, bidirectional buffering of the images to be played and the played images can be realized, even if the user frequently changes the video playing direction, the corresponding code stream does not need to be rebuffered, the image buffering time can be greatly shortened, and the user experience is improved.
When playing, if the video is forward-playing, the image in the buffer area before the target playing needs to be read forward, and if the video is backward-playing, the image in the buffer area before the target playing needs to be read backward, so that the processing logic is the same no matter the video is forward-playing or the video is backward-playing, and when the video is implemented, the logic is unified compared with the prior art, and the problem when the video is switched due to the large logic phase difference can be avoided.
Embodiment two:
on the basis of the foregoing embodiment, in the embodiment of the present invention, the determining whether the target pre-play buffer area stores the image to be played corresponding to the play mode includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image with a time stamp corresponding to the initial time point exists in the target playing front buffer area or not according to the time stamp of each frame of image in the target playing front buffer area;
If yes, determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer zone, the initial time point and the playing sequence corresponding to the playing mode.
That is, after receiving the video playing instruction, an initial time point of video playing needs to be determined according to the video playing instruction, for example, a playing duration corresponding to the whole video is 10min, if the video playing instruction sent by the user is received at the 5 th min, the initial time point of video playing is determined to be the 5 th min, at this time, whether an image with a timestamp corresponding to the 5 th min exists in the buffer before the target playing needs to be judged, and if the image exists, each image to be played is determined according to the timestamp of each frame of image in the buffer before the target playing, the initial time point and a playing sequence corresponding to the playing mode.
Specifically, according to the timestamp, the initial time point and the playing sequence corresponding to the playing mode of each frame of image in the target playing front buffer area, determining each image to be played includes:
and 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 before target playing.
In the above embodiment, the first pre-play buffer area corresponds to the video forward play mode, the second pre-play buffer area corresponds to the video reverse play mode, and if the play mode is the video forward play mode, the corresponding target pre-play buffer area is the first pre-play buffer area, at this time, forward reading is required to be performed on the image pre-buffered in the first pre-play buffer area, and if the timestamp corresponding to the pre-buffered image in the first pre-play buffer area is greater than or equal to 5min, then determining the image with the timestamp greater than or equal to 5min as the image to be played.
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 before target playing.
In the above embodiment, the first pre-play buffer area corresponds to the video forward play mode, the second pre-play buffer area corresponds to the video reverse play mode, if the play mode is the video reverse play mode, the corresponding target pre-play buffer area is the second pre-play buffer area, and at this time, the pre-buffered image in the second pre-play buffer area needs to be reversely read, if the timestamp corresponding to the pre-buffered image in the second pre-play buffer area is less than or equal to 5min, then the image with the timestamp less than or equal to 5min is determined as the image to be played.
Embodiment III:
in order to ensure that the image to be played stored in the buffer before target playing can meet the requirement of the current playing instruction, on the basis of the above embodiment, in the 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 target pre-playing buffer area is smaller than a first preset threshold value.
Step S402: if so, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the playing mode.
Step S403: and acquiring a 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 decoded image in the target playing front buffer zone.
As can be seen from the above embodiment, after each frame of image is played, the frame of image is cleared from the storage address in the target pre-playing buffer zone and is stored in the other pre-playing buffer zone, so that the image to be played in the target pre-playing buffer zone is continuously reduced, so that in order to ensure that the image to be played in the target pre-playing buffer zone can meet the requirement of the current playing instruction, after each frame of image is played, it is required to determine whether the frame number of the image to be played stored in the target pre-playing buffer zone is smaller than a first preset threshold value, if the first preset threshold value is 50, it is required to determine whether the frame number of the image to be played stored in the target pre-playing buffer zone is smaller than 50, if the frame number of the image to be played stored in the target pre-playing buffer zone is smaller than 50, it is required to determine the target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the current playing mode, and then it is required to acquire the frame to be played from the target pre-decoding pre-buffering zone, and then acquire the acquired frame to be played.
Therefore, in the embodiment of the invention, in the video playing process, when the frame number of the image to be played stored in the target pre-playing buffer zone is smaller than the first preset threshold value, the frame to be played is requested to be acquired from the target pre-decoding buffer zone, so that the video can be ensured to be continuously played.
In order to further realize bidirectional buffering of the video frame to be played and the video frame already played, 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 frames are stored into another pre-decoding buffer.
In the embodiment of the present invention, the first pre-decoding buffer may correspond to a video forward-playing mode, and the second pre-decoding buffer may correspond to a video backward-playing mode, so that, correspondingly, in the embodiment of the present invention, the first pre-decoding buffer may be used to store video frames to be played, and the second pre-decoding buffer may be used to store video frames that have been played.
Therefore, in the embodiment of the invention, by respectively setting the first pre-decoding buffer area and the second pre-decoding buffer area, the two-way buffering of the video frames to be played and the video frames already played can be realized, even if the video playing direction is frequently changed by a user, the corresponding code stream does not need to be rebuffered, the image buffering time can be greatly shortened, and the user experience is improved.
In the embodiment of the present invention, the second pre-decoding buffer may also correspond to a video forward-playing mode, and the first pre-decoding buffer may also correspond to a video reverse-playing mode, so that the second pre-decoding buffer is used for storing video frames to be played, and the first pre-decoding buffer is used for storing played video frames. Therefore, in the embodiment of the present invention, the correspondence between the video playing mode and the pre-decoding buffer is not particularly limited, as long as different video playing modes can be respectively corresponding to different pre-decoding buffers.
Specifically, in the embodiment of the present invention, taking the first pre-playing buffer area corresponding to the video forward playing mode, the second pre-playing buffer area corresponding to the video reverse playing mode, the first pre-decoding buffer area corresponding to the video forward playing mode, and the second pre-decoding buffer area corresponding to the video reverse playing mode as an example, when the playing mode is the video forward playing mode, since the pre-stored video frames in the first pre-decoding buffer area are positive-sequence encoded, the images to be played acquired after decoding by the decoder are also positive-sequence encoded, so the images to be played acquired after decoding can be directly stored in the first pre-playing buffer area.
When the playing mode is the video reverse playing mode, since the stored video frames in the second pre-decoding buffer area are encoded in positive sequence, and the images in the second pre-playing buffer area need to be reversely read when the video playing is performed, in the embodiment of the present invention, the storing the images obtained after decoding in the target pre-playing buffer area includes:
and turning over the decoded image by taking a group of GOPs as a unit, and storing the turned-over image in the target pre-playing buffer zone.
That is, since the video frames to be played are obtained from the second pre-decoding buffer are encoded in the positive sequence, the images to be played obtained after decoding are also encoded in the positive sequence, and thus in order to realize the video reverse playback, it is necessary to flip the images to be played in units of one group of GOP to realize the reverse-sequence storage of each frame of image in each group of GOP.
For example, the video frames to be played in the second pre-decoding buffer area are stored in a non-full I-frame coding mode, if the video frames included in a group of GOP are I1, P2, P3, P4 … P100, and the images obtained after decoding are corresponding to image 1, image 2, image 3, and image 4 … image 100, in order to realize video reverse playback, the image 100 should be stored preferentially, and then each frame of image should be stored in reverse order.
Because the I frame is a complete picture, and the P frame records a change relative to the I frame, the P frame cannot be decoded without the I frame, in the embodiment of the invention, the image to be played is turned over by taking a group of GOPs as a unit, so that each frame of image in each group of GOPs can be stored in reverse order, video reverse playback can be realized, I frame deletion can be prevented, and video reverse playback cannot be realized.
Embodiment four:
in order to ensure that the playing process is smoother when the video playing direction is switched, therefore, the played image stored in the buffer before another playing is required to be the latest played image, and the played video frame stored in the buffer before another decoding is the latest played video frame, therefore, on the basis of the embodiment, in the embodiment of the invention, in order to ensure that the played video frame stored in the buffer before another decoding is the latest played video frame, after the played video frame is stored in the buffer before another decoding, the method further comprises:
judging whether the frame number of the played video frames stored in the other pre-decoding buffer area is larger than a second preset threshold value or not;
if so, 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, after each video frame is played, it is necessary to determine whether the number of frames of the played video frame stored in the buffer before another decoding is greater than a second preset threshold, and if the second preset threshold is 50, the first number is 25, so after each video frame is played, it is necessary to determine whether the number of frames of the video frame to be played stored in the buffer before another decoding is greater than 50, and if the number of frames of the played video frame stored in the buffer before another decoding is greater than 50, it is necessary to determine 25 frames of the played video frame with earlier storage time from the buffer before another decoding, and delete it for reserving a storage space for the played video frame that has been played last.
Further, to ensure that the played image stored in the other pre-play buffer is the latest played image, after the played image is stored in the other pre-play buffer, the method includes:
judging whether the frame number of the played image stored in the other buffer area before playing is larger than a third preset threshold value or not;
if so, 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, 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 value after each frame of image is played, and if the third preset threshold value set in advance is 50, the second number is 25, so that 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 after each frame of image is played, and if the number of frames of the played image stored in the other pre-play buffer is greater than 50 at this time, it is necessary to determine 25 frames of the played image with earlier storage time from the other pre-play buffer and delete it for reserving a storage space for the played image that has been played last.
When the user performs video recording, if the actual time for starting video recording is not an I frame, the subsequent P frames are saved, but cannot be played because of missing the I frame. In the embodiment of the invention, by setting the second preset threshold or the third preset threshold reasonably, when the user performs video recording, the I frames of the previous GOP can be continuously stored, so that the video recording cannot lose the previous content. When video playing is carried out, if the P frame indicated to start playing is marked, the whole group of GOP is normally decoded, but the P frame indicated by the mark is not played before, so that the video frame can be perfectly positioned.
Fifth embodiment:
in the embodiment of the present invention, the processes of video forward playback and video reverse playback will be described with reference to fig. 5 and 6, respectively.
As can be seen from fig. 5 and 6, the pre-decoding buffer zone is provided with a first pre-decoding buffer zone and a second pre-decoding buffer zone, and the pre-playing buffer zone is provided with a first pre-playing buffer zone and a second pre-playing buffer zone.
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 obtained 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 image to be played in the first pre-playing buffer is smaller than the request threshold (i.e., the first preset threshold in the above embodiment), the frame to be played is automatically requested to be acquired from the first pre-decoding buffer, the decoder decodes the acquired frame to be played, stores the decoded image in the first pre-playing buffer, and then the timer plays the decoded image on the display according to the frame rate or the timestamp. And when the number of frames of the image to be played in the first pre-decoding buffer zone is smaller than a request threshold value, requesting to acquire a code stream from a video file or a network so as to ensure that the video playing flow 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 image in the second pre-play buffer is greater than the discard threshold (i.e., the third preset threshold in the above embodiment), the played image with an earlier storage time is determined from the second pre-play buffer and deleted.
Specifically, when the video is played back, as shown in fig. 6, the process of determining the second pre-decoding buffer area and the second pre-playing buffer area as the target pre-decoding buffer area and the target pre-playing buffer area respectively, then obtaining the image to be played from the second pre-playing buffer area, playing the decoded image on the display by the timer according to the frame rate or the timestamp, and then storing the played video frame and the played image in the first pre-decoding buffer area and the first pre-playing buffer area respectively.
When the number of frames of the image to be played in the second pre-playing buffer is smaller than the request threshold (i.e., the first preset threshold in the above embodiment), the frame to be played is automatically requested to be acquired from the second pre-decoding buffer, the decoder decodes the acquired frame to be played, the decoded image is turned over in units of one group GOP and then stored in the second pre-playing buffer, and then the timer plays the decoded image on the display according to the frame rate or the timestamp. And when the number of frames of the image to be played in the second pre-decoding buffer zone is smaller than the request threshold value, requesting to acquire the code stream from the video file or the network so as to ensure that the video playing flow 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 image in the first pre-play buffer is greater than the discard threshold (i.e., the third preset threshold in the above embodiment), the played image with an earlier storage time is determined from the first pre-play buffer and deleted.
As can be seen from the foregoing, in the embodiment of the present invention, after the target pre-play buffer is determined, when playing according to the playing sequence corresponding to the playing mode, the played image can be stored while the image to be played is buffered, so when the user switches the video playing direction, only the target pre-play buffer needs to be determined again, and the corresponding code stream does not need to be buffered again, thereby shortening the buffering time and improving the user experience.
Example six:
based on the above embodiment, in the embodiment of the present invention, the overall design flow is shown in fig. 7.
Step S701: pre-play buffer request threshold and discard threshold are preset, and pre-decode buffer request threshold and discard threshold are set.
Step S702: the playing direction is set by the user, and then the playing is carried out according to the user-set playing direction.
Step S703: circularly judging whether the buffer play direction before play reaches a request threshold value, and if not, requesting data to the upstream; judging whether the playing buffer playing reverse direction reaches a discarding threshold value, and discarding the buffer frame if the playing buffer playing reverse direction reaches the discarding threshold value.
Step S704: the same method is used for circularly judging the request threshold value and the discard threshold value of the buffer before decoding, namely circularly judging whether the playing direction of the buffer before decoding reaches the request threshold value, and if so, requesting data upstream; and judging whether the reverse direction of the buffer play before decoding reaches a discard threshold, and discarding the corresponding frame if the reverse direction of the buffer play before decoding reaches the discard threshold.
Step S705: if the timer reaches the playing condition, playing the video, moving the corresponding iterator, and updating the buffer state.
The buffer control logic before playing is specifically as follows: judging whether the frame number of the image to be played in the buffer area before playing is smaller than a preset request threshold value according to the current playing direction, and if so, decoding the video frame corresponding to the request buffer request to the upper level (the buffer area before decoding); and judging whether the frame number of the played image in the buffer area before playing reaches a discarding threshold value or not in the opposite playing direction, and discarding the redundant image if the frame number of the played image in the buffer area before playing reaches the discarding threshold value.
The pre-decoding buffer control logic is specifically as follows: judging whether the frame number of the video frames to be played in the decoding direction is smaller than a preset request threshold according to the decoding direction corresponding to the current playing direction, and requesting corresponding video frames to an upper buffer (network stream or file stream) if the frame number is smaller than the request threshold; and judging whether the frame number of the played video frames in the buffer area before decoding reaches a discard threshold or not in the opposite decoding direction, and discarding redundant video frames if the frame number of the played video frames in the buffer area before decoding reaches the discard threshold.
Therefore, in the embodiment of the invention, the pre-decoding buffer and the pre-playing buffer are both bidirectional buffers, and no matter the forward playing is switched to the reverse playing or the reverse playing is switched to the forward playing, the code stream is not required to be rebuffered, so that the buffer time can be greatly shortened, and the user experience is improved.
Embodiment seven:
according to another aspect of the present invention, there is also provided a video playing device, as shown in fig. 8, the device including:
a first determining module 801, configured to determine a current playing mode according to a received video playing instruction, where the playing mode includes a video forward playing mode and a video backward playing mode;
a second determining module 802, configured to determine a target pre-play buffer from the first pre-play buffer and the second pre-play buffer according to the play mode;
A first determining module 803, configured to determine whether an image to be played corresponding to the playing mode is stored in the target pre-playing buffer;
a playing module 804, configured to play the image to be played according to the playing mode and a playing order corresponding to the playing mode if the judging result of the first judging module 803 is yes;
a first storage module 805 for storing 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 whether an image whose time stamp corresponds to the initial time point exists in the target play front buffer according to the time stamp of each frame of image in the target play front buffer;
and a second determining unit 8033, configured to determine each image to be played according to the timestamp, the initial time point, and the play sequence corresponding to the play mode of each frame of image in the target pre-play buffer if the determination result of the determining unit is yes.
Specifically, the second determining unit 8033 is specifically configured to:
When the playing mode is a video forward playing mode, determining an image with a time stamp 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 before target playing;
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 before target playing.
Specifically, the device further comprises:
a second determining module 806, configured to determine whether the number of frames of the image to be played stored in the target play front buffer is less 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 mode;
the decoding module 808 is configured to obtain a video frame to be played from the target pre-decoding buffer, and decode the obtained 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 a video reverse play mode, the second storage module 809 is specifically configured to reverse the decoded image in units of a group of GOPs, and store the reverse image in the target pre-play buffer.
Specifically, the device further comprises:
and a third storage module 810, configured to store the played video frame in another pre-decoding buffer after playing the image to be played according to the playing mode according to the playing sequence corresponding to the playing mode.
Specifically, the device further comprises:
a third judging module 811, configured to judge whether the number of frames of the played video frames stored in the other pre-decoding buffer is greater than a second preset threshold after the played video frames are stored in the other pre-decoding buffer;
a first deleting module 812, configured to determine, if the result of the determination by the third determining module 811 is yes, 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 delete the target video frames.
Specifically, the device further comprises:
a fourth judging module 813, configured to judge whether the number of frames of the played image stored in the other pre-play buffer is greater than a third preset threshold after the played image is stored in the other pre-play buffer;
And a second deleting module 814, configured to determine, if the result of the determination by the fourth determining module 814 is yes, a second number of target images with earlier storage time according to the storage time of the played images of each frame, and delete the target images.
Example eight:
according to another aspect of the present invention, there is also provided an electronic device, as shown in fig. 10, including: a processor 1001 and a memory 1002;
the processor 1001 is configured to execute a program in the read memory 1002, and perform the following procedures:
determining a current playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode;
judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not;
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 with a time stamp corresponding to the initial time point exists in the target playing front buffer area or not according to the time stamp of each frame of image in the target playing front buffer area; if yes, determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer zone, the initial time point and the playing sequence corresponding to the playing mode.
Specifically, when the play mode is a video forward play mode, the processor 1001 is configured to determine, according to a timestamp of each frame of image in the target pre-play buffer, an image with a timestamp greater than or equal to the initial time point as the image to be played; 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 before target playing.
Specifically, the processor 1001 is further configured to determine whether the number of frames of the image to be played stored in the buffer before target playing is less than a first preset threshold; if yes, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the playing 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 decoded image in the target playing front buffer zone.
Specifically, when the play mode is a video rewind mode, the processor 1001 is specifically configured to invert the decoded image 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 the played video frame in another pre-decoding buffer after playing the image to be played according to the playing mode in the playing order corresponding to the playing mode.
Specifically, the processor 1001 is further configured to determine, after storing the played video frame in the other pre-decoding buffer, whether the number of frames of the played video frame stored in the other pre-decoding buffer is greater than a second preset threshold; if so, 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 other pre-play buffer is greater than a third preset threshold; if so, 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, a bus architecture may be comprised of any number of interconnected buses and bridges, and in particular, one or more processors, represented by the processor 1001, and various circuits of memory, represented by the memory 1002. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, power management circuits, etc., which are well known in the art and, therefore, will not be described 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), ASIC (Application Specific Integrated Circuit ), FPGA (Field-Programmable Gate Array, field programmable Gate array), or 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, which when run on the electronic device, causes the electronic device to perform the steps of:
Determining a current playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode;
judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not;
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 target play front buffer area stores the image to be played corresponding to the play mode includes:
determining an initial time point of video playing according to the playing instruction;
judging whether an image with a time stamp corresponding to the initial time point exists in the target playing front buffer area or not according to the time stamp of each frame of image in the target playing front buffer area;
if yes, determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer zone, 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, the initial time point and the playing sequence corresponding to the playing mode of each frame image in the target pre-playing buffer zone includes:
when the playing mode is a video forward playing mode, determining an image with a time stamp 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 before target playing;
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 before target playing.
Specifically, the method further comprises:
judging whether the frame number of the image to be played stored in the target playing front buffer area is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the playing 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 decoded image in the target playing front buffer zone.
Specifically, when the play mode is a video reverse play mode, the storing the image obtained after decoding in the target play front buffer area includes:
and turning over the decoded image by taking a group of GOPs as a unit, and storing the turned-over image in the target pre-playing buffer zone.
Specifically, after the image to be played is played according to the playing mode and the playing sequence corresponding to the playing mode, the method further includes:
the played video frames are stored into another pre-decoding buffer.
Specifically, after the storing of the played video frames in another pre-decoding buffer, the method further comprises:
judging whether the frame number of the played video frames stored in the other pre-decoding buffer area is larger than a second preset threshold value or not;
if so, 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 the played image is stored in another pre-play buffer, the method includes:
judging whether the frame number of the played image stored in the other buffer area before playing is larger than a third preset threshold value or not;
If so, 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 memories such as floppy disks, hard disks, tapes, magneto-optical disks (MOs), etc., optical memories such as CD, DVD, BD, HVD, etc., and semiconductor memories such as ROM, EPROM, EEPROM, nonvolatile memories (NAND FLASH), solid State Disks (SSDs), etc.
For system/device embodiments, the description is relatively simple as it is substantially similar to method embodiments, with reference to the description of method embodiments in part.
It should be noted that in this document relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
It will be appreciated by those skilled in the art that 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 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. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It is obvious that the process is not limited to, various modifications and alterations to this application may be made by those skilled in the art without departing from the spirit and scope of this application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.

Claims (8)

1. A video playing method, the method comprising:
Determining a current playing mode according to a received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
determining a target play front buffer area from the first play front buffer area and the second play front buffer area according to the play mode;
judging whether an image to be played corresponding to the playing mode is stored in the target playing front buffer area or not;
if yes, playing the image to be played according to the playing sequence corresponding to the playing mode, wherein the playing sequence corresponding to the video forward playing mode is forward reading playing, and the playing sequence corresponding to the video reverse playing mode is reverse reading playing;
storing the played image in another pre-play buffer;
judging whether the frame number of the image to be played stored in the target playing front buffer area is smaller than a first preset threshold value or not;
if yes, determining a target pre-decoding buffer zone from the first pre-decoding buffer zone and the second pre-decoding buffer zone according to the playing mode;
acquiring a video frame to be played from the target pre-decoding buffer area, and decoding the acquired video frame to be played;
Storing the decoded image in the target playing front buffer area;
after the image to be played is played according to the playing mode and the playing sequence corresponding to the playing mode, the method further comprises:
storing the played video frames in another pre-decoding buffer;
when the playing mode is a video reverse playing mode, the storing the image obtained after decoding in the target playing buffer area includes:
and turning over the decoded image by taking a group of pictures (GOP) as a unit, and storing the turned-over image in the target playing buffer zone.
2. The method of claim 1, wherein the determining whether the target pre-play buffer stores the image to be played corresponding to the play mode comprises:
determining an initial time point of video playing according to the playing instruction;
judging whether an image with a time stamp corresponding to the initial time point exists in the target playing front buffer area or not according to the time stamp of each frame of image in the target playing front buffer area;
if yes, determining each image to be played according to the time stamp of each frame of image in the target pre-playing buffer zone, the initial time point and the playing sequence corresponding to the playing mode.
3. The method of claim 2, wherein determining each image to be played according to the timestamp of each frame of image in the target pre-play buffer, the initial time point, and the play order corresponding to the play mode comprises:
when the playing mode is a video forward playing mode, determining an image with a time stamp 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 before target playing;
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 before target playing.
4. The method of claim 1, wherein after storing the played video frames in another pre-decoding buffer, the method further comprises:
judging whether the frame number of the played video frames stored in the other pre-decoding buffer area is larger than a second preset threshold value or not;
if so, 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.
5. 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 image stored in the other buffer area before playing is larger than a third preset threshold value or not;
if so, 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.
6. A video playback device, the device comprising:
the first determining module is used for determining a current playing mode according to the received video playing instruction, wherein the playing mode comprises a video forward playing mode and a video backward playing mode;
the second determining module is used for determining a target playing front buffer zone from the first playing front buffer zone and the second playing front buffer zone according to the playing mode;
the first judging module is used for judging whether the target playing front buffer area stores an image to be played corresponding to the playing mode or not;
the playing module is used for playing the image to be played according to the playing sequence corresponding to the playing mode according to the playing mode if the judging result of the first judging module is yes, the playing sequence corresponding to the video forward playing mode is forward reading playing, and the playing sequence corresponding to the video backward playing mode is reverse reading playing;
The first storage module is used for storing the played image into another pre-playing buffer zone;
the second judging module is used for judging whether the frame number of the image to be played stored in the target playing front buffer area 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 a video frame to be played from the target pre-decoding buffer area and decoding the acquired video frame to be played;
the second storage module is used for storing the image obtained after decoding in the buffer area before target playing;
the third storage module is used for storing the played video frames into another pre-decoding buffer zone after playing the images to be played according to the playing mode and the playing sequence corresponding to the playing mode;
when the playing mode is a video reverse playing mode, the second storage module is specifically configured to reverse the decoded image in units of a group of pictures GOP, and store the reverse image in the target pre-playing buffer.
7. An electronic device, the electronic device comprising: comprising a memory and a processor;
the processor being adapted to read the program in the memory and to perform the steps of the method according to any one of claims 1-5.
8. A computer readable storage medium, characterized in that it stores a computer program executable by an electronic device, which when run on the electronic device causes the electronic device to perform the steps of the method according to any one of claims 1-5.
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 CN111372117A (en) 2020-07-03
CN111372117B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202751B (en) * 2020-09-25 2022-06-07 腾讯科技(深圳)有限公司 Animation processing method and device, electronic equipment and storage medium
CN112911389B (en) * 2021-01-18 2022-09-06 浙江大华技术股份有限公司 Video playing switching method, electronic equipment and computer storage medium
CN114390343B (en) * 2021-12-31 2024-06-14 深圳市闪剪智能科技有限公司 Multi-video playing method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101427569A (en) * 2006-04-28 2009-05-06 松下电器产业株式会社 Video reproduction device
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

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3036579B2 (en) * 1995-09-21 2000-04-24 日本電気株式会社 Special playback system in VOD system
KR100591754B1 (en) * 2003-06-11 2006-06-22 삼성전자주식회사 Image processing device and method for reverse playback of digital video stream
US7974523B2 (en) * 2004-07-06 2011-07-05 Magnum Semiconductor, Inc. Optimal buffering and scheduling strategy for smooth reverse in a DVD player or the like
US7463819B2 (en) * 2004-10-29 2008-12-09 Ati Technologies Ulc Video playback method and apparatus
US7471875B2 (en) * 2005-07-15 2008-12-30 Streaming Networks (Pvt.) Ltd. Method and system for providing instant reverse play
EP2635025B1 (en) * 2012-02-29 2015-04-08 Advanced Digital Broadcast S.A. Video processing method and video appliance implementing the method
US20130294526A1 (en) * 2012-05-01 2013-11-07 Kevin Thornberry Smooth reverse video playback on low-cost current generation set-top box hardware
CN106162235B (en) * 2016-08-17 2018-06-01 北京百度网讯科技有限公司 For the method and apparatus of Switch Video stream
CN107222779B (en) * 2017-06-08 2019-11-19 浙江大华技术股份有限公司 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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101427569A (en) * 2006-04-28 2009-05-06 松下电器产业株式会社 Video reproduction device
CN107005743A (en) * 2014-10-07 2017-08-01 瑞典爱立信有限公司 For realizing the video bits stream process called in
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

Also Published As

Publication number Publication date
CN111372117A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
CN111372117B (en) Video playing method and device, electronic equipment and storage medium
KR101034080B1 (en) Uniform video decoding and display
WO2016131223A1 (en) Frame loss method for video frame and video sending apparatus
US10129587B2 (en) Fast switching of synchronized media using time-stamp management
CN108495164B (en) Audio and video synchronization processing method and device, computer device and storage medium
US20170111705A1 (en) Apparatus And Method For Resuming Playing Of Media Source, And Smart Television
US20070147517A1 (en) Video processing system capable of error resilience and video processing method for same
CN111436004B (en) Video playing method, device and equipment and computer readable storage medium
US20170180746A1 (en) Video transcoding method and electronic apparatus
CN109996104A (en) A kind of video broadcasting method, device and electronic equipment
CN109996117B (en) Method and device for acquiring streaming media playing time
CN108924574B (en) Packet loss processing method, device, equipment and storage medium in recording and broadcasting system
US11600299B2 (en) Video processing method and apparatus, terminal, and storage medium
US20120093489A1 (en) Smooth rewind media playback
US10674188B2 (en) Playback apparatus, method of controlling playback apparatus, playback method and server apparatus
CN101193299A (en) Decoding circuit
ES2364374T3 (en) METHOD AND APPARATUS FOR DATA DECODING.
CN115361579B (en) Video transmission and display method and device, electronic equipment and storage medium
WO2020035036A1 (en) Program recording and playback method and device
CN111726683B (en) Media playing method and device, electronic equipment and storage medium
US7912349B1 (en) Validating frame dependency information
CN102495810B (en) Management method for data input into decoder
JP3073948B2 (en) Digital video decoding apparatus and digital video decoding method
JP2006066995A (en) Image reproducer, its control method and program, and storage medium
US20120163779A1 (en) Video server and seamless playback method

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