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

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

Info

Publication number
CN115776594A
CN115776594A CN202111048287.1A CN202111048287A CN115776594A CN 115776594 A CN115776594 A CN 115776594A CN 202111048287 A CN202111048287 A CN 202111048287A CN 115776594 A CN115776594 A CN 115776594A
Authority
CN
China
Prior art keywords
video
playing
decoder
frame
decoding
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.)
Pending
Application number
CN202111048287.1A
Other languages
Chinese (zh)
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network 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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202111048287.1A priority Critical patent/CN115776594A/en
Publication of CN115776594A publication Critical patent/CN115776594A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the disclosure provides a video continuous playing method, a video continuous playing device, an electronic device and a storage medium, wherein the method plays a first video based on a first decoder; when the first video is played to a first target timestamp, a second decoder is established, wherein the first target timestamp is the playing timestamp of the first video frame; and when the first video is played to the second target timestamp, playing the second video based on the second decoder. Because the second decoder is created in advance when the first video is played to the first video frame before the end of the playing of the first video, when the playing of the first video is ended, the second video can be decoded directly through the created second decoder without waiting for the creation of the decoder, so that the video switching gap blockage during the continuous playing process of the video segments can be reduced, and the switching smoothness of the video gaps during the continuous playing of the video segments can be improved.

Description

Video continuous playing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the disclosure relates to the technical field of computers, and in particular relates to a method and a device for continuously playing a video, an electronic device and a storage medium.
Background
In the existing video software, before playing a video stream or a video file, a decoder is required to decode the video. The decoder in the software generally refers to a program capable of decompressing a digital video, converts a compressed video file into a video frame capable of being rendered and played through a preset decoding protocol, performs encoding transmission and decoding playing on the video, can reduce the size of the video file, and is a common video processing technology.
In the prior art, when multiple segments of video need to be played continuously, a corresponding decoder needs to be established for each segment of video, and therefore, a video jam problem often occurs in a gap between switching multiple segments of video.
Disclosure of Invention
The embodiment of the disclosure provides a video continuous playing method and device, electronic equipment and a storage medium, so as to solve the problem that video switching gaps are blocked in a multi-segment video continuous playing process.
In a first aspect, an embodiment of the present disclosure provides a method for continuously playing a video, including: playing the first video based on the first decoder; when the first video is played to a first target timestamp, a second decoder is created, wherein the first target timestamp is the playing timestamp of the first video frame; when the first video is played to a second target timestamp, playing a second video based on the second decoder.
In a second aspect, an embodiment of the present disclosure provides a video continuous playing apparatus, including:
the first playing module is used for playing a first video based on the first decoder;
a decoding module, configured to create a second decoder when the first video is played to a first target timestamp, where the first target timestamp is a playing timestamp of the first video frame;
and the second playing module is used for playing a second video based on the second decoder when the first video is played to a second target timestamp.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
a processor, and a memory communicatively coupled to the processor;
the memory stores computer execution instructions;
the processor executes computer-executable instructions stored by the memory to implement the video continuous playback method as described above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, where a computer executing instruction is stored, and when a processor executes the computer executing instruction, the video continuous playing method according to the first aspect and various possible designs of the first aspect are implemented.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program that, when executed by a processor, implements the video continuous playback method as described in the first aspect above and in various possible designs of the first aspect.
In the method, the first video is played based on the first decoder; when the first video is played to a first target timestamp, creating a second decoder, wherein the first target timestamp is the playing timestamp of the first video frame; and when the first video is played to a second target time stamp, playing a second video based on the second decoder. Because the second decoder is created in advance when the first video is played to the first video frame before the end of the playing of the first video, when the playing of the first video is ended, the second video can be decoded directly through the created second decoder without waiting for the creation of the decoder, so that the video switching gap blockage during the continuous playing process of the video segments can be reduced, and the switching smoothness of the video gaps during the continuous playing of the video segments can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is an application scene diagram of a video continuous playing method provided by the embodiment of the present disclosure;
FIG. 2 is a diagram illustrating a multi-segment video being played continuously according to a prior art;
fig. 3 is a first schematic flowchart of a video continuous playing method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of determining a first target timestamp according to an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of a second method for continuously playing video according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a third target timestamp provided by an embodiment of the present disclosure;
FIG. 7 is a flowchart of the implementation steps of step S205 in the embodiment shown in FIG. 5;
fig. 8 is a schematic diagram of decoding a second video according to an embodiment of the present disclosure;
fig. 9 is a schematic diagram illustrating a second video being played from a second video frame according to an embodiment of the disclosure;
fig. 10 is a block diagram of a video continuous playing device according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 12 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without inventive step, are intended to be within the scope of the present disclosure.
The following explains an application scenario of the embodiment of the present disclosure:
fig. 1 is an application scene diagram of a video continuous playing method provided by an embodiment of the present disclosure, where the video continuous playing method provided by the embodiment of the present disclosure may be applied to an application scene of splicing and continuously playing multiple video segments, and exemplarily, as shown in fig. 1, the method provided by the embodiment of the present disclosure may be applied to a terminal device, where three videos a, B, and C are cached in the terminal device, and the video a, the video B, and the video C may be three short videos formed by dividing a long video. More specifically, for example, the a video, the B video, and the C video respectively correspond to consecutive videos (e.g., a tv series) on three pieces of content, as shown in the figure, the a video is currently played, after the a video is played, the B video is automatically played, and the C video is played after the B video. However, each video segment includes a start interval (e.g., a start song portion) and an end interval (e.g., a trailer song portion), and the seamless switching between videos can be realized by accurately jumping and switching the start interval and the end interval of each video segment, so that three short videos, namely, a video a, a video B and a video C, which are continuously played, are a long video in the aspect of viewing and feeling.
In the actual playing process, in a scene of continuously playing multiple segments of videos, in the playing process of each segment of video, a corresponding decoder needs to be created to decode the video, however, in the prior art, a (software) decoder is created to decode the video only before playing the video, fig. 2 is a schematic diagram of continuously playing multiple segments of videos in the prior art, as shown in fig. 2, in the process of continuously playing a video a and a video B, before playing a video, a decoder a for decoding a video needs to be created first; after the video a is played, a decoder B required for decoding the video B needs to be created to decode the video B. Therefore, for a scene in which multiple segments of videos are continuously played, after the previous video is played, a decoder is created to decode the next video, which results in time consumption in processing, so that a gap between the two segments of videos is blocked, the impression of seamless switching between the multiple segments of videos cannot be formed, and the watching experience of a user is influenced. The embodiment of the present disclosure provides a method for continuously playing a video to solve the above problem.
Fig. 3 is a first schematic flow chart of a video continuous playing method according to an embodiment of the present disclosure. The method of the embodiment can be applied to terminal equipment, and the video continuous playing method comprises the following steps:
step S101, playing a first video based on a first decoder.
Illustratively, the first decoder is a decoder program created by a program call based on a multimedia framework for decompressing compressed video encoding data into pixel data for rendering playback at a terminal device. The multimedia framework is, for example, an ffmpeg framework, and in such a multimedia framework, various decoders for decoding different types of video encoded data are included, and a corresponding decoder is determined and created according to the type of video. In this embodiment, the first video is a playing video, and before the first video is played, the terminal device creates a first decoder matching the video type of the first video through the multimedia framework, and decodes and plays the first video based on the first decoder.
Specifically, the method for playing the first video based on the first decoder comprises the following steps: and decoding the first video based on a first decoder to generate video frames of the first video, and sequentially playing each video frame of the first video according to the playing time stamp corresponding to each video frame. The video frame of the first video is pixel data generated after decoding by the decoder. And playing the first video, which is actually a process that the terminal equipment plays video frames of the first video in sequence according to the playing time stamps.
Step S102, when the first video is played to the first target time stamp, a second decoder is created.
Illustratively, in the process of playing the first video according to the playing time stamp corresponding to each video frame in the first video, when the first video frame corresponding to the first target time stamp is played, the second decoder is created. Wherein the second decoder is a decoder program created by a program call based on the multimedia framework, similar to the first decoder. The second decoder is used for playing a second video to be played after the first video.
The purpose of creating the second decoder is to create a decoder for decoding the second video in advance, and avoid time consumption and pause caused by creating the decoder after the first video is played. Therefore, the second decoder needs to be created before the end of the first video playing, and the time point created by the second decoder is when the first video is played to the first target timestamp. The first target timestamp may be preset, for example, a playing timestamp corresponding to 90% of the total playing duration of the first video is determined as the first target timestamp, or a playing timestamp of the first video when 30 seconds remain is determined as the first target timestamp; or dynamically determined according to video information such as the video length and the video content of the first video.
Therefore, in this embodiment, before step S102, a step of determining the first target timestamp may also be included.
In one possible implementation, determining the first target timestamp includes: acquiring preset target remaining time, wherein the target remaining time is determined based on configuration parameters of terminal equipment; and determining a first target timestamp according to the target remaining time. Illustratively, the target remaining duration is a parameter characterizing the remaining playing duration of the first video, for example, 30 seconds, and the target remaining duration may be determined based on a configuration parameter preset by the terminal device.
In another possible implementation, determining the first target timestamp includes: and when the first video decoding is finished, determining a playing time stamp which is next to the playing time stamp of the currently played video frame as a first target time stamp.
Fig. 4 is a schematic diagram for determining a first target timestamp according to an embodiment of the present disclosure, and as shown in fig. 4, in a playing process of a first video, a terminal device decodes and plays the first video synchronously, where a progress of the decoding process is faster than a progress of the playing process, that is, a decoding position is closer to a terminal of the first video than the playing position. When the decoding process is completed, that is, when the decoding position reaches the end of the first video, the playing time stamp corresponding to the next position of the playing position at this moment is determined as the first target time stamp. That is, the creation of the second decoder is started immediately after the decoding process is finished. Therefore, the computing resources of the terminal equipment are fully utilized, and the efficiency is improved.
In another possible implementation, the first target timestamp may also be determined according to the number of key frame periods (GOPs) of the first video. The key frame period may also be referred to as a frame group, which is a frame set composed of an Instantaneous Decoding Refresh (IDR) frame and a series of P and B frames (of course, other I frames may be included in the key frame period). The larger the number of key frame periods, the lower the delay, the better the fluency and sharpness of the video, and correspondingly, the larger the amount of data due to the increased number of I frames. In a scenario of continuously playing multiple segments of video, it is considered that the second video needs to be pre-decoded after the second decoder is established, and the video quality (set by a user) of the continuously played first video and second video is generally consistent, so that the larger the number of key frame periods of the first video is, the more time the second decoder should be pre-decoded, and therefore, the earlier the first target timestamp should be. For example, for a first video with a total duration of 1 minute, when the number of key frame periods of the first video is 100, the first target timestamp is 50 seconds; when the number of key frame periods of the first video is 200, the first target timestamp is 40 seconds. In this embodiment, the first target timestamp is determined according to the number of the key frame periods of the first video, so that the pre-judgment of the time length required for pre-decoding the second video by the second decoder is realized, the time accuracy for creating the second decoder is improved, and the probability of pause between videos is further avoided.
Step S103, when the first video is played to a second target timestamp, playing a second video based on a second decoder, wherein the second target timestamp is located after the first target timestamp.
Illustratively, after the terminal device creates the second decoder, the second decoder is in a state to be called, and the process of creating the second decoder consumes certain computing resources and causes certain time consumption, but since the process of creating the second decoder is synchronous with the playing process of the first video, the user does not perceive the time consumption of the process and does not feel the video stuck. And then, when the first video is played to the second target timestamp, decoding the second video based on the second decoder in the to-be-called state, so that the second video can be played quickly, and seamless switching between the first video and the second video can be realized because time consumption caused by the creation of the second decoder is avoided.
The second target timestamp may be a playing timestamp corresponding to the last frame of the first video, that is, after the first video is completely played, the second video is played; or the playing time stamp of the preset playing position in the first video, for example, the playing time stamp of the end of piece position, that is, the end of piece position of the first video is played, and the second video is directly played, so that the continuity of the first video and the second video in the content is realized.
In one possible implementation, the second target timestamp includes:
in this embodiment, analyzing video content corresponding to a video frame of a first video to obtain video content information, where the video content information is used to represent a content category of the video frame of the first video; a second target timestamp is determined based on the video content information.
Specifically, in the process of playing the video frame of the first video, the terminal device analyzes each video frame, extracts the image characteristics, classifies the video content corresponding to the video frame based on the image characteristics, and determines the corresponding content category, that is, the video content information. Illustratively, the content category includes, for example, "normal video", "trailer", "advertisement", and the like. According to the obtained video content information, when the content type corresponding to the video content information is 'trailer', the playing time stamp corresponding to the next video frame at the current playing position is determined as a second target time stamp, namely when the content in the video frame is detected to be trailer, the second video is switched to be played, so that the purpose of skipping the trailer, the advertisement and other content at the end of the video is achieved, and the continuity of the first video and the second video in the content is achieved.
In the present embodiment, by being based on the first decoder, the first video is played; when the first video is played to a first target timestamp, a second decoder is established, wherein the first target timestamp is the playing timestamp of the first video frame; and when the first video is played to the second target timestamp, playing the second video based on the second decoder. Because the second decoder is created in advance when the first video is played to the first video frame before the end, when the first video is played, the second video can be directly decoded through the created second decoder without waiting for the creation of the decoder, so that the video switching interval blockage in the continuous playing process of the video segments can be reduced, and the switching smoothness of the video intervals in the continuous playing process of the video segments can be improved.
Fig. 5 is a schematic flowchart illustrating a second method for continuously playing video according to an embodiment of the present disclosure. In this embodiment, the step of predecoding the second video after creating the second decoder is described in detail, and the video continuous playing method includes:
step S201, decoding the first video based on the first decoder, and generating a video frame of the first video.
Step S202, according to the playing time stamp corresponding to each video frame, each video frame of the first video is played in sequence.
Step S203, when the first video decoding is completed, determining a playing time stamp subsequent to the playing time stamp of the currently played video frame as a first target time stamp.
Illustratively, in the process of playing the first video based on the first decoder, two processing links of decoding the first video and playing the first video are included. The two processing links can be asynchronously executed through different threads, for example, a first thread of the terminal device decodes a first video, generates a video frame and caches the video frame; and a second thread of the terminal equipment plays the cached video frame of the first video. Typically, the first thread is decoding the first video faster than the second thread is playing the video frames. In a possible implementation manner, in the process that the terminal device plays the first video through the first thread, when the first video is played to the first target timestamp, the terminal device creates a decoder through the second thread to prepare for subsequently decoding the second video; meanwhile, the first thread continues to play the first video. Since the second thread is a worker thread previously used to decode the first video, the first target timestamp is determined by the progress of the second thread in decoding the first video. More specifically, in a possible implementation manner, when the second thread completes decoding of the first video, a playing timestamp that is subsequent to a playing timestamp of a currently played video frame is determined as the first target timestamp, that is, after the second thread decoding process is completed, the second thread immediately starts to create the second decoder, and the first thread and the second thread are independent of each other.
Step S204, when the first video is played to the first target time stamp, a second decoder is created.
Step S205, obtaining a preset third target timestamp, and sequentially decoding, based on the second decoder, video frames before the second video frame corresponding to the third target timestamp in the second video to generate an intermediate frame.
Exemplarily, after the second decoder is created, if the corresponding video contents are continuous in the last interval of the first video and the start interval of the second video, the second video is directly played after the first video is played, that is, the second target timestamp of the first video corresponds to the last frame of the first video, and the continuity of the contents between the first video and the second video can also be achieved. However, in some cases, the end interval of the first video is not consecutive in content with the start interval of the second video, e.g., there is a beginning of a movie, an end of a movie, a short black screen; or there is an overlap in the content, after the first video is played to the second target timestamp, the second video is directly skipped to play (seek), for example, the beginning of the movie and the segment overlapping with the end interval of the first video are directly skipped, and the second video is played from the content connection position of the second video and the first video, that is, the video frame corresponding to the third target timestamp. The method for determining the third target timestamp may refer to the method for determining the second target timestamp, or may be determined based on a preset duration threshold, which is not described herein again. Fig. 6 is a schematic diagram of a third target timestamp provided in the embodiment of the present disclosure, and as shown in fig. 6, after the first video is played to the second target timestamp, the first video directly jumps to the third target timestamp position of the second video to be played, and jumps to a trailer of the first video (shown as a clip in the figure), a trailer of the second video (shown as B clip in the figure), and a content clip of the second video that overlaps with an end interval of the first video (shown as C clip in the figure), so as to implement uninterrupted playing of the first video and the second video. Wherein the video frames in the second video that are skipped without being played, i.e. are intermediate frames, such as the credits (B-clips) of the second video, and/or the content clips (C-clips) in the second video that repeat with the end interval of the first video.
Optionally, as shown in fig. 7, step S205 includes three specific implementation steps of steps S2051, S2052, and S2053:
step S2051 determines a key frame period in which the second video frame is located.
Step S2052 locates a key frame in the key frame period.
And step S2053, based on the second decoder, sequentially decoding from the position of the key frame until the previous video frame of the second video frame to generate an intermediate frame.
Illustratively, in this process, the intermediate frames in the second video do not need to be played, but based on the video decoding principle, the intermediate frames still need to be decoded in order to be able to normally play the second video frames. In the step of this embodiment, a method for determining an inter frame is provided, in which a key frame period where a second video frame is located is first located, then an IDR frame in the key frame period is determined, and video encoded data between the IDR frame and the second video frame are sequentially decoded to generate the inter frame, so that a decoder decodes the inter frame to the position of the second video frame. Fig. 8 is a schematic diagram of decoding a second video according to an embodiment of the present disclosure, and as shown in fig. 8, after a second decoder is created, a first thread of a terminal device still plays the first video, and meanwhile, a second thread of the terminal device determines a key frame period and an IDR frame corresponding to a second video frame, and invokes the second decoder in a state to be invoked, and starts decoding from the IDR frame until a previous video frame of the second video frame, so as to generate an intermediate frame. Illustratively, since the playing process of the first video and the decoding process of the second video are performed synchronously and independently, the decoding process of the intermediate frame is completed without perception of the user.
And step S206, when the first video is played to the second target time stamp, decoding and playing the second video from the second video frame based on the second decoder.
Illustratively, when the first video is played to the second target timestamp, the content to be played in the first video is played completely, and then the content is played from the second video frame (i.e. the video frame corresponding to the third target playing frame) of the second video through the second decoder, so as to realize the switching from the first video to the second video, so that the user is playing a continuous section of video without perceiving the process of video switching in the view of watching the video.
Specifically, the purpose of starting playing from the second video frame can be achieved in a manner of performing skip playing (seek) on the second video based on the second video frame. Fig. 9 is a schematic diagram of playing a second video starting from a second video frame, as shown in fig. 9, on the basis of the process of decoding the second video shown in fig. 8, when jumping and playing the second video are started, an IDR frame corresponding to the second video frame (i.e., an IDR frame that is before the second video frame and is closest to the second video frame) may be directly located, and then jumping to the position of the second video frame is performed, and decompressing and subsequently playing the second video frame. The method steps executed by the first thread and the second thread in the embodiments shown in fig. 8 and fig. 9 are only exemplary, and may be set according to specific use requirements, and are not limited herein.
In this embodiment, the implementation manner of step S204 is the same as the implementation manner of step S102 in the embodiment shown in fig. 3 of the present disclosure, and is not described again.
Fig. 10 is a block diagram of a video continuous playing apparatus according to an embodiment of the present disclosure, which corresponds to the video continuous playing method according to the foregoing embodiment. For ease of illustration, only portions relevant to embodiments of the present disclosure are shown. Referring to fig. 10, the video continuous playback apparatus 3 includes:
a first playing module 31, configured to play a first video based on a first decoder;
a decoding module 32, configured to create a second decoder when the first video is played to a first target timestamp, where the first target timestamp is a playing timestamp of the first video frame;
and a second playing module 33, configured to play the second video based on the second decoder when the first video is played to the second target timestamp.
In an embodiment of the present disclosure, the decoding module 32 is further configured to: acquiring preset target remaining time, wherein the target remaining time is determined based on configuration parameters of terminal equipment and/or the number of key frame periods of a first video; and determining a first target timestamp according to the target remaining duration.
In an embodiment of the present disclosure, the first playing module 31 is specifically configured to: decoding the first video based on a first decoder to generate a video frame of the first video; sequentially playing each video frame of the first video according to the playing time stamp corresponding to each video frame; a decoding module 32, further configured to: and when the first video decoding is finished, determining a playing time stamp which is next to the playing time stamp of the currently played video frame as a first target time stamp.
In an embodiment of the present disclosure, the decoding module 32 is further configured to: analyzing video content corresponding to a video frame of a first video to obtain video content information, wherein the video content information is used for representing the content category of the video frame of the first video; a second target timestamp is determined based on the video content information.
In an embodiment of the disclosure, after creating the second decoder, the decoding module 32 is further configured to: and decoding the second video based on the second decoder to generate a video frame of the second video.
In one embodiment of the disclosure, the video frames of the second video comprise intermediate frames; when the decoding module 32 decodes the second video based on the second decoder to generate the video frame of the second video, it is specifically configured to: acquiring a preset third target timestamp; and based on the second decoder, sequentially decoding video frames before the second video frame corresponding to the third target timestamp in the second video to generate an intermediate frame.
In an embodiment of the present disclosure, when the decoding module 32 sequentially decodes, based on the second decoder, a video frame before the second video frame corresponding to the third target timestamp in the second video to generate an intermediate frame, specifically: determining a key frame period where the second video frame is located; locating a key frame in a key frame period; and based on the second decoder, sequentially decoding from the key frame position until the previous video frame of the second video frame to generate an intermediate frame.
In an embodiment of the present disclosure, when playing the second video based on the second decoder, the second playing module 33 is specifically configured to: and decoding and playing the second video from the second video frame based on the second decoder.
The first playing module 31, the decoding module 32 and the second playing module 33 are connected in sequence. The video continuous playing apparatus 3 provided in this embodiment may execute the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
The device provided in this embodiment may be used to implement the technical solution of the above method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, and as shown in fig. 11, the electronic device 4 includes:
a processor 41, and a memory 42 communicatively coupled to the processor 41;
the memory 42 stores computer-executable instructions;
processor 41 executes computer-executable instructions stored by memory 42 to implement the video continuous playback method in the embodiment shown in fig. 2-7.
Wherein optionally the processor 41 and the memory 42 are connected by a bus 43.
The relevant description may be understood by referring to the relevant description and effect corresponding to the steps in the embodiments corresponding to fig. 3 to fig. 9, and redundant description is not repeated here.
Referring to fig. 12, a schematic structural diagram of an electronic device 900 suitable for implementing the embodiment of the present disclosure is shown, where the electronic device 900 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car navigation terminal (e.g., a car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 12, the electronic device 900 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 901, which may perform various suitable actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage device 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are also stored. The processing apparatus 901, the ROM902, and the RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
Generally, the following devices may be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 907 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 908 including, for example, magnetic tape, hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic apparatus 900 to perform wireless or wired communication with other apparatuses to exchange data. While fig. 12 illustrates an electronic device 900 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, the processes described above with reference to the flow diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing apparatus 901.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the method shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first obtaining unit may also be described as a "unit obtaining at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a video continuous playing method, including: playing the first video based on the first decoder; when the first video is played to a first target timestamp, a second decoder is created, wherein the first target timestamp is the playing timestamp of the first video frame; when the first video is played to a second target timestamp, playing a second video based on the second decoder.
According to one or more embodiments of the present disclosure, the method further comprises: acquiring preset target remaining duration, wherein the target remaining duration is determined based on configuration parameters of terminal equipment and/or the number of key frame periods of the first video; and determining the first target timestamp according to the target remaining duration.
According to one or more embodiments of the present disclosure, playing a first video based on a first decoder includes: decoding the first video based on the first decoder to generate a video frame of the first video; sequentially playing each video frame of the first video according to the playing time stamp corresponding to each video frame; the method further comprises the following steps: and when the first video decoding is finished, determining a playing time stamp which is next to the playing time stamp of the currently played video frame as the first target time stamp.
According to one or more embodiments of the present disclosure, the method further comprises: analyzing video content corresponding to the video frame of the first video to obtain video content information, wherein the video content information is used for representing the content category of the video frame of the first video; and determining the second target timestamp according to the video content information.
According to one or more embodiments of the present disclosure, after creating the second decoder, the method further comprises: and decoding the second video based on the second decoder to generate a video frame of the second video.
According to one or more embodiments of the present disclosure, the video frames of the second video comprise intermediate frames; decoding the second video based on the second decoder to generate video frames of the second video, comprising: acquiring a preset third target timestamp; and based on the second decoder, sequentially decoding video frames before the second video frame corresponding to the third target timestamp in the second video to generate the intermediate frame.
According to one or more embodiments of the present disclosure, sequentially decoding, based on the second decoder, video frames before a second video frame corresponding to the third target timestamp in the second video to generate the intermediate frame includes: determining a key frame period where the second video frame is located; locating a key frame in the key frame period; and based on the second decoder, sequentially decoding from the position of the key frame until the previous video frame of the second video frame to generate the intermediate frame.
According to one or more embodiments of the present disclosure, playing the second video based on the second decoder includes: and decoding and playing the second video from the second video frame based on the second decoder.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a video continuous playback apparatus including:
the first playing module is used for playing the first video based on the first decoder;
a decoding module, configured to create a second decoder when the first video is played to a first target timestamp, where the first target timestamp is a play timestamp of the first video frame;
and the second playing module is used for playing a second video based on the second decoder when the first video is played to a second target timestamp.
According to one or more embodiments of the present disclosure, the decoding module is further configured to: acquiring preset target remaining duration, wherein the target remaining duration is determined based on configuration parameters of terminal equipment and/or the number of key frame periods of the first video; and determining the first target timestamp according to the target remaining duration.
According to one or more embodiments of the present disclosure, the first playing module is specifically configured to: decoding the first video based on the first decoder to generate a video frame of the first video; sequentially playing each video frame of the first video according to the playing time stamp corresponding to each video frame; the decoding module is further configured to: and when the first video decoding is finished, determining a playing time stamp which is next to the playing time stamp of the currently played video frame as the first target time stamp.
According to one or more embodiments of the present disclosure, the decoding module is further configured to: analyzing video content corresponding to the video frame of the first video to obtain video content information, wherein the video content information is used for representing the content category of the video frame of the first video; and determining the second target timestamp according to the video content information.
In accordance with one or more embodiments of the present disclosure, after creating the second decoder, the decoding module is further configured to: and decoding the second video based on the second decoder to generate a video frame of the second video.
According to one or more embodiments of the present disclosure, the video frames of the second video comprise intermediate frames; when the decoding module decodes the second video based on the second decoder to generate the video frame of the second video, the decoding module is specifically configured to: acquiring a preset third target timestamp; and based on the second decoder, sequentially decoding video frames before the second video frame corresponding to the third target timestamp in the second video to generate the intermediate frame.
According to one or more embodiments of the present disclosure, when the decoding module sequentially decodes, based on the second decoder, a video frame before a second video frame corresponding to the third target timestamp in the second video, and generates the intermediate frame, the decoding module is specifically configured to: determining a key frame period where the second video frame is located; locating a key frame in the key frame period; and based on the second decoder, sequentially decoding from the position of the key frame until the previous video frame of the second video frame to generate the intermediate frame.
According to one or more embodiments of the present disclosure, when the second playing module plays the second video based on the second decoder, the second playing module is specifically configured to: and decoding and playing the second video from the second video frame based on the second decoder.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device including: a processor, and a memory communicatively coupled to the processor;
the memory stores computer execution instructions;
the processor executes computer-executable instructions stored by the memory to implement the video continuous playback method as described above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the video continuous playing method according to the first aspect and various possible designs of the first aspect is implemented.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program that, when executed by a processor, implements the video continuous playing method as described in the first aspect and various possible designs of the first aspect.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other combinations of features described above or equivalents thereof without departing from the spirit of the disclosure. For example, the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (12)

1. A method for continuously playing video, comprising:
playing the first video based on the first decoder;
creating a second decoder when the first video is played to a first target timestamp;
playing a second video based on the second decoder when the first video is played to a second target timestamp, wherein the second target timestamp is located after the first target timestamp.
2. The method of claim 1, further comprising:
acquiring a preset target remaining time length, wherein the target remaining time length is determined based on configuration parameters of terminal equipment and/or the number of key frame periods of the first video;
and determining the first target timestamp according to the target remaining duration.
3. The method of claim 1, wherein playing the first video based on the first decoder comprises:
decoding the first video based on the first decoder to generate a video frame of the first video;
sequentially playing each video frame of the first video according to the playing time stamp corresponding to each video frame;
the method further comprises the following steps:
and when the first video decoding is finished, determining a playing time stamp which is next to the playing time stamp of the currently played video frame as the first target time stamp.
4. The method of claim 1, further comprising:
analyzing video content corresponding to the video frame of the first video to obtain video content information, wherein the video content information is used for representing the content category of the video frame of the first video;
and determining the second target timestamp according to the video content information.
5. The method according to any of claims 1-4, wherein after creating the second decoder, the method further comprises:
and decoding the second video based on the second decoder to generate a video frame of the second video.
6. The method of claim 5, wherein the video frames of the second video comprise intermediate frames; decoding the second video based on the second decoder to generate video frames of the second video, comprising:
acquiring a preset third target timestamp;
and based on the second decoder, sequentially decoding video frames before the second video frame corresponding to the third target timestamp in the second video to generate the intermediate frame.
7. The method of claim 6, wherein sequentially decoding, based on the second decoder, video frames that precede a second video frame corresponding to the third target timestamp in the second video to generate the inter frame, comprises:
determining a key frame period where the second video frame is located;
locating a key frame in the key frame period;
and based on the second decoder, sequentially decoding from the key frame position until a previous video frame of the second video frame to generate the intermediate frame.
8. The method of claim 7, wherein playing the second video based on the second decoder comprises:
and decoding and playing the second video from the second video frame based on the second decoder.
9. A video continuous playback apparatus, comprising:
the first playing module is used for playing the first video based on the first decoder;
a decoding module, configured to create a second decoder when the first video is played to a first target timestamp, where the first target timestamp is a playing timestamp of the first video frame;
and the second playing module is used for playing a second video based on the second decoder when the first video is played to a second target timestamp.
10. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer execution instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of video continuous playback as claimed in any one of claims 1 to 8.
11. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, implement the video continuous playback method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program which, when executed by a processor, implements the video continuous playback method of any one of claims 1 to 8.
CN202111048287.1A 2021-09-08 2021-09-08 Video continuous playing method and device, electronic equipment and storage medium Pending CN115776594A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111048287.1A CN115776594A (en) 2021-09-08 2021-09-08 Video continuous playing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111048287.1A CN115776594A (en) 2021-09-08 2021-09-08 Video continuous playing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115776594A true CN115776594A (en) 2023-03-10

Family

ID=85387940

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111048287.1A Pending CN115776594A (en) 2021-09-08 2021-09-08 Video continuous playing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115776594A (en)

Similar Documents

Publication Publication Date Title
US10930318B2 (en) Gapless video looping
CN112437345B (en) Video double-speed playing method and device, electronic equipment and storage medium
CN113676769B (en) Video decoding method, device and storage medium
US11785195B2 (en) Method and apparatus for processing three-dimensional video, readable storage medium and electronic device
CN113507637A (en) Media file processing method, device, equipment, readable storage medium and product
CN112969075A (en) Frame supplementing method and device in live broadcast process and computing equipment
CN110519645B (en) Video content playing method and device, electronic equipment and computer readable medium
CN115767181A (en) Live video stream rendering method, device, equipment, storage medium and product
CN111343503A (en) Video transcoding method and device, electronic equipment and storage medium
CN114666666B (en) Video skip playing method, device, terminal equipment and storage medium
US11388474B2 (en) Server-side scene change content stitching
CN114567812A (en) Audio playing method, device, system, electronic equipment and storage medium
CN113301424A (en) Play control method, device, storage medium and program product
CN113207044A (en) Video processing method and device, electronic equipment and storage medium
CN115776594A (en) Video continuous playing method and device, electronic equipment and storage medium
CN115914745A (en) Video decoding method and device, electronic equipment and computer readable medium
CN115878242A (en) Media content display method, device, equipment, readable storage medium and product
CN113139090A (en) Interaction method, interaction device, electronic equipment and computer-readable storage medium
CN115776590A (en) Dynamic image quality video playing method and device, electronic equipment and storage medium
CN113382293A (en) Content display method, device, equipment and computer readable storage medium
CN113395581B (en) Audio playing method and device, electronic equipment and storage medium
WO2023030402A1 (en) Video processing method, apparatus and system
CN114845162B (en) Video playing method and device, electronic equipment and storage medium
CN115802104A (en) Video skip playing method and device, electronic equipment and storage medium
CN113115074A (en) Video jamming processing method and device

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