CN112423140A - Video playing method and device, electronic equipment and storage medium - Google Patents
Video playing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112423140A CN112423140A CN202011485383.8A CN202011485383A CN112423140A CN 112423140 A CN112423140 A CN 112423140A CN 202011485383 A CN202011485383 A CN 202011485383A CN 112423140 A CN112423140 A CN 112423140A
- Authority
- CN
- China
- Prior art keywords
- video stream
- played
- time
- playing
- segment
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-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/47217—End-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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/433—Content storage operation, e.g. storage operation in response to a pause request, caching operations
- H04N21/4331—Caching operations, e.g. of an advertisement for later insertion during playback
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/44004—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-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/47202—End-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 requesting content on demand, e.g. video on demand
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 embodiment of the application provides a video playing method, a video playing device, electronic equipment and a storage medium, wherein the method comprises the following steps: decoding the video stream file; caching each key frame and a reference frame corresponding to the key frame as a video stream fragment; based on the key frames and the timestamps of the corresponding key frames, establishing an index relationship between the video stream fragments and the time periods in which the video stream fragments are located; responding to the on-demand instruction, determining a video stream segment to be played based on the index relation, and caching the video stream segment to be played; determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played; and from the playing position, the video stream file corresponding to the video stream clip to be played is played in the forward or reverse direction. The method and the device can enable the video stream file to be played smoothly without blockage no matter the video stream file is played in the forward direction or in the reverse direction, and meanwhile the video stream file can be randomly switched between the forward playing and the reverse playing.
Description
Technical Field
Embodiments of the present application relate to the field of video-on-demand technologies, and in particular, to a video playing method and apparatus, an electronic device, and a storage medium.
Background
When a video is played from a certain position, the video needing to be cached needs to be positioned by traversing a video stream file, and the processing process occupies a large memory space and coding and decoding resources, so that the video cannot be played in time, an error exists when the video reverse playing function is used for synchronous playing, and the forward playing and the reverse playing cannot be switched at will.
Disclosure of Invention
In order to solve the problem that the forward playing and the reverse playing of the video are switched randomly without errors, the application provides a video playing method, a video playing device, electronic equipment and a storage medium.
In a first aspect of the present application, a video playing method is provided, including: decoding the video stream file to obtain key frames of the video stream file and timestamps and reference frames corresponding to the key frames; caching each key frame and a reference frame corresponding to the key frame as a video stream fragment; establishing an index relation between the video stream fragments and the time periods of the video stream fragments based on the key frames and the timestamps of the corresponding key frames; responding to a request order, determining a video stream segment to be played based on the index relation, and caching the video stream segment to be played, wherein the request order comprises playing time; determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played; and forward or backward playing the video stream file corresponding to the video stream clip to be played from the playing position.
Preferably, the forward playing or reverse playing of the video stream file corresponding to the video stream segment to be played includes: when the video stream file corresponding to the video stream clip to be played is played, caching the video stream clip behind the video stream clip to be played according to a time sequence; and when the video stream file corresponding to the video stream segment to be played is reversely played, caching the video stream segment positioned in front of the video stream segment to be played according to the time sequence.
Preferably, the forward playing or reverse playing of the video stream file corresponding to the video stream segment to be played includes: and when the video stream files corresponding to the video stream clips to be played are played in a forward or reverse mode in multiple ways, carrying out clock synchronization on the multiple video stream files.
Preferably, before the establishing of the index relationship between the key frames and the time periods in which the key frames are located based on the plurality of key frames of the video stream file and the timestamps of the key frames, the method further includes: receiving the on-demand instruction input by a user; sending the on-demand instruction to an on-demand server, wherein the on-demand server responds to the on-demand instruction, calls a video stream file corresponding to the on-demand instruction from a storage server, and forwards the video stream file to a forwarding server; receiving the video stream file transmitted by the forwarding server; the video stream file is encoded in a key frame and reference frame mode and stored in a storage server; the on-demand instruction also includes an identification of the video stream file.
Preferably, the establishing an index relationship between the video stream segment and the time period in which the video stream segment is located includes: taking the time stamp of the key frame of the video stream segment as the starting time of the time segment in which the key frame is positioned; taking the time stamp of the key frame of the next video stream segment as the cut-off time of the time segment; and determining the time period of the video stream segment according to the starting time and the ending time.
Preferably, the determining the video stream segment to be played based on the index relationship includes: determining a time period corresponding to the playing time in the index relation; and taking the video stream segment corresponding to the time period as the video stream segment to be played.
In a second aspect of the present application, there is provided a video playback apparatus comprising: the video decoding module is used for decoding the video stream file to obtain a key frame of the video stream file and a timestamp and a reference frame corresponding to the key frame; the first cache module is used for caching each key frame and the reference frame corresponding to the key frame as video stream fragments; the relation establishing module is used for establishing an index relation between the video stream fragments and the time periods of the video stream fragments based on the key frames and the timestamps of the corresponding key frames; the second cache module is used for responding to a video-on-demand instruction, determining a video stream segment to be played based on the index relation, and caching the video stream segment to be played, wherein the video-on-demand instruction comprises playing time; the position determining module is used for determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played; and the video playing module is used for forward playing or backward playing the video stream file corresponding to the video stream clip to be played from the playing position.
Preferably, the method further comprises the following steps: the instruction receiving module is used for receiving the on-demand instruction input by the user; the order sending module is used for sending the on-demand order to an on-demand server, and the on-demand server responds to the on-demand order, calls a video stream file corresponding to the on-demand order from a storage server and forwards the video stream file to a forwarding server; a file receiving module, configured to receive the video stream file sent by the forwarding server; the video stream file is encoded in a key frame and reference frame mode and stored in a storage server; the on-demand instruction also includes an identification of the video stream file.
In a third aspect of the present application, there is provided an electronic device comprising a memory having stored thereon a computer program and a processor implementing the method according to any of the first aspects when executing the program.
In a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of the first aspect.
In the video playing method, the apparatus, the electronic device and the storage medium provided in the embodiments of the present application, the key frames of the video stream file and the timestamps and reference frames corresponding to the key frames are obtained, each key frame and the reference frame corresponding to the key frame are cached as a video stream clip, an index relationship between the video stream clip and the time period in which the video stream clip is located is established based on the key frame and the timestamp corresponding to the key frame, the video stream clip to be played is determined based on the index relationship in response to the on-demand instruction, the video stream clip to be played is cached, the playing position is determined in the video stream clip to be played according to the time offset of the playing time relative to the timestamp of the key frame of the video stream clip to be played, the video stream file corresponding to the video stream clip to be played is played forward or backward from the playing position, so that the video stream file is played either forward or backward, smooth playing without blockage can be achieved, and meanwhile, the forward playing and the reverse playing of the video stream file can be switched randomly.
It should be understood that what is described in this summary section is not intended to limit key or critical features of the embodiments of the application, nor is it intended to limit the scope of the application. Other features of the present application will become apparent from the following description.
Drawings
The above and other features, advantages and aspects of various embodiments of the present application will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, like or similar reference characters designate like or similar elements, and wherein:
FIG. 1 illustrates an exemplary system architecture to which embodiments of the present application can be applied;
FIG. 2 shows a flow diagram of a video playback method according to an embodiment of the application;
FIG. 3 shows a block diagram of a video playback device according to an embodiment of the present application;
fig. 4 shows a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
FIG. 1 illustrates an exemplary system architecture to which embodiments of the present application can be applied.
As shown in FIG. 1, the system architecture may include a client 101, a network 102, an on-demand server 103, a storage server 104, and a forwarding server 105. Network 102 serves as a medium for providing communication links between clients 101, on-demand server 103, storage server 104, and forwarding server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use client 101 to interact with on-demand server 103, storage server 104, and forwarding server 105 over network 104 to receive or transmit video stream files, etc. Various video playing applications may be installed on the client 101.
The client 101 may be hardware or software. When the client 101 is hardware, it may be various electronic devices with a display screen, including but not limited to a smart phone, a tablet computer, an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III, mpeg Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, mpeg Audio Layer 4), a laptop computer, a desktop computer, and the like. When the client 101 is software, it can be installed in the electronic devices listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
When the client 101 is hardware, a video capture device may be installed thereon. The video acquisition equipment can be various equipment capable of realizing the function of acquiring video, such as a camera, a sensor and the like. A user may capture a video with a video capture device on the client 101.
It should be noted that the on-demand server 103, the storage server 104, and the forwarding server 105 may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (for example, a plurality of software or software modules for providing distributed services), or may be implemented as a single software or software module. And is not particularly limited herein.
It should be understood that the number of clients, networks, on-demand servers, storage servers, and forwarding servers in FIG. 1 are illustrative only. There may be any number of clients, networks, on-demand servers, storage servers, and forwarding servers, as desired for implementation. In particular, in the case where the video stream file does not need to be obtained remotely, the above system architecture may not include a network, but only include a client, an on-demand server, a storage server, and a forwarding server.
Fig. 2 shows a flow chart of a video playing method according to an embodiment of the present application. As shown in fig. 1, the video playing method includes the following steps:
step 210, decoding the video stream file to obtain the key frames of the video stream file and the timestamps and reference frames corresponding to the key frames.
In this embodiment, the video stream file is composed of a plurality of GOPs formed after encoding and compressing, that is, each GOP in the video stream file can be independently decoded, and decoding between different GOPs does not affect each other.
In some embodiments, when the video stream file is stored in the storage server, the video stream file may be compressed using MPEG technology, so that the video stream file can form a plurality of GOPs, each GOP includes a key frame and a plurality of reference frames, and a timestamp of each key frame is stored simultaneously when the compressed video stream file is stored.
The key frames are also called I-frames, each GOP starts with a key frame, the key frame is a complete picture, the frames in the middle of the GOP are incomplete, and need to be operated by the key frame and the following frames (reference frames), that is, when decoding the reference frames, the previous reference frames are needed to generate the final picture.
In this embodiment, when decoding a video stream file, the same technique as that used for encoding the video stream file can be used for decoding. For example, MPEG1, MPEG2, h.264, or the like can be used for encoding and decoding a video stream file.
Step 220, caching each key frame and the reference frame corresponding to the key frame as video stream fragments.
In this embodiment, each key frame and the reference frame corresponding to the key frame are a GOP, that is, each GOP is buffered as a video stream segment. The video stream segments may be cached in the client.
Step 230, based on the key frame and the timestamp of the corresponding key frame, an index relationship between the video stream segment and the time segment in which the video stream segment is located is established.
In some embodiments, the following steps may be taken to establish an index relationship between a video stream segment and its time segment: firstly, determining a time period of a video stream segment; then, an index relationship between the video stream segment and the time period in which the video stream segment is located is established.
It should be noted that the index relationship may not only be an index relationship between a video stream segment and a time segment where the video stream segment is located, for example, a key frame of each video stream segment may also be used to represent the video stream segment, so that an index relationship between the key frame and the time segment may also be established.
In this embodiment, the time period of the video stream segment may be determined by the following method:
first, the time stamp of the key frame of the video stream segment is used as the starting time of the time period in which the key frame is located. Then, the time stamp of the key frame of the next video stream segment is taken as the expiration time of the time period in which it is located. And finally, determining the time period of the video stream segment according to the starting time and the ending time.
And step 240, responding to the on-demand instruction, determining the video stream segment to be played based on the index relation, and caching the video stream segment to be played.
In this embodiment, the on-demand instruction includes a playing time, i.e. a specific time in the video stream file that needs to be played from a fraction of a second.
Then, after the playing time in the on-demand instruction has been known, a time period corresponding to the playing time may be determined in the index relationship, that is, in which time period the playing time falls, and after the time period corresponding to the playing time is determined, the video stream segment corresponding to the time period may be used as the video stream segment to be played and cached in the client, so as to facilitate subsequent playing.
The following description is given by way of a specific example.
For example, for a certain video stream file, the total duration is 30 minutes, and after coding and compression, a plurality of GOPs are formed, where the time period of GOP 1 is 0 min 0 s to 6 min 0 s, the time period of GOP 2 is 6 min 0 s to 15 min 0 s, the time period of GOP 3 is 15 min 0 s to 19 min 0 s, the time period of GOP 4 is 19 min 0 s to 26 min 0 s, and the time period of GOP 5 is 26 min 0 s to 30 min 0 s, then the following index relationships can be established:
GOP 1-0 min 0 sec to 6 min 0 sec;
GOP 2-6 min 0 sec to 15 min 0 sec;
GOP 3-15 min 0 sec to 19 min 0 sec;
GOP 4-19 min 0 s-26 min 0 s;
GOP 5-26 min 0 sec to 30 min 0 sec.
When a request command is received, for example, the playing time represented by the request command is 15 minutes 23 seconds, it can be determined in the index relationship that the video stream segment corresponding to the playing time is GOP 3.
And step 250, determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played.
In this embodiment, it is necessary to explain the time offset by combining the above example, where the playing time in the above example is 15 minutes 23 seconds, and the determined time period of the to-be-played video stream segment is 15 minutes 0 seconds to 19 minutes 0 seconds, since the video stream segment is formed by the start of the key frame and the reference frame located after the key frame, the time stamp of the key frame of the to-be-played video stream segment may be determined to be 15 minutes 0 seconds, and then the time offset of the start frame relative to the time stamp of the key frame may be calculated by combining the playing time of the to-be-played video stream segment, and the corresponding frame is searched in the buffer according to the time offset to serve as the playing position.
And step 260, forward playing or backward playing the video stream file corresponding to the video stream clip to be played from the playing position.
In some embodiments, to ensure the fluency of playing the video stream file, the video stream segments located after the video stream segments to be played may be cached in chronological order when the video stream file corresponding to the video stream segments to be played is being played; the video stream clip before the video stream clip to be played can be cached according to the time sequence when the video stream file corresponding to the video stream clip to be played is played reversely, so that the video stream file can be played smoothly without blockage.
In some application scenarios, for example, when a ball race or criminal investigation is encountered, multiple video stream files need to be simultaneously played and played backwards to observe whether there is a suspected violation of a human being, and at this time, in order to ensure that the multiple video stream files can be simultaneously played backwards or forwards with accuracy and without error, clock synchronization can be performed on the multiple video stream files.
For example, when multiple video stream files come from multiple cameras, the video stream files collected by the multiple cameras are played on the same time axis, and the playing time of the multiple cameras needs to be corrected to jointly follow an absolute time.
Specifically, time correction can be performed when a video stream file is stored, and it can be known from the above that the video stream file needs to be encoded when the video stream file is stored, and when the encoding is a time stamp that a key frame needs to be recorded, then when the time stamp of the key frame is recorded, the time stamps of the key frame can be recorded by using the same absolute time for all the key frames in the video stream files collected by different cameras, so that the effect of clock synchronization can be achieved.
In some embodiments, the video playing method further comprises the following steps before step 210:
receiving a request instruction input by a user;
sending a request order to a request server, responding to the request order by the request server, calling a video stream file corresponding to the request order from a storage server, and forwarding the video stream file to a forwarding server;
and receiving the video stream file sent by the forwarding server.
In this embodiment, the on-demand instruction further includes an identifier of the video stream file, for example, the identifier may be a camera number, and it may be determined by the camera number that the video stream file to be on-demand is shot by a camera corresponding to the camera number. When the video stream file is stored, the video stream file needs to be encoded in a manner of key frames and reference frames and stored in the storage server.
According to the embodiment of the application, a video stream file is decoded to obtain key frames of the video stream file and timestamps and reference frames corresponding to the key frames, each key frame and the reference frame corresponding to the key frame are taken as video stream fragments to be cached, an index relation between the video stream fragments and the time periods of the key frames is established based on the time stamps of the key frames and the corresponding key frames, the video stream fragments to be played are determined based on the index relation in response to a video-on-demand instruction, the video stream fragments to be played are cached, the playing position is determined in the video stream fragments to be played according to the time offset of the playing time relative to the time stamps of the key frames of the video stream fragments to be played, the video stream files corresponding to the video stream fragments to be played are played or played backwards from the playing position, and therefore the video stream files can be played smoothly without cards no matter whether the video stream files are played forwards or backwards, meanwhile, the forward playing and the reverse playing of the video stream file can be switched randomly.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that the acts and modules referred to are not necessarily required in this application.
The above is a description of method embodiments, and the embodiments of the present application are further described below by way of apparatus embodiments.
Fig. 3 shows a block diagram of a video playback device according to an embodiment of the present application. As shown in fig. 3, the video playback apparatus includes:
the video decoding module 310 is configured to decode the video stream file to obtain the key frames of the video stream file and the timestamps and reference frames corresponding to the key frames.
The first buffer module 320 is configured to buffer each key frame and the reference frame corresponding to the key frame as a video stream segment.
The relationship establishing module 330 is configured to establish an index relationship between a video stream segment and a time segment where the video stream segment is located based on the key frame and the timestamp of the corresponding key frame.
The second caching module 340 is configured to determine, in response to an on-demand instruction, a video stream segment to be played based on the index relationship, and cache the video stream segment to be played, where the on-demand instruction includes a playing time.
The position determining module 350 is configured to determine a playing position in the video stream segment to be played according to a time offset of the playing time relative to a time stamp of a key frame of the video stream segment to be played.
And the video playing module 360 is configured to forward or reverse play the video stream file corresponding to the video stream segment to be played from the playing position.
In some embodiments, the video playing module 360 is specifically configured to:
when a video stream file corresponding to a video stream clip to be played is played, caching the video stream clip behind the video stream clip to be played according to a time sequence;
when the video stream file corresponding to the video stream segment to be played is played reversely, the video stream segment before the video stream segment to be played is cached according to the time sequence.
In some embodiments, the video playing module 360 is specifically configured to:
and when the video stream files corresponding to the video stream clips to be played are played in a forward or reverse mode in multiple ways, carrying out clock synchronization on the multiple video stream files.
In some embodiments, the apparatus further comprises:
and the instruction receiving module is used for receiving the on-demand instruction input by the user.
And the command sending module is used for sending a video-on-demand command to the video-on-demand server, and the video-on-demand server responds to the video-on-demand command, calls the video stream file corresponding to the video-on-demand command from the storage server and forwards the video stream file to the forwarding server.
And the file receiving module is used for receiving the video stream file sent by the forwarding server.
The video stream file is encoded in a key frame and reference frame mode and stored in a storage server; the on-demand instruction also includes an identification of the video stream file.
In some embodiments, the relationship establishing module 330 is specifically configured to:
determining a time period of the video stream segment;
establishing an index relation between a video stream fragment and a time period;
wherein determining the time period in which the video stream segment is located comprises:
taking the time stamp of the key frame of the video stream segment as the starting time of the time period in which the key frame is positioned;
taking the time stamp of the key frame of the next video stream segment as the cut-off time of the time segment where the key frame is positioned;
and determining the time period of the video stream segment according to the starting time and the ending time.
In some embodiments, the second cache module 340 is specifically configured to:
in the index relation, determining a time period corresponding to the playing time;
and taking the video stream segment corresponding to the time period as the video stream segment to be played.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the described module may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
FIG. 4 shows a schematic diagram of an electronic device suitable for implementing embodiments of the present application
As shown in fig. 4, the electronic apparatus includes a Central Processing Unit (CPU)401 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for system operation are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to embodiments of the present application, the process described above with reference to the flowchart fig. 2 may be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a machine-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 section 409, and/or installed from the removable medium 411. The above-described functions defined in the system of the present application are executed when the computer program is executed by a Central Processing Unit (CPU) 401.
It should be noted that the computer readable medium shown in the present application 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 application, 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 this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 application. 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 which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, and may be described as: a processor includes a video decoding unit, a first cache unit, a relationship establishing unit, a second cache unit, a position determining unit, and a video playing unit. Where the names of these units or modules do not in some cases constitute a limitation of the unit or module itself, for example, a video decoding unit may also be described as a "unit for decoding a video stream file".
As another aspect, the present application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or may be separate and not incorporated into the electronic device. The computer-readable storage medium stores one or more programs that, when executed by one or more processors, perform the video playback methods described herein.
The above description is only a preferred embodiment of the application 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 application referred to in the present application is not limited to the embodiments with a particular combination of the above-mentioned features, but also encompasses other embodiments with any combination of the above-mentioned features or their equivalents without departing from the spirit of the application. For example, the above features may be replaced with (but not limited to) features having similar functions as those described in this application.
Claims (10)
1. A video playback method, comprising:
decoding the video stream file to obtain key frames of the video stream file and timestamps and reference frames corresponding to the key frames;
caching each key frame and a reference frame corresponding to the key frame as a video stream fragment;
establishing an index relation between the video stream fragments and the time periods of the video stream fragments based on the key frames and the timestamps of the corresponding key frames;
responding to a request order, determining a video stream segment to be played based on the index relation, and caching the video stream segment to be played, wherein the request order comprises playing time;
determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played;
and forward or backward playing the video stream file corresponding to the video stream clip to be played from the playing position.
2. The method according to claim 1, wherein the forward or backward playing the video stream file corresponding to the video stream segment to be played comprises:
when the video stream file corresponding to the video stream clip to be played is played, caching the video stream clip behind the video stream clip to be played according to a time sequence;
and when the video stream file corresponding to the video stream segment to be played is reversely played, caching the video stream segment positioned in front of the video stream segment to be played according to the time sequence.
3. The method according to claim 1, wherein the forward or backward playing the video stream file corresponding to the video stream segment to be played comprises:
and when the video stream files corresponding to the video stream clips to be played are played in a forward or reverse mode in multiple ways, carrying out clock synchronization on the multiple video stream files.
4. The method according to claim 1, wherein before establishing the index relationship between the key frames and the time periods in which the key frames are located based on the plurality of key frames of the video stream file and the timestamps of the key frames, the method further comprises:
receiving the on-demand instruction input by a user;
sending the on-demand instruction to an on-demand server, wherein the on-demand server responds to the on-demand instruction, calls a video stream file corresponding to the on-demand instruction from a storage server, and forwards the video stream file to a forwarding server;
receiving the video stream file transmitted by the forwarding server;
the video stream file is encoded in a key frame and reference frame mode and stored in a storage server; the on-demand instruction also includes an identification of the video stream file.
5. The method according to claim 1, wherein said establishing an index relationship between the video stream segment and the time segment in which the video stream segment is located comprises:
determining a time period in which the video stream segment is located;
establishing an index relationship between the video stream fragments and the time periods;
wherein determining the time period in which the video stream segment is located comprises:
taking the time stamp of the key frame of the video stream segment as the starting time of the time segment in which the key frame is positioned;
taking the time stamp of the key frame of the next video stream segment as the cut-off time of the time segment;
and determining the time period of the video stream segment according to the starting time and the ending time.
6. The method of claim 5, wherein the determining the video stream segment to be played based on the index relationship comprises:
determining a time period corresponding to the playing time in the index relation;
and taking the video stream segment corresponding to the time period as the video stream segment to be played.
7. A video playback apparatus, comprising:
the video decoding module is used for decoding the video stream file to obtain a key frame of the video stream file and a timestamp and a reference frame corresponding to the key frame;
the first cache module is used for caching each key frame and the reference frame corresponding to the key frame as video stream fragments;
the relation establishing module is used for establishing an index relation between the video stream fragments and the time periods of the video stream fragments based on the key frames and the timestamps of the corresponding key frames;
the second cache module is used for responding to a video-on-demand instruction, determining a video stream segment to be played based on the index relation, and caching the video stream segment to be played, wherein the video-on-demand instruction comprises playing time;
the position determining module is used for determining a playing position in the video stream clip to be played according to the time offset of the playing time relative to the time stamp of the key frame of the video stream clip to be played;
and the video playing module is used for forward playing or backward playing the video stream file corresponding to the video stream clip to be played from the playing position.
8. The apparatus of claim 7, further comprising:
the instruction receiving module is used for receiving the on-demand instruction input by the user;
the order sending module is used for sending the on-demand order to an on-demand server, and the on-demand server responds to the on-demand order, calls a video stream file corresponding to the on-demand order from a storage server and forwards the video stream file to a forwarding server;
a file receiving module, configured to receive the video stream file sent by the forwarding server;
the video stream file is encoded in a key frame and reference frame mode and stored in a storage server; the on-demand instruction also includes an identification of the video stream file.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, wherein the processor, when executing the program, implements the method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011485383.8A CN112423140A (en) | 2020-12-16 | 2020-12-16 | Video playing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011485383.8A CN112423140A (en) | 2020-12-16 | 2020-12-16 | Video playing method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112423140A true CN112423140A (en) | 2021-02-26 |
Family
ID=74775712
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011485383.8A Pending CN112423140A (en) | 2020-12-16 | 2020-12-16 | Video playing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112423140A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113163226A (en) * | 2021-03-26 | 2021-07-23 | 维沃移动通信有限公司 | Media file playing method and device, electronic equipment, server and medium |
CN113542890A (en) * | 2021-08-03 | 2021-10-22 | 厦门美图之家科技有限公司 | Video editing method and related device |
CN113886333A (en) * | 2021-09-30 | 2022-01-04 | 广州文远知行科技有限公司 | Plog file reading method and system |
CN115089961A (en) * | 2022-06-24 | 2022-09-23 | 北京字跳网络技术有限公司 | A video processing method, device, electronic device and storage medium |
CN115174680A (en) * | 2022-07-05 | 2022-10-11 | 广州文远知行科技有限公司 | Visual data playing method, device, system, equipment and readable storage medium |
CN116399326A (en) * | 2023-04-06 | 2023-07-07 | 安徽工程大学 | A robot map construction method, storage medium and device based on adaptive key frame selection |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140359679A1 (en) * | 2013-05-30 | 2014-12-04 | Sonic Ip, Inc. | Content streaming with client device trick play index |
CN105227884A (en) * | 2014-07-03 | 2016-01-06 | 深圳中兴力维技术有限公司 | Realize method that video file puts upside down and device thereof |
CN107231581A (en) * | 2016-03-25 | 2017-10-03 | 中国电信股份有限公司 | Method, system and streaming media playing for video playback control server |
CN107635109A (en) * | 2016-07-19 | 2018-01-26 | 杭州海康威视数字技术股份有限公司 | One kind video recording player method and device |
CN107979621A (en) * | 2016-10-24 | 2018-05-01 | 杭州海康威视数字技术股份有限公司 | A kind of storage of video file, positioning playing method and device |
CN108174281A (en) * | 2018-01-19 | 2018-06-15 | 浙江大华技术股份有限公司 | A kind of video play-reverse method, apparatus, system, medium and equipment |
CN108737908A (en) * | 2018-05-21 | 2018-11-02 | 腾讯科技(深圳)有限公司 | A kind of media playing method, device and storage medium |
CN109348251A (en) * | 2018-10-08 | 2019-02-15 | 腾讯科技(深圳)有限公司 | For the method, apparatus of video playing, computer-readable medium and electronic equipment |
CN111447486A (en) * | 2020-04-07 | 2020-07-24 | 上海熙菱信息技术有限公司 | Reverse playing method for forward pushing of historical code stream |
-
2020
- 2020-12-16 CN CN202011485383.8A patent/CN112423140A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140359679A1 (en) * | 2013-05-30 | 2014-12-04 | Sonic Ip, Inc. | Content streaming with client device trick play index |
CN105227884A (en) * | 2014-07-03 | 2016-01-06 | 深圳中兴力维技术有限公司 | Realize method that video file puts upside down and device thereof |
CN107231581A (en) * | 2016-03-25 | 2017-10-03 | 中国电信股份有限公司 | Method, system and streaming media playing for video playback control server |
CN107635109A (en) * | 2016-07-19 | 2018-01-26 | 杭州海康威视数字技术股份有限公司 | One kind video recording player method and device |
CN107979621A (en) * | 2016-10-24 | 2018-05-01 | 杭州海康威视数字技术股份有限公司 | A kind of storage of video file, positioning playing method and device |
CN108174281A (en) * | 2018-01-19 | 2018-06-15 | 浙江大华技术股份有限公司 | A kind of video play-reverse method, apparatus, system, medium and equipment |
CN108737908A (en) * | 2018-05-21 | 2018-11-02 | 腾讯科技(深圳)有限公司 | A kind of media playing method, device and storage medium |
CN109348251A (en) * | 2018-10-08 | 2019-02-15 | 腾讯科技(深圳)有限公司 | For the method, apparatus of video playing, computer-readable medium and electronic equipment |
CN111447486A (en) * | 2020-04-07 | 2020-07-24 | 上海熙菱信息技术有限公司 | Reverse playing method for forward pushing of historical code stream |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113163226A (en) * | 2021-03-26 | 2021-07-23 | 维沃移动通信有限公司 | Media file playing method and device, electronic equipment, server and medium |
CN113542890A (en) * | 2021-08-03 | 2021-10-22 | 厦门美图之家科技有限公司 | Video editing method and related device |
CN113886333A (en) * | 2021-09-30 | 2022-01-04 | 广州文远知行科技有限公司 | Plog file reading method and system |
CN115089961A (en) * | 2022-06-24 | 2022-09-23 | 北京字跳网络技术有限公司 | A video processing method, device, electronic device and storage medium |
CN115174680A (en) * | 2022-07-05 | 2022-10-11 | 广州文远知行科技有限公司 | Visual data playing method, device, system, equipment and readable storage medium |
CN115174680B (en) * | 2022-07-05 | 2023-07-25 | 广州文远知行科技有限公司 | Visual data playing method, device, system, equipment and readable storage medium |
CN116399326A (en) * | 2023-04-06 | 2023-07-07 | 安徽工程大学 | A robot map construction method, storage medium and device based on adaptive key frame selection |
CN116399326B (en) * | 2023-04-06 | 2023-10-13 | 安徽工程大学 | A robot map construction method, storage medium and equipment based on adaptive key frame selection |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112423140A (en) | Video playing method and device, electronic equipment and storage medium | |
US9961398B2 (en) | Method and device for switching video streams | |
CN106998485B (en) | Video live broadcasting method and device | |
CN110784740A (en) | Video processing method, device, server and readable storage medium | |
CN110381326B (en) | Video system, processing method, device and computer readable medium | |
CN111385576B (en) | Video coding method and device, mobile terminal and storage medium | |
CN111836076B (en) | Video resolution switching method and device and electronic equipment | |
CN113302928A (en) | System and method for transmitting multiple video streams | |
CN113411642A (en) | Screen projection method and device, electronic equipment and storage medium | |
US20170180746A1 (en) | Video transcoding method and electronic apparatus | |
CN111225171B (en) | Video recording method, device, terminal equipment and computer storage medium | |
CN111263243B (en) | Video coding method and device, computer readable medium and electronic equipment | |
CN111726657A (en) | Playback processing method, device and server of live video | |
CN110519640B (en) | Video processing method, encoder, CDN server, decoder, device, and medium | |
WO2019114330A1 (en) | Video playback method and apparatus, and terminal device | |
CN113891132B (en) | Audio and video synchronous monitoring method and device, electronic equipment and storage medium | |
CN111726641A (en) | Playback processing method, device and server of live video | |
CN111436009B (en) | Real-time video stream transmission and display method and transmission and play system | |
WO2024222935A1 (en) | Encoding method and apparatus applicable to spatial picture, and decoding method and apparatus applicable to spatial picture | |
CN112532998A (en) | Method, device and equipment for extracting video frame and readable storage medium | |
US20050141861A1 (en) | Method and system for reverse playback of compressed data | |
CN113542856B (en) | Method, device, equipment and computer readable medium for reverse playing of online video | |
CN112291483B (en) | Video pushing method and system, electronic equipment and readable storage medium | |
CN114257870A (en) | Short video playing method, device, equipment and storage medium | |
CN110809166B (en) | Video data processing method and device and electronic equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210226 |
|
RJ01 | Rejection of invention patent application after publication |