CN117135411A - 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
CN117135411A
CN117135411A CN202311068610.0A CN202311068610A CN117135411A CN 117135411 A CN117135411 A CN 117135411A CN 202311068610 A CN202311068610 A CN 202311068610A CN 117135411 A CN117135411 A CN 117135411A
Authority
CN
China
Prior art keywords
target
playing position
determining
playing
video
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311068610.0A
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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202311068610.0A priority Critical patent/CN117135411A/en
Publication of CN117135411A publication Critical patent/CN117135411A/en
Pending legal-status Critical Current

Links

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/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/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The application provides a video playing method, a video playing device, electronic equipment and a storage medium. Comprising the following steps: detecting a seek instruction in the process of playing the target video; under the condition that the seek instruction is detected, determining a current playing position corresponding to the target video, and determining a target playing position corresponding to the seek instruction; determining a time interval between the current playing position and the target playing position; and under the condition that the time interval is smaller than or equal to the preset duration, acquiring image data corresponding to the target playing position from a preset cache, and playing the image data. According to the application, the image data pre-cached in the preset cache can be utilized to respond to the seek instruction, and the corresponding image data can be played, so that the time for loading and decoding the video can be saved, the time for realizing the seek function is shortened, and the problem of untimely response is solved.

Description

Video playing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of video playing technologies, and in particular, to a video playing method, a device, an electronic apparatus, and a storage medium.
Background
Streaming Media (Streaming Media) refers to a technology that compresses a series of Media data, and then transmits the compressed Media data in segments in a Streaming manner in a network, so as to realize real-time transmission of video and audio on the network for viewing. The user opens the streaming media player on the viewing device (such as a computer, a tablet, a mobile phone, etc.), and selects a media stream to be watched to watch the corresponding video. In the process of watching the video, the user can realize the effect of fast forward/fast backward through the seek function, namely, the effect of continuing to play from any position by dragging the play progress bar to the position.
The conventional process of implementing the seek function is generally: receiving a seek instruction issued by a user, determining a seek point (namely, a position to which a playing progress bar is dragged) based on the seek instruction, loading a video file corresponding to the seek point, analyzing the loaded video file, and finally, rendering the analyzed video file.
However, in the conventional process of implementing the seek function, links such as network loading and decoding of video files are required, and the problems of long time consumption and untimely response exist.
Disclosure of Invention
The embodiment of the application aims to provide a video playing method, a video playing device, electronic equipment and a storage medium, so as to solve the problems of long time consumption and untimely response in the traditional process of realizing the seek function. The specific technical scheme is as follows:
in a first aspect, a video playing method is provided, the method includes:
detecting a seek instruction in the process of playing the target video;
under the condition that the seek instruction is detected, determining a current playing position corresponding to the target video, and determining a target playing position corresponding to the seek instruction;
determining a time interval between the current playing position and the target playing position;
and under the condition that the time interval is smaller than or equal to the preset duration, acquiring image data corresponding to the target playing position from a preset cache, and playing the image data.
In a possible implementation manner, the obtaining, from a preset buffer, the image data corresponding to the target playing position includes:
acquiring a pre-stored image frame sequence from the preset cache, and determining a time stamp corresponding to each image frame in the image frame sequence;
determining the current playing time corresponding to the current playing position;
determining a target playing time corresponding to the target playing position based on the current playing time and the time interval;
determining an image frame with the corresponding timestamp consistent with the target playing time in the image frame sequence as a target image frame;
and determining the image data in the image frame sequence based on the target image frame, wherein the image data is a frame sequence in which the target image frame is arranged first.
In a possible implementation manner, the preset buffer includes a first buffer and a second buffer, wherein the first buffer stores a first frame sequence, and the second buffer stores a second frame sequence;
the obtaining the pre-stored image frame sequence from the preset buffer comprises the following steps:
acquiring the first frame sequence from the first buffer memory as the image frame sequence under the condition that the target playing position is in front of the current playing position;
and under the condition that the target playing position is behind the current playing position, acquiring the second frame sequence from the second buffer memory as the image frame sequence.
In one possible implementation, the determining the time interval between the current playing position and the target playing position includes:
determining the total playing time length corresponding to the target video, and determining the total length of a playing progress bar of the target video;
determining the interval length of a progress bar between the current playing position and the target playing position;
calculating a ratio of the interval length to the total length;
and determining the product of the ratio and the total playing duration as the time interval between the current playing position and the target playing position.
In one possible embodiment, the method further comprises:
sending a video loading request to a preset server based on the target playing position under the condition that the time interval is longer than the preset time length, so that the corresponding video file is returned by the preset server;
and analyzing the video file to obtain image data corresponding to the target playing position.
In one possible embodiment, the method further comprises:
determining target playing time corresponding to the target playing position;
determining a preloading time range corresponding to the target playing position based on the target playing time and the preset duration;
transmitting a pre-loading request to the preset server based on the pre-loading time range while transmitting the video loading request so as to return a corresponding pre-loading file from the preset server;
analyzing the pre-loaded file to obtain pre-loaded image data, and storing the pre-loaded image data into the preset cache.
In one possible embodiment, the method further comprises:
acquiring a plurality of historical seek instructions corresponding to the target video, wherein the historical seek instructions are instructions issued by a user aiming at the target video and/or the target video with the same type in a preset time period;
for each history seek instruction, determining a history target playing position indicated by the history seek instruction and a corresponding history current playing position when issuing the history seek instruction;
determining a history interval duration corresponding to the history seek instruction based on the history target playing position and the history current playing position;
and calculating the average value of the historical interval duration corresponding to all the historical seek instructions, and determining the average value as the preset duration.
In a second aspect, there is provided a video playing device, the device comprising:
the detection module is used for detecting a seek instruction in the process of playing the target video;
the first determining module is used for determining a current playing position corresponding to the target video and determining a target playing position corresponding to the seek instruction under the condition that the seek instruction is detected;
a second determining module, configured to determine a time interval between the current playing position and the target playing position;
the acquisition module is used for acquiring the image data corresponding to the target playing position from a preset cache and playing the image data under the condition that the time interval is smaller than or equal to the preset duration.
In one possible embodiment, the obtaining module is configured to:
acquiring a pre-stored image frame sequence from the preset cache, and determining a time stamp corresponding to each image frame in the image frame sequence;
determining the current playing time corresponding to the current playing position;
determining a target playing time corresponding to the target playing position based on the current playing time and the time interval;
determining an image frame with the corresponding timestamp consistent with the target playing time in the image frame sequence as a target image frame;
and determining the image data in the image frame sequence based on the target image frame, wherein the image data is a frame sequence in which the target image frame is arranged first.
In a possible implementation manner, the preset buffer includes a first buffer and a second buffer, wherein the first buffer stores a first frame sequence, and the second buffer stores a second frame sequence; the acquisition module is further configured to:
acquiring the first frame sequence from the first buffer memory as the image frame sequence under the condition that the target playing position is in front of the current playing position;
and under the condition that the target playing position is behind the current playing position, acquiring the second frame sequence from the second buffer memory as the image frame sequence.
In one possible embodiment, the second determining module is configured to:
determining the total playing time length corresponding to the target video, and determining the total length of a playing progress bar of the target video;
determining the interval length of a progress bar between the current playing position and the target playing position;
calculating a ratio of the interval length to the total length;
and determining the product of the ratio and the total playing duration as the time interval between the current playing position and the target playing position.
In one possible embodiment, the apparatus further comprises a parsing module for:
sending a video loading request to a preset server based on the target playing position under the condition that the time interval is longer than the preset time length, so that the corresponding video file is returned by the preset server;
and analyzing the video file to obtain image data corresponding to the target playing position.
In a possible embodiment, the apparatus further comprises a storage module for:
determining target playing time corresponding to the target playing position;
determining a preloading time range corresponding to the target playing position based on the target playing time and the preset duration;
transmitting a pre-loading request to the preset server based on the pre-loading time range while transmitting the video loading request so as to return a corresponding pre-loading file from the preset server;
analyzing the pre-loaded file to obtain pre-loaded image data, and storing the pre-loaded image data into the preset cache.
In a possible embodiment, the apparatus further comprises a third determining module for:
acquiring a plurality of historical seek instructions corresponding to the target video, wherein the historical seek instructions are instructions issued by a user aiming at the target video and/or the target video with the same type in a preset time period;
for each history seek instruction, determining a history target playing position indicated by the history seek instruction and a corresponding history current playing position when issuing the history seek instruction;
determining a history interval duration corresponding to the history seek instruction based on the history target playing position and the history current playing position;
and calculating the average value of the historical interval duration corresponding to all the historical seek instructions, and determining the average value as the preset duration.
In a third aspect, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspects when executing a program stored on a memory.
In a fourth aspect, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of the first aspects.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the video playback methods described above.
The embodiment of the application has the beneficial effects that:
the embodiment of the application provides a video playing method, a device, electronic equipment and a storage medium, wherein in the embodiment of the application, a seek instruction is detected in the process of playing a target video, the current playing position corresponding to the target video is determined under the condition that the seek instruction is detected, the target playing position corresponding to the seek instruction is determined, then the time interval between the current playing position and the target playing position is determined, and under the condition that the time interval is smaller than or equal to the preset duration, image data corresponding to the target playing position is acquired from a preset cache, and the image data is played. According to the application, the image data pre-cached in the preset cache can be utilized to respond to the seek instruction, and the corresponding image data can be played, so that the time for loading and decoding the video can be saved, the time for realizing the seek function is shortened, and the problem of untimely response is solved.
Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
Fig. 1 is a flowchart of a video playing method according to an embodiment of the present application;
fig. 2 is a flowchart of another video playing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a video playing device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The following disclosure provides many different embodiments, or examples, for implementing different structures of the application. In order to simplify the present disclosure, components and arrangements of specific examples are described below. They are, of course, merely examples and are not intended to limit the application. Furthermore, the present application may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed.
The following will describe a video playing method according to the embodiment of the present application in detail with reference to the specific embodiment, as shown in fig. 1, the specific steps are as follows:
s101, detecting a seek instruction in the process of playing a target video.
The seek instruction refers to an instruction triggered by a user by pulling a playing progress bar or other operations for selecting a playing progress (such as clicking a fast forward button for 5 seconds, clicking a fast backward button for 5 seconds, etc.) in the process of playing the target video by the terminal device.
In the embodiment of the application, the seek instruction is detected in real time in the process of playing the target video.
S102, under the condition that the seek instruction is detected, determining the current playing position corresponding to the target video, and determining the target playing position corresponding to the seek instruction.
The current playing position refers to the position of the current playing progress on the target video playing progress bar.
The target playing position refers to the position of the playing progress designated by the seek instruction issued by the user on the target video playing progress bar.
S103, determining the time interval between the current playing position and the target playing position.
In an embodiment of the present application, the specific implementation of determining the time interval between the current playing position and the target playing position may include the following steps:
step A1, determining the total playing time length corresponding to the target video and determining the total length of a playing progress bar of the target video;
a2, determining the interval length of a progress bar between the current playing position and the target playing position;
a3, calculating the ratio of the interval length to the total length;
and step A4, determining the product of the ratio and the total playing duration as the time interval between the current playing position and the target playing position.
The total playing duration refers to the total playing duration of the target video, for example, a 5-minute video, and the total playing duration is 5 minutes.
The total length of the playing progress bar refers to the length of the playing progress bar on the screen of the device. In the application, the corresponding pixels of the playing progress bar on the device screen can be determined first, and then the length of the area occupied by the pixels is calculated as the total length of the playing progress bar.
Since the ratio of the interval length of the progress bar between the current play position and the target play position to the total length of the play progress bar is equal to the ratio of the time interval between the current play position and the target play position to the total length of play, that is, interval length/total length=time interval/total length of play. Thus, the ratio of the interval length to the total length can be calculated and the product of the ratio and the total length of play can be determined as the time interval between the current play position and the target play position. Thus, the interval length of the current playing position and the target playing position in space can be converted into a time interval in time.
And S104, under the condition that the time interval is smaller than or equal to the preset duration, acquiring the image data corresponding to the target playing position from a preset cache, and playing the image data.
In the preset cache, an image frame sequence with preset duration from the current playing position is cached in advance. For example, the playing time corresponding to the current playing position is 1 minute and 30 seconds, and the preset duration is 60 seconds, and then the image frame sequence between 30 seconds and 2 minutes and 30 seconds is cached in the preset cache in advance.
In the preset buffer, image frame buffer is realized but rendering is not performed, and in the application, FBO (Framebuffer Object ) can be used to achieve the purpose. FBO allows rendering results to be stored into texture or rendering buffers without requiring them to be displayed on a screen.
The following is code that implements caching by FBO:
in the application, a timer may be set to execute a task, and the execution frequency of the task is set (for example, the execution frequency is 1 s), and a preset duration is set (for example, 60 seconds), for a picture frame buffer queue in a preset buffer, a minimum buffer unit gp is set, and according to the size of the gp, the picture frame buffer queue is grouped, and each time a buffer is newly added, or a buffer is popped up, where the gp is a minimum unit (for example, each time one image frame, two image frames, or one second image frame sequence, two second image frame sequence, etc.).
The following actions are performed every 1 second:
and correcting an image frame buffer queue in the preset buffer according to the playing time t corresponding to the current playing position. If the starting time of the last buffer unit of the current image frame buffer queue is less than t+60s, then the image frames are buffered one by one, the video gos is taken as a minimum unit, and the starting time of the last buffer unit is greater than t+60s. If the end point of the minimum buffer unit (i.e. the end time of the forefront buffer of the image frame) of the current image frame buffer queue is smaller than t-60s, the forefront part of the image buffer frame is popped up and released one by taking the video gos as a minimum unit until the end time of the forefront buffer of the image frame buffer is larger than or equal to t-60s. In this way, in the preset buffer, a sliding window picture buffer queue which can cover 60s before and after the current playing point t is maintained.
In addition, in the application, the preset time period can be determined by the following steps:
step B1, acquiring a plurality of historical seek instructions corresponding to the target video, wherein the historical seek instructions are instructions issued by a user aiming at the target video and/or the target video with the same type in a preset time period;
step B2, determining a historical target playing position indicated by each historical seek instruction and a corresponding historical current playing position when issuing the historical seek instruction;
step B3, determining a history interval duration corresponding to the history seek instruction based on the history target playing position and the history current playing position;
and B4, calculating an average value of the historical interval duration corresponding to all the historical seek instructions, and determining the average value as the preset duration.
According to the scheme, based on the historical seek instruction issued by the user, the time length (namely the historical interval time length) of hope of fast forward/fast backward when the user issues the historical seek instruction each time can be known, and the average value of the historical interval time lengths corresponding to all the historical seek instructions is determined to be the preset time length. Thus, when a new seek instruction is issued by a user, the hit rate of the image frames in the preset cache can be improved.
Based on the above, when the time interval is less than or equal to the preset duration, the image data corresponding to the target playing position can be obtained from the preset buffer memory, and the image data is rendered to realize the playing of the image data. Therefore, the time for loading and decoding the video can be saved, the time for realizing the seek function is shortened, and the problem of untimely response is solved.
In application, the rendering of image data may be achieved by:
/>
in addition, in the application, after the buffered image data is played, the subsequent video data can be played through the following codes.
/>
/>
/>
As to how to obtain the image data corresponding to the target playing position from the preset buffer, detailed explanation will be made by the following embodiments, which will not be described in detail here.
In yet another embodiment of the present application, the method may further comprise the steps of: and under the condition that the time interval is longer than the preset time length, sending a video loading request to a preset server based on the target playing position so that the corresponding video file is returned by the preset server, and analyzing the video file to obtain image data corresponding to the target playing position. Therefore, when the target playing position indicated by the seek instruction exceeds the data cached in advance in the preset cache, the corresponding image data is requested to be loaded to the preset server so as to realize the seek function.
Furthermore, in yet another embodiment of the present application, the method may further include the steps of:
step C1, determining target playing time corresponding to the target playing position;
step C2, determining a preloading time range corresponding to the target playing position based on the target playing time and the preset duration;
step C3, transmitting a pre-loading request to the preset server based on the pre-loading time range while transmitting the video loading request so as to return a corresponding pre-loading file from the preset server;
and C4, analyzing the preloaded file to obtain preloaded image data, and storing the preloaded image data into the preset cache.
The preloading time range refers to the range between the target playing time and the preset duration and between the target playing time and the preset duration.
In this embodiment, while sending a video loading request to a server, video data (i.e., a pre-loaded file) within a pre-loaded time range is pre-requested to a preset server, and pre-loaded image data obtained by analyzing the pre-loaded file is stored in a preset buffer. Thus, the preloading of partial videos before and after the target playing time is realized.
According to the scheme, the video of the front part and the rear part of the target playing time can be acquired and cached while the image data corresponding to the target playing position is acquired, so that when a user further issues a seek instruction corresponding to the video based on the target playing position, the corresponding image data can be provided in time through the preset cache, the waiting time of the user is reduced, and the user experience is improved.
In the embodiment of the application, a seek instruction is detected in the process of playing a target video, a current playing position corresponding to the target video is determined under the condition that the seek instruction is detected, a target playing position corresponding to the seek instruction is determined, then, a time interval between the current playing position and the target playing position is determined, and under the condition that the time interval is less than or equal to a preset duration, image data corresponding to the target playing position is obtained from a preset cache, and the image data is played. According to the application, the image data pre-cached in the preset cache can be utilized to respond to the seek instruction, and the corresponding image data can be played, so that the time for loading and decoding the video can be saved, the time for realizing the seek function is shortened, and the problem of untimely response is solved.
Referring to fig. 2, a flowchart of an embodiment of another video playing method according to an embodiment of the present application is provided. The flow shown in fig. 2 describes how to obtain the image data corresponding to the target playing position from the preset buffer based on the flow shown in fig. 1. As shown in fig. 2, the process may include the steps of:
s201, acquiring a pre-stored image frame sequence from the preset buffer, and determining a time stamp corresponding to each image frame in the image frame sequence.
In the embodiment of the present application, the preset buffer includes a first buffer and a second buffer, the first buffer stores a first frame sequence, the second buffer stores a second frame sequence, and the specific implementation of obtaining the pre-stored image frame sequence from the preset buffer may include:
and under the condition that the target playing position is positioned before the current playing position, acquiring the first frame sequence from the first buffer memory as the image frame sequence, and under the condition that the target playing position is positioned after the current playing position, acquiring the second frame sequence from the second buffer memory as the image frame sequence.
Here, the preset buffer is divided into two buffer spaces in advance, namely, a first buffer in which video data (i.e., a first frame sequence) of a preset duration before the current play position is buffered in advance, and a second buffer in which video data (i.e., a second frame sequence) of a preset duration after the current play position is buffered in advance. In this way, according to the position of the target playing position relative to the current playing position, half of the frame sequence (i.e. the first frame sequence or the second frame sequence) can be obtained from the preset buffer as the image frame sequence, so that the calculation amount of the subsequent target image frame determination is reduced.
The timestamp corresponding to the image frame refers to the playing time of the image frame in the normal playing process of the target video, for example, the timestamp of the image frame 1 is 6 seconds, which means that the image frame 1 is played in the 6 th second in the normal playing process of the target video.
S202, determining the current playing time corresponding to the current playing position.
S203, determining the target playing time corresponding to the target playing position based on the current playing time and the time interval.
In the embodiment of the application, when the target playing position is in front of the current playing position, the target playing time corresponding to the target playing position is obtained by subtracting the time interval from the current playing time, and when the target playing position is behind the current playing position, the target playing time corresponding to the target playing position is obtained by adding the time interval from the current playing time.
S204, determining the image frame with the corresponding timestamp consistent with the target playing time in the image frame sequence as a target image frame.
S205, determining the image data in the image frame sequence based on the target image frame, wherein the image data is a frame sequence in which the target image frame is arranged first.
S204 to S205 are collectively described below:
in the embodiment of the application, firstly, an image frame with the corresponding time stamp consistent with the target playing time in an image frame sequence is determined as a target image frame, then, the target image frame is used as the image frame arranged at the first position, a frame sequence with a preset length is obtained, and the frame sequence is determined as image data.
The preset length may be specifically set by the user according to the actual requirement, for example, when the minimum buffer unit is 5 seconds of data, the preset length may be a 5 second frame sequence.
Through the flow shown in fig. 2, the target playing time corresponding to the target playing position can be determined based on the current playing time and the time interval corresponding to the current playing position, and then, the image data is determined according to the target image frame with the corresponding time stamp equal to the target playing time in the image frame sequence. Thereby, acquisition of image data is achieved.
Based on the same technical concept, the embodiment of the application further provides a video playing device, as shown in fig. 3, where the device includes:
the detection module 301 is configured to detect a seek instruction in a process of playing a target video;
a first determining module 302, configured to determine, when the seek instruction is detected, a current playing position corresponding to the target video, and determine a target playing position corresponding to the seek instruction;
a second determining module 303, configured to determine a time interval between the current playing position and the target playing position;
the obtaining module 304 is configured to obtain, from a preset cache, image data corresponding to the target playing position and play the image data when the time interval is less than or equal to a preset duration.
In one possible embodiment, the obtaining module is configured to:
acquiring a pre-stored image frame sequence from the preset cache, and determining a time stamp corresponding to each image frame in the image frame sequence;
determining the current playing time corresponding to the current playing position;
determining a target playing time corresponding to the target playing position based on the current playing time and the time interval;
determining an image frame with the corresponding timestamp consistent with the target playing time in the image frame sequence as a target image frame;
and determining the image data in the image frame sequence based on the target image frame, wherein the image data is a frame sequence in which the target image frame is arranged first.
In a possible implementation manner, the preset buffer includes a first buffer and a second buffer, wherein the first buffer stores a first frame sequence, and the second buffer stores a second frame sequence; the acquisition module is further configured to:
acquiring the first frame sequence from the first buffer memory as the image frame sequence under the condition that the target playing position is in front of the current playing position;
and under the condition that the target playing position is behind the current playing position, acquiring the second frame sequence from the second buffer memory as the image frame sequence.
In one possible embodiment, the second determining module is configured to:
determining the total playing time length corresponding to the target video, and determining the total length of a playing progress bar of the target video;
determining the interval length of a progress bar between the current playing position and the target playing position;
calculating a ratio of the interval length to the total length;
and determining the product of the ratio and the total playing duration as the time interval between the current playing position and the target playing position.
In one possible embodiment, the apparatus further comprises a parsing module for:
sending a video loading request to a preset server based on the target playing position under the condition that the time interval is longer than the preset time length, so that the corresponding video file is returned by the preset server;
and analyzing the video file to obtain image data corresponding to the target playing position.
In a possible embodiment, the apparatus further comprises a storage module for:
determining target playing time corresponding to the target playing position;
determining a preloading time range corresponding to the target playing position based on the target playing time and the preset duration;
transmitting a pre-loading request to the preset server based on the pre-loading time range while transmitting the video loading request so as to return a corresponding pre-loading file from the preset server;
analyzing the pre-loaded file to obtain pre-loaded image data, and storing the pre-loaded image data into the preset cache.
In a possible embodiment, the apparatus further comprises a third determining module for:
acquiring a plurality of historical seek instructions corresponding to the target video, wherein the historical seek instructions are instructions issued by a user aiming at the target video and/or the target video with the same type in a preset time period;
for each history seek instruction, determining a history target playing position indicated by the history seek instruction and a corresponding history current playing position when issuing the history seek instruction;
determining a history interval duration corresponding to the history seek instruction based on the history target playing position and the history current playing position;
and calculating the average value of the historical interval duration corresponding to all the historical seek instructions, and determining the average value as the preset duration.
In the embodiment of the application, a seek instruction is detected in the process of playing a target video, a current playing position corresponding to the target video is determined under the condition that the seek instruction is detected, a target playing position corresponding to the seek instruction is determined, then, a time interval between the current playing position and the target playing position is determined, and under the condition that the time interval is less than or equal to a preset duration, image data corresponding to the target playing position is obtained from a preset cache, and the image data is played. According to the application, the image data pre-cached in the preset cache can be utilized to respond to the seek instruction, and the corresponding image data can be played, so that the time for loading and decoding the video can be saved, the time for realizing the seek function is shortened, and the problem of untimely response is solved.
Based on the same technical concept, the embodiment of the present application further provides an electronic device, as shown in fig. 4, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, where the processor 111, the communication interface 112, and the memory 113 perform communication with each other through the communication bus 114,
a memory 113 for storing a computer program;
the processor 111 is configured to execute a program stored in the memory 113, and implement the following steps:
detecting a seek instruction in the process of playing the target video;
under the condition that the seek instruction is detected, determining a current playing position corresponding to the target video, and determining a target playing position corresponding to the seek instruction;
determining a time interval between the current playing position and the target playing position;
and under the condition that the time interval is smaller than or equal to the preset duration, acquiring image data corresponding to the target playing position from a preset cache, and playing the image data.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program which when executed by a processor implements the steps of any of the video playing methods described above.
In yet another embodiment of the present application, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the video playback methods of the above embodiments.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Based on such understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the related art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the respective embodiments or some parts of the embodiments.
It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only, and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises," "comprising," "includes," "including," and "having" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and/or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order described or illustrated, unless an order of performance is explicitly stated. It should also be appreciated that additional or alternative steps may be used.
The foregoing is only a specific embodiment of the application to enable those skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A video playing method, the method comprising:
detecting a seek instruction in the process of playing the target video;
under the condition that the seek instruction is detected, determining a current playing position corresponding to the target video, and determining a target playing position corresponding to the seek instruction;
determining a time interval between the current playing position and the target playing position;
and under the condition that the time interval is smaller than or equal to the preset duration, acquiring image data corresponding to the target playing position from a preset cache, and playing the image data.
2. The method of claim 1, wherein the obtaining the image data corresponding to the target playing position from the preset buffer includes:
acquiring a pre-stored image frame sequence from the preset cache, and determining a time stamp corresponding to each image frame in the image frame sequence;
determining the current playing time corresponding to the current playing position;
determining a target playing time corresponding to the target playing position based on the current playing time and the time interval;
determining an image frame with the corresponding timestamp consistent with the target playing time in the image frame sequence as a target image frame;
and determining the image data in the image frame sequence based on the target image frame, wherein the image data is a frame sequence in which the target image frame is arranged first.
3. The method of claim 2, wherein the preset buffer comprises a first buffer and a second buffer, the first buffer storing a first frame sequence and the second buffer storing a second frame sequence;
the obtaining the pre-stored image frame sequence from the preset buffer comprises the following steps:
acquiring the first frame sequence from the first buffer memory as the image frame sequence under the condition that the target playing position is in front of the current playing position;
and under the condition that the target playing position is behind the current playing position, acquiring the second frame sequence from the second buffer memory as the image frame sequence.
4. The method of claim 1, wherein the determining the time interval between the current play position and the target play position comprises:
determining the total playing time length corresponding to the target video, and determining the total length of a playing progress bar of the target video;
determining the interval length of a progress bar between the current playing position and the target playing position;
calculating a ratio of the interval length to the total length;
and determining the product of the ratio and the total playing duration as the time interval between the current playing position and the target playing position.
5. The method according to claim 1, wherein the method further comprises:
sending a video loading request to a preset server based on the target playing position under the condition that the time interval is longer than the preset time length, so that the corresponding video file is returned by the preset server;
and analyzing the video file to obtain image data corresponding to the target playing position.
6. The method of claim 5, wherein the method further comprises:
determining target playing time corresponding to the target playing position;
determining a preloading time range corresponding to the target playing position based on the target playing time and the preset duration;
transmitting a pre-loading request to the preset server based on the pre-loading time range while transmitting the video loading request so as to return a corresponding pre-loading file from the preset server;
analyzing the pre-loaded file to obtain pre-loaded image data, and storing the pre-loaded image data into the preset cache.
7. The method according to claim 1, wherein the method further comprises:
acquiring a plurality of historical seek instructions corresponding to the target video, wherein the historical seek instructions are instructions issued by a user aiming at the target video and/or the target video with the same type in a preset time period;
for each history seek instruction, determining a history target playing position indicated by the history seek instruction and a corresponding history current playing position when issuing the history seek instruction;
determining a history interval duration corresponding to the history seek instruction based on the history target playing position and the history current playing position;
and calculating the average value of the historical interval duration corresponding to all the historical seek instructions, and determining the average value as the preset duration.
8. A video playback device, the device comprising:
the detection module is used for detecting a seek instruction in the process of playing the target video;
the first determining module is used for determining a current playing position corresponding to the target video and determining a target playing position corresponding to the seek instruction under the condition that the seek instruction is detected;
a second determining module, configured to determine a time interval between the current playing position and the target playing position;
the acquisition module is used for acquiring the image data corresponding to the target playing position from a preset cache and playing the image data under the condition that the time interval is smaller than or equal to the preset duration.
9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-7 when executing a program stored on a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-7.
CN202311068610.0A 2023-08-23 2023-08-23 Video playing method and device, electronic equipment and storage medium Pending CN117135411A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311068610.0A CN117135411A (en) 2023-08-23 2023-08-23 Video playing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311068610.0A CN117135411A (en) 2023-08-23 2023-08-23 Video playing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117135411A true CN117135411A (en) 2023-11-28

Family

ID=88850196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311068610.0A Pending CN117135411A (en) 2023-08-23 2023-08-23 Video playing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117135411A (en)

Similar Documents

Publication Publication Date Title
WO2017107649A1 (en) Video transmission method and device
CN111163345B (en) Image rendering method and device
WO2018000624A1 (en) Video playing control method and device
CN109474854B (en) Video playing method, playlist generating method and related equipment
US11323750B2 (en) Video system and video processing method, device and computer readable medium
CN103475932A (en) Seamless on-line playing method and device of network video and network television system
CN113395572A (en) Video processing method and device, storage medium and electronic equipment
CN109756622B (en) Image caching method and device, mobile terminal and storage medium
US20170153774A1 (en) Method and device for displaying program information and terminal apparatus
US20150134846A1 (en) Method and apparatus for media segment request retry control
CN111107438B (en) Video loading method and device and electronic equipment
US20140304726A1 (en) Consumption Likelihood of Linear Content Streams
CN113691859A (en) Video caching method, device, equipment and medium
CN111726641A (en) Live video playing processing method and device and server
US20170257658A1 (en) Method for automatically pushing video based on analysis of user behavior and electronic device
CN112929728A (en) Video rendering method, device and system, electronic equipment and storage medium
CN106940722B (en) Picture display method and device
CN111541927A (en) Video playing method and device
CN111131812A (en) Broadcast time testing method and device and computer readable storage medium
EP3725086A1 (en) Controlling playout of advertisement content during video-on-demand video streaming on an en-user terminal
CN111353455B (en) Video content determining method and device, storage medium and electronic equipment
CN117135411A (en) Video playing method and device, electronic equipment and storage medium
CN111835955B (en) Data acquisition method and device
CN112055258B (en) Time delay testing method and device for loading live broadcast picture, electronic equipment and storage medium
US10165245B2 (en) Pre-fetching video content

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