A progress bar time updating method and device and a storage medium
By obtaining the absolute time of I-frames and the time interval of P-frames from the video recording device, the absolute time of P-frames is determined, thus solving the problem of slow progress bar time update frequency and achieving accurate correspondence between video frames and progress bar time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2022-06-29
- Publication Date
- 2026-07-14
AI Technical Summary
In existing video recording devices, the progress bar updates slowly, causing the current playback video frame to not correspond to the time on the progress bar.
The absolute time of the P-frame is determined by obtaining the absolute time of the I-frame and the time interval between the I-frame and the P-frame in the target video sequence, and the current playback time of the playback progress bar is updated based on the absolute times of the I-frame and the P-frame.
The update frequency of the progress bar has been increased, making the current video frame more accurately correspond to the time on the progress bar.
Smart Images

Figure CN117376648B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video surveillance technology, and in particular to a method, apparatus and storage medium for updating progress bar time. Background Technology
[0002] In the field of video surveillance, existing video recording devices (such as digital hard disk recorders and network hard disk recorders) not only support functions such as access preview and recording storage for connected cameras, but also have the function of playing back locally stored recordings. The recording playback interface includes a progress bar that displays the length information of the current recording file and the time information of the current video frame displayed on the playback interface during the playback process.
[0003] During playback, the actual recording time of the I-frame is usually used to update the time on the progress bar. However, for most video recording devices, the default frame rate is 25 frames per second. In video stream data, there are 50 P-frames between every two I-frames. This means that an I-frame will only appear every 2 seconds during the playback of video stream data. Therefore, the time on the progress bar will only be updated once every 2 seconds, which is a slow update frequency. This causes the time on the progress bar to not correspond to the video frame being played back. Summary of the Invention
[0004] This application provides a method, apparatus, and storage medium for updating the time on a progress bar, which can improve the frequency of time updates on the progress bar.
[0005] In a first aspect, the application provides a progress bar time update method, comprising: acquiring a target video sequence; the target video sequence comprising: an I-frame and at least one P-frame associated with the I-frame; determining the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the I-frame being the actual shooting time of the video frame corresponding to the I-frame; the target P-frame being any one of the at least one P-frame; determining the absolute time of the target P-frame based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the target P-frame being the actual shooting time of the video frame corresponding to the target P-frame; updating the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame; the playback progress bar being used to display the time information of the currently playing video frame.
[0006] Understandably, the technical solution provided in this application first determines the absolute time of the I-frame in the target video sequence and the time interval between the I-frame and the target P-frame. Then, based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame, the absolute time of the target P-frame is determined. Finally, the current playback time of the playback progress bar is updated based on the absolute time of the I-frame and the absolute time of the target P-frame. Thus, compared to the prior art method of updating the current playback time of the playback progress bar only based on the absolute time of the I-frame, the embodiment of this application updates the current playback time of the playback progress bar based on both the absolute time of the I-frame and the absolute time of the P-frame, effectively improving the update frequency of the playback progress bar and ensuring that the currently played video frame corresponds to the current playback time on the progress bar.
[0007] In one possible implementation, determining the time interval between an I-frame and a target P-frame includes: obtaining the timestamp of the I-frame and the timestamp of the target P-frame; the timestamp of the I-frame is used to represent the time offset of the I-frame relative to a reference time; the timestamp of the target P-frame is used to represent the time offset of the target P-frame relative to the reference time; and determining the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame.
[0008] In another possible implementation, determining the time interval between the I-frame and the target P-frame based on the relative timestamp of the I-frame and the relative timestamp of the target P-frame includes: when the timestamp of the P-frame is greater than the timestamp of the I-frame, determining the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame.
[0009] In another possible implementation, determining the time interval between the I-frame and the target P-frame includes: obtaining the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence; the frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence; and determining the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence.
[0010] In another possible implementation, determining the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence includes: determining the frame number difference between the frame number of the I-frame and the frame number of the target P-frame; and determining the time interval between the I-frame and the target P-frame based on the product of the frame number difference and the frame time interval of the target video sequence.
[0011] In another possible implementation, where the minimum time unit on the playback progress bar is milliseconds, the above-mentioned updating of the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame includes: updating the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
[0012] Secondly, the application provides a progress bar time update device, comprising: an acquisition module for acquiring a target video sequence; the target video sequence including: an I-frame and at least one P-frame associated with the I-frame; a determination module for determining the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the I-frame being the actual shooting time of the video frame corresponding to the I-frame; the target P-frame being any one of the at least one P-frame; the determination module further for determining the absolute time of the target P-frame based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the target P-frame being the actual shooting time of the video frame corresponding to the target P-frame; and an update module for updating the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame; the playback progress bar is used to display the time information of the currently playing video frame.
[0013] In one possible implementation, the acquisition module is further configured to acquire the timestamp of the I-frame and the timestamp of the target P-frame; the timestamp of the I-frame is used to represent the time offset of the I-frame relative to the reference time; the timestamp of the target P-frame is used to represent the time offset of the target P-frame relative to the reference time; the determination module is specifically configured to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame.
[0014] In another possible implementation, the determining module is specifically used to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame when the timestamp of the P-frame is greater than the timestamp of the I-frame.
[0015] In another possible implementation, the acquisition module is also used to acquire the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence; the frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence; the determination module is specifically used to determine the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence.
[0016] In another possible implementation, a determination module is specifically used to determine the frame number difference between the frame number of the I-frame and the frame number of the target P-frame; the time interval between the I-frame and the target P-frame is determined based on the product of the frame number difference and the frame time interval of the target video sequence; and when the minimum time unit on the playback progress bar is milliseconds, an update module is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
[0017] In another possible implementation, where the minimum time unit on the playback progress bar is milliseconds, the update module is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
[0018] Thirdly, this application provides a progress bar time update device, comprising: one or more processors; one or more memory; wherein the one or more memory is used to store computer program code, the computer program code including computer instructions, and when the one or more processors execute the computer instructions, the progress bar time update device executes any of the progress bar time update methods provided in the first aspect above.
[0019] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions that, when executed on a computer, cause the computer to perform any of the progress bar time update methods provided in the first aspect above.
[0020] For a detailed description of aspects two through four and their various implementations in this application, please refer to the detailed description in aspect one and its various implementations. The beneficial effects of aspects two through four and their various implementations can be found in the analysis of the beneficial effects of aspect one and its various implementations; they will not be repeated here.
[0021] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0022] Figure 1 A schematic diagram of the implementation environment involved in a progress bar time update method provided in this application embodiment. Figure 1 ;
[0023] Figure 2 A schematic diagram of the implementation environment involved in a progress bar time update method provided in this application embodiment. Figure 2 ;
[0024] Figure 3 An illustration of a video sequence provided in an embodiment of this application. Figure 1 ;
[0025] Figure 4 A schematic diagram of a PS package provided in an embodiment of this application;
[0026] Figure 5 A schematic diagram of a playback interface provided in an embodiment of this application;
[0027] Figure 6 A schematic diagram of the implementation environment involved in a progress bar time update method provided in this application embodiment. Figure 3 ;
[0028] Figure 7 A flowchart illustrating a progress bar time update method provided in this application embodiment;
[0029] Figure 8 An illustration of a video sequence provided in an embodiment of this application. Figure 2 ;
[0030] Figure 9 An illustration of a video sequence provided in an embodiment of this application. Figure 3 ;
[0031] Figure 10 An illustration of a video sequence provided in an embodiment of this application. Figure 4 ;
[0032] Figure 11 A schematic diagram of a playback progress bar provided in an embodiment of this application;
[0033] Figure 12 A schematic diagram of a progress bar time update device provided in this application embodiment. Figure 1 ;
[0034] Figure 13 A schematic diagram of a progress bar time update device provided in this application embodiment. Figure 2 . Detailed Implementation
[0035] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0036] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0037] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0038] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0039] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0040] To facilitate understanding of the technical solution of this application, the terminology involved in this application will be briefly introduced below.
[0041] 1. Digital Video Recorder (DVR): A DVR is a type of video recording device used in conjunction with an analog camera. The primary operating mode of a DVR is to receive analog audio and video signals and record them via a hard disk. The core of a DVR lies in its hard disk recording capability; therefore, it is also known as a hard disk recorder.
[0042] A DVR can integrate cameras, mice, remote controls, remote terminal devices, etc. to form a complete monitoring system, enabling functions such as long-term recording of audio and video signal data, remote monitoring, remote control, playback, and backup.
[0043] 2. Network video recorder (NVR): An NVR is a type of video recording device that is used in conjunction with a network camera or video encoder to record digital video transmitted over a network.
[0044] The primary function of an NVR is to receive, store, and manage digital video streams transmitted from IPC (Internet Protocol Camera) devices over a network, thereby leveraging the advantages of a distributed architecture brought about by networking. An NVR allows for the simultaneous viewing, browsing, playback, management, and storage of multiple network camera feeds.
[0045] 3. Network Camera (IP CAMERA, IPC): A network camera is a new generation of camera that combines traditional camera technology with network technology. It can transmit video images over a network to another part of the world, and remote viewers do not need any special software; a standard web browser (such as Microsoft IE or Netscape) is sufficient to monitor the video images. An IPC generally consists of a lens, image sensor, sound sensor, signal processor, A / D converter, encoding chip, main control chip, network and control interface, etc.
[0046] 4. Program stream (PS) encapsulation: MPEG2-PS is a multiplexed digital audio and video encapsulation container. A PS stream is obtained by encapsulating the basic bitstream output from the encoder using PS; the PS stream consists of PS packets.
[0047] 5. Packetized elementary stream (PES): The packets formed from the elementary stream are called PES packets, which are a data structure used to transmit the elementary stream.
[0048] 6. Program Stream Map (PSM): PSM provides a description of the raw streams in a program stream and the relationships between them. PSM is a type of PES (Programmable Streaming System) grouping.
[0049] 7. Group of Pictures (GOP): A GOP is a group of consecutive frames consisting of one I-frame and several P-frames. It is the basic unit of storage for video image encoders and decoders.
[0050] In this context, I-frames are internally coded frames (also known as keyframes), and P-frames are forward-predicted frames (forward reference frames). Simply put, an I-frame is a complete picture, while a P-frame records changes relative to the I-frame. Without I-frames, P-frames cannot be decoded.
[0051] In the H.264 compression standard, I-frames and P-frames are used to represent transmitted video frames. The encoder encodes multiple images to produce GOPs (Group of Pictures), and the decoder reads each GOP, decodes it, and then renders and displays the resulting video.
[0052] When there is little motion, a small number of GOP sequences may be generated. A single GOP sequence can be quite long because little motion means minimal change in the image content. Therefore, one I-frame and multiple P-frames can be used. When there is a lot of motion, multiple GOP sequences may be generated. Each GOP sequence is shorter, for example, it may contain one I-frame and a few P-frames.
[0053] When an image changes significantly from previous images and cannot be generated by referring to previous frames, we end the previous GOP image group and begin the next GOP image group.
[0054] 8. Video frame: A video is an image that appears to be connected by a series of independent frames, each of which is called a video frame. To ensure continuity and smoothness, the number of frames per second in a video is fixed, called the frame rate, such as 25 frames / second, 30 frames / second, 50 frames / second, etc.
[0055] 9. A timestamp is a relative time value belonging to each video frame within the bitstream encapsulation (the relative time value represents the time offset relative to a reference time). The true significance of a timestamp lies in the amount of change in the timestamp of each video frame (i.e., the frame interval). Therefore, the reference time for the timestamp (i.e., from which it begins to accumulate) is not limited. Under normal circumstances, the timestamp changes in a uniformly increasing trend. The difference between the timestamps of two adjacent video frames represents the playback duration of the previous video frame.
[0056] In addition, the timestamp has a maximum value, and when the timestamp reaches the maximum value, it will be accumulated uniformly from the base time (e.g., 0).
[0057] 10. Absolute time, also known as system time, is time measured in years, months, days, hours, minutes, and seconds. In this embodiment, the absolute time of a video frame is used to represent the actual shooting time of the video footage corresponding to that video frame.
[0058] The above is an introduction to some of the concepts involved in the embodiments of this application, which will not be repeated below.
[0059] As described in the background section, in the field of video surveillance, to facilitate the transmission and storage of video data, the video data is typically encoded at the transmitting end (e.g., camera equipment) and then sent to the receiving end (e.g., video recording equipment). Upon receiving the encoded video data, the receiving end performs PS (Static Image Capsule) encapsulation on the encoded video stream to obtain a PS stream, which is then stored on the hard drive. During the PS encapsulation process, the time information of I-frames and P-frames is also encapsulated in the corresponding PS packets. The time information of the I-frame includes: the absolute time and timestamp of the I-frame; the time information of the P-frame includes: the timestamp of the P-frame.
[0060] During playback, the PS stream corresponding to the recorded video to be played back needs to be retrieved from the hard drive, decoded to obtain the decoded video stream, and then played back. In existing technology, the absolute time corresponding to the currently played video frame is usually used to update the current playback time on the playback progress bar. However, since only I-frames have absolute time, while P-frames do not, the absolute time of the I-frame is usually used to update the time on the playback progress bar.
[0061] The technical problem with the existing technology is that, for most cameras, an I-frame only appears every 2 seconds, so the time on the playback progress bar is only updated every 2 seconds. The update frequency is too slow, which causes the current playback video frame to not correspond to the time on the progress bar.
[0062] To address the aforementioned technical problems, this application provides a progress bar time update method. The method involves: during playback, firstly, determining the absolute time of I-frames in the target video sequence and the time interval between I-frames and target P-frames; then, determining the absolute time of the target P-frame based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; finally, updating the current playback time of the playback progress bar based on both the absolute time of the I-frame and the absolute time of the target P-frame. Thus, compared to existing methods that update the current playback time of the playback progress bar only based on the absolute time of I-frames, this application's embodiment updates the current playback time of the playback progress bar based on both the absolute time of I-frames and the absolute time of P-frames, effectively increasing the update frequency of the playback progress bar and ensuring that the currently played video frame corresponds to the current playback time on the progress bar.
[0063] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0064] Please refer to Figure 1 This diagram illustrates the implementation environment of a progress bar time update method provided in this application. Figure 1 As shown, the implementation environment may include: camera equipment 10, video recording equipment 20, and terminal equipment 30.
[0065] Camera device 10 is used to shoot video.
[0066] For example, the camera device 10 can be an analog camera or an IPC.
[0067] In some embodiments, such as Figure 2 As shown, the camera device 10 includes a video encoder 11, which receives raw video data captured by the camera device 10 and encodes the raw video data using a specific compression standard (e.g., H.264 compression standard) to obtain an encoded video stream.
[0068] The encoded video stream can be one or more video sequences, grouped into one film (GOP). Each GOP consists of one I-frame and at least one P-frame. For example... Figure 3 As shown, an I-frame is the first video frame of a video sequence GOP, containing a complete video frame, and can be encoded independently; at least one P-frame is located after the I-frame and is a forward-predicted coded frame. A P-frame only contains changes relative to the preceding video frame and needs to rely on the preceding video frame to complete its encoding.
[0069] In some embodiments, the camera device 10 is also used to send the encoded video stream to the video recording device 20.
[0070] The video recording device 20 is used to receive and store an encoded video stream. In some embodiments, the video recording device 20 is also used to decode the encoded video stream to obtain one or more video sequence GOPs, and to play back one or more video sequence GOPs.
[0071] For example, the video recording device 20 can be a digital video recorder (DVR) or a network video recorder (NVR).
[0072] In some embodiments, after receiving the encoded video stream, the video recording device 20 performs PS encapsulation on the encoded video stream to obtain a PS stream, and stores the PS stream in the hard disk.
[0073] During the PS encapsulation process, the video recording device 20 determines the time information corresponding to each video frame (including I-frames and P-frames) in the encoded video stream and encapsulates the time information corresponding to each video frame in a PS packet. For example, the time information corresponding to an I-frame includes the absolute time and timestamp of the I-frame; the time information corresponding to a P-frame includes the timestamp of the P-frame.
[0074] A PS stream consists of multiple PS GOPs; a PS GOP is composed of one or more PS packets, each PS packet corresponding to information from one or more video frames within the GOP. For example, the structure of a PS packet is as follows: Figure 4 As shown, the structure of the first PS packet in the PS GOP (i.e., the PS packet corresponding to the I frame) can be as follows: Figure 4 As shown in (a), the structure of other PS packets (i.e., the PS packets corresponding to P frames) in a PS GOP can be as follows: Figure 4 As shown in (b) of the diagram.
[0075] In this context, PSH is the header of the PS packet, primarily containing system time information. PES is the basic stream of the encoded video stream, which is obtained by grouping the encoded video stream into one or more PES. PSM is a special type of PES, used to store the global time (or absolute time) corresponding to that video frame. PSM only appears in I-frames, meaning only I-frames have absolute time; P-frames do not.
[0076] In some embodiments, after receiving a playback command, the video recording device 20 further retrieves the PS stream corresponding to the playback command from the hard disk and decodes the PS stream to obtain a decoded video stream. For example, the playback command may be issued by the terminal device 30.
[0077] In some embodiments, such as Figure 2 As shown, the video recording device 20 includes a video decoder 21, which is used to decode the PS stream using a specific compression standard (e.g., H.264 compression standard) to obtain a decoded video stream.
[0078] In some embodiments, the decoded video stream includes one or more video sequence groups (GOPs), each consisting of an I-frame and at least one P-frame.
[0079] In some embodiments, during the video decoder decoding process, the timing information of I-frames and P-frames in the video sequence GOP, as well as the frame numbers of I-frames and P-frames, can be parsed out.
[0080] In some embodiments, the video recording device 20 is also used to send the decoded video stream to the terminal device 30.
[0081] Terminal device 30 is used to play decoded video streams.
[0082] In some embodiments, such as Figure 5 As shown, the terminal device 30 includes a display screen, and the playback interface of the display screen includes a first area and a second area; wherein the first area is used to display the video images (video frames) of the decoded video stream, and the second area includes a playback progress bar, which is used to reflect the time information corresponding to the video images (video frames) displayed in the first area.
[0083] In some embodiments, the terminal device 30 is further configured to acquire the time information of each video frame in the video sequence GOP, and update the current playback time of the playback progress bar based on the time information of each video frame.
[0084] For example, the terminal device 30 can be an electronic device with playback functionality, such as a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, etc. This disclosure does not impose any special limitations on the specific form of the terminal device 30.
[0085] Optionally, Figure 1 The video recording device 20 and the terminal device 30 can be two separate devices, or the video recording device 20 and the terminal device 30 can be the same device, that is, the video recording device 20 or its corresponding functions and the terminal device 30 or its corresponding functions can be integrated into the same device.
[0086] The camera device 10 and the video recording device 20 can communicate with each other, and the video recording device 20 and the terminal device 30 can communicate with each other. For example, the video recording device 20 can receive an encoded video stream from the camera device 10, and the terminal device 30 can receive a decoded video stream from the video recording device 20. In one example, one or more communication media may be included between the camera device 10 and the video recording device 20, and between the video recording device 20 and the terminal device 30. These communication media may include devices such as routers, switches, or base stations.
[0087] Specifically, such as Figure 6 As shown, the video recording device 20 receives the encoded video stream sent by the camera device 10, performs PS encapsulation on the encoded video stream to obtain a PS stream, and stores the PS stream in the hard disk. When a user needs to view a video recording for a certain period of time, they can send a playback command to the video recording device 20 through the terminal device 30. When the video recording device 20 receives the playback command, it retrieves the PS stream corresponding to the video recording to be played back from the hard disk, decodes the PS stream to obtain a decoded video stream, and sends the decoded video stream to the terminal device 30. The terminal device 30 displays the decoded video stream and updates the current playback time on the playback progress bar according to the time corresponding to the decoded video stream.
[0088] The following is a detailed description of a progress bar time update method provided in an embodiment of this application.
[0089] The progress bar time update method provided in this application embodiment can be derived from... Figure 1The video recording device shown is used to perform the recording. Figure 7 As shown, the method includes the following steps:
[0090] S101. Obtain the target video sequence.
[0091] The target video sequence includes an I-frame and at least one P-frame associated with the I-frame. The I-frame is the first frame in the target video sequence, and at least one P-frame follows the I-frame. Both the I-frame and the P-frame are used to represent video frames.
[0092] In some embodiments, the target video sequence is any one of the video sequences in the recorded video to be played back. For example, if the recorded video to be played back includes three video sequences, namely video sequence A, video sequence B, and video sequence C, the video recording device obtains video sequence A, video sequence B, and video sequence C by decoding the PS stream corresponding to the recorded video.
[0093] Understandably, for ease of storage, after receiving the encoded video stream output from the video encoder, the video recording device performs PS encapsulation on the encoded video stream to generate a PS stream, which is then stored on the hard drive. Subsequently, during playback, it is necessary to retrieve the PS stream of the recorded video to be played back from the hard drive and decode it into one or more video sequences (GOPs).
[0094] S102. Determine the absolute time of the I-frame and the time interval between the I-frame and the target P-frame.
[0095] The absolute time of an I-frame is the actual time when the video footage corresponding to that I-frame was captured. For example, if the video footage corresponding to an I-frame was captured at 12:00:00 on May 17, 2022, then the absolute time of the I-frame is 12:00:00 on May 17, 2022.
[0096] In some embodiments, the target P-frame is any one of at least one P-frame.
[0097] In some embodiments, the time interval between an I-frame and a target P-frame refers to the time difference between the I-frame and the target P-frame. This application provides two methods for determining the time interval between an I-frame and a target P-frame.
[0098] Method 1: Determine the time interval between the I-frame and the target P-frame based on the timestamp.
[0099] Step 1: Obtain the timestamp of the I-frame and the timestamp of the target P-frame.
[0100] In this context, the timestamp of the I-frame represents the time offset of the I-frame relative to the reference time; the timestamp of the target P-frame represents the time offset of the target P-frame relative to the reference time. Typically, the reference time is fixed (this embodiment does not specifically limit the value of the reference time). Therefore, the time offset relative to the reference time uniquely characterizes the time of the video frame; that is, the timestamp of each video frame uniquely characterizes the time of that video frame. For example, the timestamp of the I-frame is 40ms, the timestamp of the first P-frame is 80ms, the timestamp of the second P-frame is 120ms, and so on, accumulating uniformly until the timestamp reaches its maximum value.
[0101] In some embodiments, the video recording device obtains the timestamp of the I-frame by parsing the PS packet corresponding to the I-frame; the video recording device obtains the timestamp of the P-frame by parsing the PS packet corresponding to the P-frame.
[0102] Step 2: Determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame.
[0103] In some embodiments, the time interval between the I-frame and the target P-frame is determined based on the difference between the timestamp of the target P-frame and the timestamp of the I-frame. For example, if the timestamp of the target P-frame is T1 and the timestamp of the I-frame is T0, then the time interval between the I-frame and the target P-frame satisfies: T1 - T0.
[0104] For example, such as Figure 8 As shown, if the timestamp of the I-frame is 40ms and the timestamp of the target P-frame is 120ms, then the time interval between the I-frame and the target P-frame is: 120ms - 40ms = 80ms.
[0105] In some embodiments, step 2 above can be implemented as follows: when the timestamp of the target P frame is greater than the timestamp of the I frame, the time interval between the I frame and the target P frame is determined based on the timestamp of the I frame and the timestamp of the target P frame.
[0106] Understandably, in a video sequence, I-frames come first, followed by P-frames, and timestamps increment sequentially from front to back. Therefore, the timestamp of a P-frame should be greater than the timestamp of an I-frame. However, timestamps have a maximum value, and when the timestamp reaches its maximum, it starts accumulating from 0 again. In this case, a P-frame's timestamp might be less than the I-frame's timestamp (i.e., timestamp overflow occurs). In this situation, the time interval between the I-frame and the target P-frame cannot be determined based on their timestamps. For example, as shown... Figure 9As shown, if the maximum timestamp value is 200ms, the timestamp of the I-frame is 160ms, and the timestamp of the target P-frame is 40ms, then the timestamp of the target P-frame is less than the timestamp of the I-frame. If the time interval between the I-frame and the target P-frame is calculated based on the difference between the timestamps of the target P-frame and the I-frame, it would be: 40ms - 160ms = -120ms. Obviously, this result is incorrect. Therefore, in the case of timestamp overflow, the time interval between the I-frame and the target P-frame cannot be determined based on the timestamp.
[0107] Therefore, the method provided in Method 1 is only applicable when the timestamp of the target P-frame is greater than the timestamp of the I-frame.
[0108] Method 2: Determine the time interval between the I-frame and the target P-frame based on the frame number.
[0109] Step 1: Obtain the frame number of the I-frame, the frame number of the target P-frame, and the frame interval of the target video sequence.
[0110] The frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence.
[0111] In some embodiments, the video recording device obtains the frame number of the I-frame by parsing the PS packet corresponding to the I-frame; the video recording device obtains the frame number of the P-frame by parsing the PS packet corresponding to the P-frame.
[0112] Step 2: Determine the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame interval of the target video sequence.
[0113] In some embodiments, the time interval between the I-frame and the target P-frame is determined by multiplying the frame number difference between the target P-frame and the I-frame with the frame time interval of the target video sequence. For example, if the frame number of the target P-frame is F1, the frame number of the I-frame is F0, and the frame time interval of the target video sequence is D, then the time interval between the I-frame and the target P-frame satisfies: (F1-F0)*D.
[0114] For example, such as Figure 10 As shown, if the frame number of the I-frame is 1, the frame number of the target P-frame is 6, and the frame interval of the target video sequence is 40ms, then the time interval between the I-frame and the target P-frame is: (6-1)*40ms=200ms.
[0115] Understandably, determining the time interval between an I-frame and a target P-frame based on the frame number difference between the I-frame and the target P-frame, as well as the frame interval of the target video sequence, will not result in timestamp overflow and can accurately determine the time interval between the I-frame and the target P-frame.
[0116] S103. Determine the absolute time of the target P-frame based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame.
[0117] The absolute time of the target P-frame is the actual shooting time of the video frame corresponding to the target P-frame.
[0118] In some embodiments, the absolute time of the target P-frame is determined based on the sum of the absolute time of the I-frame and the time interval between the I-frame and the target P-frame. For example, if the absolute time of the I-frame is G0 and the time interval between the I-frame and the target P-frame is T1-T0, then the absolute time of the target P-frame satisfies: G0 + (T1-T0). In another example, if the absolute time of the I-frame is G0 and the time interval between the I-frame and the target P-frame is (F1-F0)*D, then the absolute time of the target P-frame satisfies: G0 + (F1-F0)*D.
[0119] For example, if the absolute time of the I-frame is 12:00:00, and the time interval between the I-frame and the target P-frame is 1000 milliseconds (1 second equals 1000 milliseconds), then the absolute time of the target P-frame is: 12:00:00 + 1 second = 12:00:1 second.
[0120] S104. Based on the absolute time of the I-frame and the absolute time of the target P-frame, update the current playback time of the replay progress bar.
[0121] In some embodiments, such as Figure 11 As shown, the playback progress bar displays the length information of the video recording file containing the target video sequence, as well as the time information corresponding to the current playback video frame.
[0122] In some embodiments, the video recording device sends the video frame corresponding to I-frame to the terminal device, so that the terminal device's display screen plays the video frame corresponding to I-frame. Simultaneously, the video recording device updates the current playback time of the playback progress bar using the absolute time of the I-frame. When the video recording device sends the video frame corresponding to a target P-frame to the terminal device, so that the terminal device's display screen plays the video frame corresponding to the target P-frame, the video recording device also updates the current playback time of the playback progress bar using the absolute time of the target P-frame.
[0123] In some embodiments, where the smallest time unit on the playback progress bar is seconds, the current playback time of the playback progress bar is updated to seconds based on the absolute time of the I-frame and the absolute time of the target P-frame. For example, if the absolute time of the target P-frame is 12:01:200 milliseconds, then the updated current playback time of the playback progress bar is 12:01.
[0124] In some embodiments, where the minimum time unit on the playback progress bar is milliseconds, the current playback time of the progress bar is updated to milliseconds based on the absolute time of the I-frame and the absolute time of the target P-frame. This increases the frequency of progress bar time updates and makes the time on the progress bar more accurate. For example, if the absolute time of the target P-frame is 12:01:200 milliseconds, then the updated current playback time of the playback progress bar is 12:01:200 milliseconds.
[0125] It is understood that the technical solution provided in this application first determines the absolute time of the I-frame in the target video sequence and the time interval between the I-frame and the target P-frame. Then, based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame, the absolute time of the target P-frame is determined. Finally, the current playback time of the playback progress bar is updated based on the absolute time of the I-frame and the absolute time of the target P-frame. Thus, compared to the prior art method of updating the current playback time of the playback progress bar only based on the absolute time of the I-frame, this application embodiment updates the current playback time of the playback progress bar based on both the absolute time of the I-frame and the absolute time of the P-frame, effectively improving the update frequency of the playback progress bar and ensuring that the currently played video frame corresponds to the current playback time on the progress bar.
[0126] like Figure 12 As shown in the figure, this application embodiment provides a progress bar time update device for performing, as follows: Figure 7 The progress bar time update method is shown. The progress bar time update device 300 includes: an acquisition module 301, a determination module 302, and an update module 303.
[0127] The acquisition module 301 is used to acquire a target video sequence; the target video sequence includes: an I-frame and at least one P-frame associated with the I-frame.
[0128] The determining module 302 is used to determine the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the I-frame is the actual shooting time of the video frame corresponding to the I-frame; the target P-frame is any one of at least one P-frame.
[0129] The determining module 302 is also used to determine the absolute time of the target P frame based on the absolute time of the I frame and the time interval between the I frame and the target P frame; the absolute time of the target P frame is the actual shooting time of the video frame corresponding to the target P frame.
[0130] The update module 303 is used to update the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame; the playback progress bar is used to display the time information of the current playback video frame.
[0131] In one possible implementation, the acquisition module 301 is further configured to acquire the timestamp of the I-frame and the timestamp of the target P-frame; the timestamp of the I-frame is used to represent the time offset of the I-frame relative to the reference time; the timestamp of the target P-frame is used to represent the time offset of the target P-frame relative to the reference time; the determination module 302 is specifically configured to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame.
[0132] In another possible implementation, the determining module 302 is specifically used to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame when the timestamp of the P-frame is greater than the timestamp of the I-frame.
[0133] In another possible implementation, the acquisition module 301 is further used to acquire the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence; the frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence; the determination module 302 is specifically used to determine the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence.
[0134] In another possible implementation, the determining module 302 is specifically used to determine the frame number difference between the frame number of the I-frame and the frame number of the target P-frame; determine the time interval between the I-frame and the target P-frame based on the product of the frame number difference and the frame time interval of the target video sequence; and update the module, which is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
[0135] In another possible implementation, when the minimum time unit on the playback progress bar is milliseconds, the update module 303 is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
[0136] In implementing the functions of the integrated modules described above using hardware, this application provides another possible structural diagram of the progress bar time update device involved in the above embodiments. For example... Figure 13 As shown, the progress bar time update device 400 includes: a processor 402, a communication interface 403, and a bus 404. Optionally, the progress bar time update device may also include a memory 401.
[0137] Processor 402 may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 402 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 402 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0138] Communication interface 403 is used to connect to other devices via a communication network. This communication network can be Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0139] The memory 401 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0140] As one possible implementation, the memory 401 can exist independently of the processor 402. The memory 401 can be connected to the processor 402 via a bus 404 and is used to store instructions or program code. When the processor 402 calls and executes the instructions or program code stored in the memory 401, it can implement the progress bar time update method provided in this application embodiment.
[0141] In another possible implementation, the memory 401 can also be integrated with the processor 402.
[0142] Bus 404 can be an extended industry standard architecture (EISA) bus, etc. Bus 404 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 13 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0143] Through the above description of the implementation methods, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the progress bar time update device can be divided into different functional modules to complete all or part of the functions described above.
[0144] This application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be executed by computer instructions instructing related hardware. The program can be stored in the aforementioned computer-readable storage medium, and when executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be any of the foregoing embodiments or memory. The aforementioned computer-readable storage medium can also be an external storage device for the progress bar time update device, such as a pluggable hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the progress bar time update device. Further, the aforementioned computer-readable storage medium can include both internal storage units and external storage devices of the progress bar time update device. The aforementioned computer-readable storage medium is used to store the computer program and other programs and data required by the progress bar time update device. The aforementioned computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0145] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to execute any of the progress bar time update methods provided in the above embodiments.
[0146] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple components. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0147] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
[0148] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for updating the time of a progress bar, characterized in that, include: Obtain the target video sequence; The target video sequence includes: an I-frame and at least one P-frame associated with the I-frame; Determine the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the I-frame is the actual shooting time of the video frame corresponding to the I-frame; the target P-frame is any one of the at least one P-frame. Based on the absolute time of the I-frame and the time interval between the I-frame and the target P-frame, the absolute time of the target P-frame is determined; the absolute time of the target P-frame is the actual shooting time of the video frame corresponding to the target P-frame. Based on the absolute time of the I-frame and the absolute time of the target P-frame, the current playback time of the playback progress bar is updated; the playback progress bar is used to display the time information of the currently playing video frame.
2. The method according to claim 1, characterized in that, Determining the time interval between the I-frame and the target P-frame includes: Obtain the timestamp of the I-frame and the timestamp of the target P-frame; the timestamp of the I-frame is used to represent the time offset of the I-frame relative to the reference time; the timestamp of the target P-frame is used to represent the time offset of the target P-frame relative to the reference time. The time interval between the I-frame and the target P-frame is determined based on the timestamp of the I-frame and the timestamp of the target P-frame.
3. The method according to claim 2, characterized in that, Determining the time interval between the I-frame and the target P-frame based on the relative timestamp of the I-frame and the relative timestamp of the target P-frame includes: If the timestamp of the P-frame is greater than the timestamp of the I-frame, the time interval between the I-frame and the target P-frame is determined based on the timestamp of the I-frame and the timestamp of the target P-frame.
4. The method according to claim 1, characterized in that, Determining the time interval between the I-frame and the target P-frame includes: Obtain the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence; the frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence; The time interval between the I-frame and the target P-frame is determined based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence.
5. The method according to claim 4, characterized in that, Determining the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence includes: Determine the frame number difference between the frame number of the I-frame and the frame number of the target P-frame; The time interval between the I-frame and the target P-frame is determined by the product of the frame number difference and the frame time interval of the target video sequence.
6. The method according to claim 1, characterized in that, When the minimum time unit on the playback progress bar is milliseconds, updating the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame includes: The current playback time of the playback progress bar is updated to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
7. A progress bar time update device, characterized in that, include: The acquisition module is used to acquire the target video sequence; The target video sequence includes: an I-frame and at least one P-frame associated with the I-frame; The determining module is used to determine the absolute time of the I-frame and the time interval between the I-frame and the target P-frame; the absolute time of the I-frame is the actual shooting time of the video frame corresponding to the I-frame; the target P-frame is any one of the at least one P-frame. The determining module is further configured to determine the absolute time of the target P frame based on the absolute time of the I frame and the time interval between the I frame and the target P frame; the absolute time of the target P frame is the actual shooting time of the video frame corresponding to the target P frame. The update module is used to update the current playback time of the playback progress bar based on the absolute time of the I-frame and the absolute time of the target P-frame; the playback progress bar is used to display the time information of the currently playing video frame.
8. The apparatus according to claim 7, characterized in that, The acquisition module is further configured to acquire the timestamp of the I-frame and the timestamp of the target P-frame; the timestamp of the I-frame is used to represent the time offset of the I-frame relative to the reference time; The timestamp of the target P-frame is used to represent the time offset of the target P-frame relative to the reference time; The determining module is specifically used to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame. The determining module is specifically used to determine the time interval between the I-frame and the target P-frame based on the timestamp of the I-frame and the timestamp of the target P-frame when the timestamp of the P-frame is greater than the timestamp of the I-frame. The acquisition module is further configured to acquire the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence; the frame time interval of the target video sequence is used to represent the time interval between two adjacent video frames in the target video sequence; the determination module is specifically configured to determine the time interval between the I-frame and the target P-frame based on the frame number of the I-frame, the frame number of the target P-frame, and the frame time interval of the target video sequence. The determining module is specifically used to determine the frame number difference between the frame number of the I-frame and the frame number of the target P-frame; and to determine the time interval between the I-frame and the target P-frame based on the product of the frame number difference and the frame time interval of the target video sequence. When the minimum time unit on the playback progress bar is milliseconds, the update module is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame. When the minimum time unit on the playback progress bar is milliseconds, the update module is specifically used to update the current playback time of the playback progress bar to milliseconds based on the absolute time of the I-frame and the absolute time of the P-frame.
9. A progress bar time update device, characterized in that, include: One or more processors; One or more memory units; Wherein, the one or more memories are used to store computer program code, the computer program code including computer instructions, and when the one or more processors execute the computer instructions, the progress bar time update device performs the progress bar time update method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when executed on a computer, cause the computer to perform the progress bar time update method according to any one of claims 1 to 6.