Video on demand method and device
By implementing video on-demand playback control on the client and using the mechanism of index files and data requests, the problems of high development costs and poor universality in the existing technology are solved, and the effect of reducing server costs and improving the universality of video files is achieved.
Patent Information
- Application Number
- CN202311300342.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-09
- Publication Date
- 2025-04-11
AI Technical Summary
Existing video on-demand servers require professional streaming technical personnel to develop, resulting in high development costs; at the same time, different video file formats need to be parsed, which is poor in versatility and increases development costs.
By implementing on-demand playback control on the client, the client sends an index request to the server to obtain the index file of the target video file, and generates data requests based on the index file to obtain the target frame. The server only needs to process the data request and return the target frame.
It reduces the development and operation costs of the server, improves the universality of the video file format, and saves the memory costs of the server in high concurrent on-demand scenarios and improves performance.
Smart Images

Figure CN119815124A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video monitoring technology, and in particular to a video on demand method and device. Background Art
[0002] In the field of security video surveillance, cameras generate a large number of video files every day, and users can play back these video files on demand through video players.
[0003] After receiving the video-on-demand operation from the user, the video player sends a video-on-demand request to the video-on-demand server. The video-on-demand server responds to the video-on-demand request of the video player and outputs the video frame to be played by the video player. The video-on-demand server needs to extract index information of the video file to be played according to the video-on-demand request. The index information contains information such as the position and length of each frame in the video file, so that the video frame in the video file can be played according to the index information. The video-on-demand server is usually a professional streaming media server based on protocols such as RTSP (Real Time Streaming Protocol) / RTP (Real-time Transport Protocol) or SIP (Session initialization Protocol) / RTP, which can realize the separation of control signaling and media data. The media sending module in the video-on-demand server is responsible for sending video frames to the video player; the playback control module in the video-on-demand server is responsible for playback control according to the index information.
[0004] However, on-demand servers are usually professional streaming media servers that require professional streaming media technical personnel to develop, resulting in high development costs. In addition, on-demand servers need to parse video files to extract index information. Video files of different formats need to be adapted to different parsing methods. If the video file uses a private file format or other standard file format, a special parsing module needs to be developed, which has poor versatility and increases development costs. Summary of the invention
[0005] The embodiment of the present invention provides a video on demand method and device, which can save the memory and hardware costs of the server, save the development cost and operation cost of the server, and improve the versatility of the video file format.
[0006] In a first aspect, an embodiment of the present invention discloses a video on demand method, which is applied to a client, and the method includes:
[0007] When receiving a video-on-demand request, sending an index request to the server; the video-on-demand request carries the identifier of the target video file and video-on-demand parameters; the index request carries the identifier of the target video file;
[0008] Receive a target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file;
[0009] According to the target index file and the on-demand parameter, for each target frame in the target video file to be requested by the on-demand request, a corresponding data request is generated, and the data requests are sent to the server in sequence; the data request carries the position range information of the target frame in the target video file;
[0010] Receive the target frame returned by the server in response to the data request.
[0011] In a second aspect, an embodiment of the present invention discloses a video on demand method, which is applied to a server, and the method includes:
[0012] Receiving an index request from a client; the index request carries an identifier of a target video file;
[0013] Based on the identifier of the target video file, searching a preset storage medium for a target index file corresponding to the target video file, and returning the target index file to the client; the target index file includes index information of each frame in the target video file;
[0014] Receive a data request from the client; the data request carries position range information of the target frame in the target video file;
[0015] The target frame is read from the target video file according to the position range information in the data request, and the target frame is returned to the client.
[0016] In a third aspect, an embodiment of the present invention discloses a video-on-demand system, the system comprising a client, a server and a video recording device; wherein:
[0017] The video recording device is used to generate a video file and an index file corresponding to the video file, and upload the video file to the server; the index file contains index information of each frame in the corresponding video file;
[0018] The client is used to send an index request to the server when receiving a video-on-demand request; the video-on-demand request carries the identifier of the target video file and video-on-demand parameters; the index request carries the identifier of the target video file;
[0019] The server is used to receive an index request from a client; based on the identifier of the target video file, query a preset storage medium for a target index file corresponding to the target video file, and return the target index file to the client; the target index file contains index information of each frame in the target video file;
[0020] The client is used to receive the target index file returned by the server in response to the index request; generate a corresponding data request for each target frame in the target video file requested by the on-demand request according to the target index file and the on-demand parameter, and send the data requests to the server in sequence; the data request carries the position range information of the target frame in the target video file;
[0021] The server is configured to receive a data request from the client; read a target frame from the target video file according to the location range information in the data request, and return the target frame to the client;
[0022] The client is used to receive the target frame returned by the server in response to the data request.
[0023] In a fourth aspect, an embodiment of the present invention discloses a video-on-demand device, which is applied to a client, and the device includes:
[0024] An index request module, configured to send an index request to a server upon receiving a video-on-demand request; the video-on-demand request carries an identifier of a target video file and video-on-demand parameters; the index request carries an identifier of the target video file;
[0025] A playback control module is used to receive a target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file; according to the target index file and the on-demand parameter, a corresponding data request is generated for each target frame in the target video file requested by the on-demand request, and the data request is sent to the server in sequence; the data request carries the position range information of the target frame in the target video file; and the target frame returned by the server in response to the data request is received.
[0026] In a fifth aspect, an embodiment of the present invention discloses a video-on-demand device, which is applied to a server, and the device includes:
[0027] An index request receiving module, used to receive an index request from a client; the index request carries an identifier of a target video file;
[0028] An index file returning module, configured to search a preset storage medium for a target index file corresponding to the target video file based on the identifier of the target video file, and return the target index file to the client; the target index file includes index information of each frame in the target video file;
[0029] A data request receiving module, used for receiving a data request from the client; the data request carries the position range information of the target frame in the target video file;
[0030] The data content returning module is used to read the target frame from the target video file according to the position range information in the data request, and return the target frame to the client.
[0031] The embodiments of the present invention include the following advantages:
[0032] The video on demand method provided by the embodiment of the present invention pre-places the playback control operation of responding to the on-demand request to the client, and the client implements on-demand playback of the target video file according to the target index file. The server does not need a separate signaling channel to transmit the playback control signaling, so the server does not need to use a professional streaming media server supporting protocols such as RTSP / RTP or SIP / RTP, which greatly reduces the development cost of the server. In addition, the target index file can be synchronously generated by the recording device when generating the target video file, and the client can directly request the server to obtain the target index file corresponding to the target video. Therefore, the server does not need to set a file parsing module to extract the index information of the target video, and does not need to adapt different parsing methods for video files of different formats, which can save the memory and hardware costs of the server, save the operating costs of the server, and improve the versatility of the video file format. Furthermore, through the embodiment of the present invention, in the scenario of high concurrent on-demand, the memory cost of the server can be saved and the performance of the server can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0034] Figure 1 is a flowchart of a video on demand method embodiment of the present invention;
[0035] Figure 2 It is a schematic diagram of the system architecture of a video on demand method of the present invention;
[0036] Figure 3 is a flowchart of another video on demand method embodiment of the present invention;
[0037] Figure 4 It is a schematic diagram of the interaction flow of each module in a video on demand system of the present invention;
[0038] Figure 5 is a structural block diagram of an embodiment of a video on demand device of the present invention;
[0039] Figure 6 It is a structural block diagram of another video-on-demand device embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of the present invention, the term "multiple" refers to two or more, and other quantifiers are similar.
[0042] In order to facilitate understanding of the technical solution of the present invention, some technical terms involved in the present invention are introduced below.
[0043] Reference Figure 1 , shows a flowchart of a video on demand method embodiment of the present invention, the method can be applied to a client, the method may include the following steps:
[0044] Step 101: upon receiving a video-on-demand request, sending an index request to a server; the video-on-demand request carries an identifier of a target video file and video-on-demand parameters; the index request carries an identifier of the target video file;
[0045] Step 102: receiving a target index file corresponding to the target video file returned by the server in response to the index request; the target index file includes index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file;
[0046] Step 103: Generate a corresponding data request for each target frame in the target video file requested by the on-demand request according to the target index file and the on-demand parameter, and send the data requests to the server in sequence; the data request carries the position range information of the target frame in the target video file;
[0047] Step 104: Receive the target frame returned by the server in response to the data request.
[0048] The video on demand method provided in the embodiment of the present invention can be applied to scenarios where there is a demand for video on demand, such as the security monitoring field. It should be noted that the video on demand referred to in the embodiment of the present invention may include audio on demand and video on demand. The embodiment of the present invention takes video on demand as an example for explanation. The processing method of audio on demand is similar and can be referred to each other.
[0049] Reference Figure 2 , shows a schematic diagram of the system architecture of the video on demand method of the present invention. Figure 2 As shown, the system includes a client 201, a server 202 and a video recording device 203. The video recording device can collect video data. For example, the video recording device can be a network camera. A network camera is a new generation of cameras that combines traditional cameras with network technology and can be used in the field of video surveillance. After collecting video data, the network camera can save the collected video data for users to view.
[0050] The video recording device can collect video data in real time and save the collected video data into a video file. The embodiment of the present invention does not limit the format of the video file, and the video file can be a standard MP4 file format or a private media file format.
[0051] Furthermore, the video recording device generates an index file corresponding to the video file synchronously when generating the video file. An index file contains index information of each frame in the video file corresponding to the index file, and the index information includes information such as the position and length of the frame in the video file. Optionally, the index information of each frame may include the following content: frame type, offset of the frame in the video file, frame length, and timestamp of the frame.
[0052] In an optional embodiment of the present invention, the target frame may include the video frame to be played by the on-demand request; or, the target frame may include the video frame to be played by the on-demand request and an audio frame corresponding to the video frame to be played.
[0053] In security monitoring scenarios, on-demand playback usually only requires playing images without playing sounds. Therefore, the target frames requested by the client to the server may include only image frames, such as one of I frames, P frames, and B frames. For example, in one application scenario, it is assumed that the target frames include the 1st I frame, the 3rd I frame, the 5th I frame, ..., and the last I frame in video file A. That is, the client only plays the 1st I frame, the 3rd I frame, the 5th I frame, ..., and the last I frame in video file A, thereby fast-forwarding video file A.
[0054] The video recording device generates an index file corresponding to the video file synchronously when generating the video file. The index file contains the frame type of each frame, and the frame type may include one of an I frame, a P frame and a B frame.
[0055] In practical applications, the video file recorded by the recording device may contain audio data in addition to image data. Optionally, the target frame requested by the client to the server may include the video frame to be played in the on-demand request and the audio frame corresponding to the video frame to be played.
[0056] For example, in one application scenario, assuming that the target frame includes the first I frame in video file A, the audio frame corresponding to the timestamp can be obtained from the audio data in video file A based on the timestamp of the first I frame. The target frame received by the client from the server includes the first I frame in video file A and the corresponding audio frame, thereby achieving simultaneous playback of images and sounds during on-demand playback.
[0057] It should be noted that the video frame referred to in the embodiment of the present invention refers to an image frame, such as an I frame, a P frame or a B frame. The embodiment of the present invention is described by taking the playing of only images as an example.
[0058] In a specific implementation, when the video recording device collects video data, it generates ES (Elementary Stream). ES contains the data content required by the above index information, such as frame type, frame length and timestamp. When the video recording device generates a video file, it can record the offset of each frame in the video file, so that the frame type, frame length and timestamp of the current frame and the offset of the frame in the video file can be written into the index file corresponding to the video file as the index information of the frame.
[0059] Furthermore, to facilitate query, the video file generated by the recording device and the index file corresponding to the video file can use the same name, but different suffixes. For example, a video file is generated as A.mp4, and the index file corresponding to the video file is generated as A.index. The recording device can collect video data in real time, synchronously generate an index file corresponding to the video file when generating the video file, and upload the generated video file and the corresponding index file to the server. After receiving the video file and the corresponding index file uploaded by the recording device, the server can save them to a preset storage medium. The preset storage medium can be a disk array or NAS (Network Attached Storage), IPSAN (IP Storage Area Network), which is used to store massive video files and corresponding index files.
[0060] The client may be a video player running on a user device, having the ability to decode and render videos. Exemplarily, the client may be a WEB browser. The user device may include, but is not limited to, any of the following: a mobile device, a user terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc.
[0061] The client can receive a VOD request triggered by a user, and in response to the VOD request, request the server to obtain the target frame requested by the VOD request, wherein the target frame may include some or all video frames in the target video file; after receiving the target frame returned by the server, the client can decode and render the target frame, thereby playing it according to the VOD request.
[0062] In the embodiment of the present invention, the video recording device generates an index file corresponding to the video file synchronously when generating the video file. When the client receives a video-on-demand request for the target video file, it can directly request the server to obtain the target index file corresponding to the target video file. Therefore, the server does not need to set up a file parsing module to extract the index information of the video file to be played. The server has a file reading function and can read the target index file from a preset storage medium, which can save the memory cost and operation cost of the server.
[0063] Furthermore, the embodiment of the present invention places the playback control operation in front of the client, that is, after the client receives the target index file returned by the server, the client performs playback control according to the target index file. Specifically, the client sends a data request to the server according to the target index file and the on-demand parameters carried by the on-demand request, and sequentially requests to obtain the target frames to be played, and decodes and renders after receiving the target frames returned by the server, thereby achieving continuous playback of the video frames to be played by the on-demand request. Compared with placing the playback control operation on the server, the server in the embodiment of the present invention does not need to set up a separate signaling channel to transmit playback control signaling. Therefore, the server in the embodiment of the present invention does not need to use a professional streaming media server that supports protocols such as RTSP / RTP or SIP / RTP, which greatly reduces the development cost of the server.
[0064] In an embodiment of the present invention, the video file and the index file have a one-to-one correspondence. When the client receives a video-on-demand request triggered by a user through a video player, the video-on-demand request carries the identifier of the target video file and the video-on-demand parameters. The identifier of the target video file is used to indicate which video file the video-on-demand request is to play. For example, if the user requests video file A through a video player, the identifier of the target video file is the identifier of video file A. The video-on-demand parameters are used to indicate the playback mode of the target video to be played by the video-on-demand request, such as normal playback, fast-forward playback, fast-rewind playback, or positioning playback. Taking positioning playback as an example, the user opens video A through a video player and drags the progress bar to the 10th second of video A to start playing. At this time, the video-on-demand request is triggered. The identifier of the target video file carried by the video-on-demand request is the identifier of video file A; the carried video-on-demand parameters indicate that the playback mode is positioning playback, such as starting to play from the 10th second.
[0065] After receiving the on-demand request, the client sends an index request to the server; the index request carries the identifier of the target video file, such as the identifier of video file A.
[0066] Exemplarily, the preset storage medium stores the identification of the video file, the mapping relationship between the video file and the index file. After the server receives the index request sent by the client, based on the identification of the target video file carried in the index request, it searches the preset storage medium for the target index file corresponding to the target video file. For example, if the target video file is A.mp4 and the target index file is A.index, the server returns the found target index file A.index to the client.
[0067] The client receives a target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file, and the index information includes at least one of the following contents: frame type, frame length, offset, and timestamp.
[0068] According to the target index file and the on-demand parameters, a corresponding data request is generated for each target frame in the target video file requested by the on-demand request, and the data request is sent to the server in sequence; the data request carries the position range information of the target frame in the target video file. The position range information is used to indicate the starting position and the ending position of the target frame in the target video. The client sends the data request to the server to request to obtain the target frame. The target frame refers to the video frame to be played by the on-demand request.
[0069] In an optional embodiment of the present invention, the client and the server support HTTP protocol, and the data request may be an HTTP request. The server may be any server supporting HTTP protocol, such as a WEB server.
[0070] HTTP request refers to the request message from the client to the server. The client can request the server to obtain data in a file through HTTP request. The message format of an HTTP request may include a request line, a request header, a blank line, and request data.
[0071] For example, in the above example, the on-demand request indicates that the video file A should be played from the 10th second, and the target frame includes every frame from the 10th second to the end of the video file A. After the server receives the data request (such as an HTTP request) sent by the client, based on the position range information of the target frame carried in the HTTP request in the target video file, the server reads the data of the target frame at the position range information in the target video file stored in the preset storage medium, and returns it to the client. The client receives the target frame returned by the server in response to the HTTP request, and can decode and render it so that the video player can play the video content requested by the user.
[0072] It should be noted that, in the embodiment of the present invention, the requests sent by the client to the server can be HTTP requests, for example, the index request and the data request can be HTTP requests. The server does not need to use a dedicated streaming media server, but can use a general WEB server.
[0073] In an optional embodiment of the present invention, generating a corresponding data request for each target frame in the target video file to be requested by the on-demand request according to the target index file and the on-demand parameter in step 103 may include:
[0074] Step S11, determining the target frame and the play order according to the on-demand parameters;
[0075] Step S12, determining the position range information of each target frame in the target video file according to the index information of each target frame in the target video file contained in the target index file;
[0076] Step S13, sequentially generating a data request corresponding to each target frame in the target video file according to the playback order, and filling the position range information of the target frame in the target video file in the preset field of the data request corresponding to each target frame;
[0077] The sending of the data request to the server in sequence in step 103 may include: sending a data request corresponding to each target frame to the server in sequence according to the playback order.
[0078] The message format of an HTTP request may include a request line, a request header, a blank line, and request data. The request header includes a Range field, which can be used to request fragment data in a file. The field contains the start byte and end byte of the requested fragment data.
[0079] The client can determine the target frame and the play order according to the on-demand parameters. For example, taking normal play as an example, the play order is forward play, that is, the target frame is played in the forward order of the index information in the target index file. The target frame includes every frame in the target video.
[0080] Since the target index file contains index information of each frame in the target video (such as frame type, offset, frame length and timestamp), the position range information of each target frame in the target video file can be determined based on the index information of each target frame contained in the target index file.
[0081] Exemplarily, assuming that the timestamp of the target video file starts from 0, the timestamp of the first frame of the target video file is 0 seconds. Taking the target video file as video file A (such as A.mp4) and the on-demand request as normal playback as an example, the target frame includes each frame in video file A. For the first frame in video file A, the index information of the frame with a timestamp of 0 seconds (called the 0th second frame) is searched in the target index file (such as A.index) corresponding to video file A. Thus, the position range information of the 0th second frame can be obtained, the HTTP request corresponding to the 0th second frame (the first target frame at this time) is constructed, and the position range information of the first target frame in video file A is filled in the HTTP request. For example, the Range field in the HTTP request is set as follows: Content-Range: bytes1000-3000 / 5000. Among them, 1000 is the starting byte of the first frame, 3000 is the ending byte of the first frame, and 5000 represents the total length of the target video file. The HTTP request is sent to the server to request to obtain the first target frame (i.e., the first frame) in video file A. Next, a request is made to the server to obtain the next target frame (such as the second frame).
[0082] For another example, if the target video file is video file B (such as B.mp4) and the on-demand request is positional playback, assuming that the on-demand request indicates to play video file B from the 10th second, the target index file (such as B.index) can be traversed to find the index information corresponding to the 10th second frame, so as to obtain the position range information of the 10th second frame, construct the HTTP request corresponding to the target frame (the 10th second frame), and fill in the Range field in the HTTP request, such as Content-Range: bytes5000-8000 / 10000. Then, the server is requested to obtain the next target frame (such as the next frame of the 10th second frame).
[0083] In an embodiment of the present invention, the client generates HTTP requests corresponding to each target frame in the target video one by one according to the target index file and the playback order indicated by the on-demand request, and fills the position range information of the target frame in the target video in the Range field of the HTTP request corresponding to each target frame, and sends the HTTP request corresponding to each target frame to the server in sequence. After receiving the HTTP request from the client, the server obtains the position range information of the target frame to be read by parsing the Range field, so that the data block (that is, the target frame) at the position range information can be read from the target video file, and returned to the client for playback.
[0084] Furthermore, when multiple clients respond to on-demand requests concurrently, multiple clients simultaneously request the server to obtain the target index files they need, and the server only needs to read the corresponding target index files from the preset storage medium and return them to the corresponding clients. The clients then implement playback control based on their respective target index files and request the server to obtain the target frame data to be played. Since the server does not need to perform the operation of extracting index information, nor does it need to perform playback control operations based on the extracted index information, the server's memory cost can be saved and the server's performance can be improved in high-concurrency on-demand scenarios. For example, when 10,000 clients respond to on-demand requests concurrently, if the server extracts index information and implements playback control operations, the server needs to cache the index information required by these 10,000 clients locally. If the index information of each target video file requires 2MB of memory space, the server needs to use 20G memory to cache these index information, which not only leads to high memory costs, but also affects system performance. Through the embodiment of the present invention, these 10,000 clients only need to request the target index files they need from the server respectively. The server reads the target index files from the preset storage medium and sends them to the corresponding clients, and the clients implement playback control. The server does not need to cache a large amount of index information. For each client, it is only necessary to cache the target index files they need (such as only occupying 2MB). The memory space occupied by a single target index file is very small, and the memory cost and performance impact on the client can be ignored. Therefore, in the scenario of high concurrent on-demand, the embodiment of the present invention can save the memory cost of the server and improve the performance of the server.
[0085] In the embodiment of the present invention, the on-demand request may support any one of the following play modes: normal play, fast forward play, fast rewind play and position play.
[0086] Among them, normal playback means playing from the start position of the target video file. Fast forward playback means playing from the specified position of the target video file in the forward order according to the specified fast forward multiple. Fast rewind playback means playing from the specified position of the target video file in the reverse order according to the specified rewind multiple. Position playback means playing from the specified position of the target video file.
[0087] For normal playback, the target frame may include every frame of the target video file, including I-frames, P-frames, and B-frames.
[0088] Fast forward or fast rewind playback can be triggered by the video player, which can be achieved by buttons or touch screen operations. The client actually plays key frames at certain intervals continuously. Key frames specifically refer to I frames, which are actual picture frames, also called intra-frame coded frames. I frames display intra-frame coded images that minimize the removal of redundant image information to compress the amount of transmitted data. There are also P frames and B frames. Key frames contain pictures in the video. Playing key frames at certain intervals continuously and connecting them in series will form a continuous picture of fast forward or fast rewind. Therefore, the client can continuously send HTTP requests to the server to obtain target frames (key frames at certain intervals) to achieve fast forward or fast rewind playback.
[0089] For example, for fast forward playback, the target frame may include each key frame in the target video file that is spaced a certain number of frames (referred to as the first frame number) in the forward order of the target video file playback starting from a specified timestamp (referred to as the first timestamp herein). For fast reverse playback, the target frame may include each key frame in the target video file that is spaced a certain number of frames (referred to as the second frame number) in the reverse order of the target video file playback starting from a specified timestamp (referred to as the second timestamp herein).
[0090] For positioned playback, the target frame may include every frame in the target video starting from a specified timestamp (referred to herein as a third timestamp), including I frames, P frames, and B frames.
[0091] The specified timestamp refers to the timestamp corresponding to the current playback progress when the VOD request is triggered, that is, the current playback position. For example, a user opens video A through a video player and drags the progress bar to the 10th second of video A to start playing. At this time, the specified timestamp of the VOD request triggered is 10 seconds.
[0092] It should be noted that, in the embodiment of the present invention, for on-demand requests of different playback modes, the processing logic of the server is the same, that is, according to the received HTTP request, the target frame at the position range information indicated by the Range field in the HTTP request is read from the target video file, and returned to the client.
[0093] In an optional embodiment of the present invention, the on-demand parameter indicates that the playback mode is normal playback; and determining the target frame and the playback order according to the on-demand parameter may include:
[0094] The playback order is determined to be the forward order of the index information in the target index file, and the target frame is determined to include each frame in the target video file.
[0095] For normal playback, the client obtains the position range information of each frame in a forward order from the beginning of the target index file according to the index information in the target index file, builds corresponding HTTP requests one by one, and sends them to the server.
[0096] In an example, assuming that the target video contains 100 frames, the position range information of each frame is obtained according to the index information of each frame, and the HTTP request of each frame is constructed and the corresponding Range field is filled. Among them, the forward order refers to the order from small to large timestamps.
[0097] In an optional embodiment of the present invention, the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a first timestamp; and determining the target frame and the playback order according to the on-demand parameter may include:
[0098] Determine the playback order as the forward order of the index information in the target index file, and determine that the target frame includes the key frames in the target video file starting from the first timestamp (including the key frames corresponding to the first timestamp) and every first number of frames in the forward order; the first number of frames is determined according to the fast forward multiple.
[0099] For fast forward playback, the client queries the index information in the target index file, obtains the position range information of each key frame with an interval of the first number of frames in forward order starting from the first timestamp in the target index file, builds corresponding HTTP requests one by one, and sends them to the server.
[0100] The first number of frames is determined according to the fast forward multiple. For example, assuming that the fast forward multiple is 4 times, the first number of frames is m, where m is a positive integer, that is, starting from the first timestamp (including the key frame corresponding to the first timestamp), the key frame is read every m key frames in a forward order as the target frame, thereby achieving a 4-fold fast forward playback effect. For another example, assuming that the fast forward multiple is 2 times, the first number of frames is n, where n is a positive integer, and n<m, that is, starting from the first timestamp (including the key frame corresponding to the first timestamp), the key frame is read every n key frames in a forward order as the target frame, thereby achieving a 2-fold fast forward playback effect. It can be understood that the values of m and n can be set as needed.
[0101] In an optional embodiment of the present invention, the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a second timestamp; and determining the target frame and the playback order according to the on-demand parameter may include:
[0102] Determine the playback order as the reverse order of the index information in the target index file, and determine that the target frame includes the key frames in the target video file starting from the second timestamp (including the key frames corresponding to the second timestamp) and arranged at intervals of a second number of frames in the reverse order; the second number of frames is determined according to the fast-forward multiple.
[0103] For fast-rewind playback, which is the opposite direction of fast-forward playback, the client queries the index information in the target index file, obtains the position range information of each key frame with a second frame interval in reverse order starting from the second timestamp in the target index file, constructs corresponding HTTP requests one by one, and sends them to the server.
[0104] The second number of frames is determined according to the fast-rewind multiple. Fast-rewind playback is the reverse playback of fast-forward playback. Fast-forward playback is to read key frames at intervals of the first number of frames starting from the current playback position (such as the key frame corresponding to the first timestamp) in forward order as the target frame; reverse playback is to read key frames at intervals of the second number of frames starting from the current playback position (such as the key frame corresponding to the second timestamp) in reverse order as the target frame. The second number of frames can be set as needed.
[0105] In an optional embodiment of the present invention, the on-demand parameter indicates that the playback mode is positioned playback, and the on-demand parameter includes a third timestamp; and determining the target frame and the playback order according to the on-demand parameter may include:
[0106] The playback order is determined to be the forward order of the index information in the target index file, and the target frame is determined to include each frame starting from the third timestamp in the target video file.
[0107] For positioning playback, the client queries the index information in the target index file, obtains the position range information of each frame in forward order starting from the third timestamp in the target index file, builds corresponding HTTP requests one by one, and sends them to the server.
[0108] Furthermore, if the target index file does not contain index information of the key frame corresponding to the third timestamp, the target index file is searched for index information of the key frame closest to the third timestamp (called the nearest key frame), and the nearest key frame is used as the first target frame.
[0109] In summary, the embodiment of the present invention provides a video on demand method, which can be applied to a client. The embodiment of the present invention pre-places the playback control operation of responding to the on-demand request to the client, and the client implements on-demand playback of the target video file according to the target index file. The server does not need a separate signaling channel to transmit the playback control signaling. Therefore, the server does not need to use a professional streaming media server that supports protocols such as RTSP / RTP or SIP / RTP, which greatly reduces the development cost of the server. In addition, the target index file can be generated synchronously by the recording device when generating the target video file, and the client can directly request the server to obtain the target index file corresponding to the target video. Therefore, the server does not need to set a file parsing module to extract the index information of the target video, and does not need to adapt different parsing methods for video files of different formats, which can save the memory and hardware costs of the server, save the operating costs of the server, and improve the versatility of the video file format. Furthermore, through the embodiment of the present invention, in the scenario of high concurrent on-demand, the memory cost of the server can be saved and the performance of the server can be improved.
[0110] Reference Figure 3 , shows a flowchart of another video on demand method embodiment of the present invention, the method can be applied to the server, the method may include the following steps:
[0111] Step 301: receiving an index request from a client; the index request carries an identifier of a target video file;
[0112] Step 302: based on the identifier of the target video file, query the preset storage medium for a target index file corresponding to the target video file, and return the target index file to the client; the target index file contains index information of each frame in the target video file;
[0113] Step 303: receiving a data request from the client; the data request carries the position range information of the target frame in the target video file;
[0114] Step 304: read a target frame from the target video file according to the position range information in the data request, and return the target frame to the client.
[0115] In the frequency on-demand method of the embodiment of the present invention, the operation process performed by the server has been described in the above embodiment and will not be repeated here.
[0116] In an optional embodiment of the present invention, the server supports HTTP protocol, and the data request is an HTTP request.
[0117] In an optional embodiment of the present invention, the method may further include:
[0118] Receiving a video file uploaded from a video recording device and an index file corresponding to each video file, wherein the index file includes index information of each frame in the corresponding video file, and the index information includes at least one of the following contents: frame type, frame length, offset, and timestamp;
[0119] The received video files and the index files corresponding to each video file are saved in the preset storage medium.
[0120] In summary, the embodiment of the present invention provides a video on demand method, which can be applied to the server. The embodiment of the present invention pre-places the playback control operation of responding to the on-demand request to the client, and the client implements on-demand playback of the target video file according to the target index file. The server does not need a separate signaling channel to transmit the playback control signaling. Therefore, the server does not need to use a professional streaming media server that supports protocols such as RTSP / RTP or SIP / RTP, which greatly reduces the development cost of the server. In addition, the target index file can be generated synchronously by the recording device when generating the target video file, and the client can directly request the server to obtain the target index file corresponding to the target video. Therefore, the server does not need to set a file parsing module to extract the index information of the target video, and does not need to adapt different parsing methods for video files of different formats, which can save the memory and hardware costs of the server, save the operating costs of the server, and improve the versatility of the video file format. Furthermore, through the embodiment of the present invention, in the scenario of high concurrent on-demand, the memory cost of the server can be saved and the performance of the server can be improved.
[0121] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0122] like Figure 2 FIG. 2 is a schematic diagram of the architecture of a video-on-demand system of the present invention, wherein the system includes a client 201, a server 202 and a video recording device 203; wherein:
[0123] The video recording device 203 is used to generate a video file and an index file corresponding to the video file, and upload the video file to the server; the index file contains index information of each frame in the corresponding video file;
[0124] The client 201 is used to send an index request to the server when receiving a video-on-demand request; the video-on-demand request carries the identifier of the target video file and video-on-demand parameters; the index request carries the identifier of the target video file;
[0125] The server 202 is used to receive an index request from a client; based on the identifier of the target video file, query a preset storage medium for a target index file corresponding to the target video file, and return the target index file to the client; the target index file contains index information of each frame in the target video file;
[0126] The client 201 is used to receive the target index file returned by the server in response to the index request; generate a corresponding data request for each target frame in the target video file requested by the on-demand request according to the target index file and the on-demand parameter, and send the data requests to the server in sequence; the data request carries the position range information of the target frame in the target video file;
[0127] The server 202 is configured to receive a data request from the client; read a target frame from the target video file according to the location range information in the data request, and return the target frame to the client;
[0128] The client 201 is used to receive the target frame returned by the server in response to the data request.
[0129] The recording device may be a network camera. The client may be a video player that supports the HTTP protocol and can run on a user device, and has the ability to decode and render videos, such as a WEB browser, an APP (application) based on iOS / Android, etc. The server may be any server that supports the HTTP protocol, such as a WEB server.
[0130] Optionally, the client is specifically used to determine the target frame and the playback order according to the on-demand parameters; determine the position range information of each target frame in the target video file according to the index information of each target frame contained in the target index file in the target video file; generate data requests corresponding to each target frame in the target video file in sequence according to the playback order, and fill in the position range information of the target frame in the target video file in the preset field of the data request corresponding to each target frame; and send the data request corresponding to each target frame to the server in sequence according to the playback order.
[0131] Optionally, the on-demand parameter indicates that the playback mode is normal playback; the client is specifically used to: determine the playback order to be the forward order of the index information in the target index file, and determine that the target frame includes every frame in the target video file.
[0132] Optionally, the on-demand parameters indicate that the playback mode is fast-forward playback, and the on-demand parameters include a fast-forward multiple and a first timestamp; the client is specifically used to: determine that the playback order is the forward order of the index information in the target index file, and determine that the target frame includes key frames in the target video file starting from the first timestamp and every first number of frames in the forward order; the first number of frames is determined according to the fast-forward multiple.
[0133] Optionally, the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a second timestamp; the client is specifically used to: determine that the playback order is the reverse order of the index information in the target index file, and determine that the target frame includes the key frames in the target video file starting from the second timestamp and every second number of frames in the reverse order; the second number of frames is determined according to the fast-forward multiple.
[0134] Optionally, the on-demand parameter indicates that the playback mode is positioned playback, and the on-demand parameter includes a third timestamp; the client is specifically used to: determine that the playback order is the forward order of the index information in the target index file, and determine that the target frame includes each frame in the target video file starting from the third timestamp.
[0135] Optionally, the index information includes at least one of the following contents: frame type, frame length, offset, and timestamp.
[0136] Optionally, the client and the server support HTTP protocol, and the data request is an HTTP request.
[0137] Optionally, the server is also used to: receive video files uploaded from a recording device and index files corresponding to each video file, the index file including index information of each frame in the corresponding video file, the index information including at least one of the following contents: frame type, frame length, offset, and timestamp; save the received video files and the index files corresponding to each video file to the preset storage medium.
[0138] In summary, the embodiment of the present invention provides a video on demand system, which pre-places the playback control operation of responding to the on-demand request to the client, and the client implements on-demand playback of the target video file according to the target index file. The server does not need a separate signaling channel to transmit the playback control signaling, so the server does not need to use a professional streaming media server that supports protocols such as RTSP / RTP or SIP / RTP, which greatly reduces the development cost of the server. In addition, the target index file can be generated synchronously by the recording device when generating the target video file, and the client can directly request the server to obtain the target index file corresponding to the target video. Therefore, the server does not need to set a file parsing module to extract the index information of the target video, and does not need to adapt different parsing methods for video files of different formats, which can save the memory and hardware costs of the server, save the operating costs of the server, and improve the versatility of the video file format. Furthermore, through the embodiment of the present invention, in the scenario of high concurrent on-demand, the memory cost of the server can be saved and the performance of the server can be improved.
[0139] Reference Figure 4 , shows a schematic diagram of the interaction process of each module in a video on demand system. Figure 4 As shown, the recording device has the recording capability, can generate video files (can be any media format) and corresponding index files locally, and upload them to the server (such as a WEB server). The WEB server can be a server that supports the HTTP protocol, and does not need to support professional streaming media servers such as RTSP / RTP or SIP / RTP. The WEB server is only responsible for data transmission and has no business logic. The client can be any application software that supports the HTTP protocol and has the ability to decode and render, such as a WEB browser, an iOS / Android-based APP. The client has the video player capability of the solution of the present invention, and is responsible for requesting target frame data from the WEB server and receiving target frame data transmitted by the WEB server, and decoding and rendering. The client controls which data needs to be requested in response to the on-demand request and how to play it.
[0140] Specifically, the video recording device collects video data in real time, generates a video file and a corresponding index file, and uploads them to the server. The server writes the video file and the corresponding index file uploaded by the video recording device into a preset storage medium, and returns a message of successful upload to the video recording device after successful writing. After receiving the on-demand request, the client sends an index request to the server to request the target index file corresponding to the target video file to be played by the on-demand request. The server responds to the index request from the client, reads the target index file from the preset storage medium, and returns it to the client. The client cyclically performs the following operations to realize on-demand playback: according to the index information of each video frame in the target index file, an HTTP request is constructed for the target frame, and the HTTP request carries the position range information of the target frame in the target video file; the server responds to the HTTP request, reads the target frame data from the target video file according to the position range information carried therein, and returns it to the client; the client decodes the received target frame and renders it for playback; and processes the next target frame.
[0141] Reference Figure 5 , shows a structural block diagram of an embodiment of a video on demand device of the present invention, the device can be applied to a client, and the device includes:
[0142] The index request module 501 is used to send an index request to the server when receiving a video-on-demand request; the video-on-demand request carries the identifier of the target video file and video-on-demand parameters; the index request carries the identifier of the target video file;
[0143] The playback control module 502 is used to receive the target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file; according to the target index file and the on-demand parameters, for each target frame in the target video file requested by the on-demand request, a corresponding data request is generated, and the data request is sent to the server in sequence; the data request carries the position range information of the target frame in the target video file; and the target frame returned by the server in response to the data request is received.
[0144] Optionally, the playback control module includes:
[0145] A first determination submodule, used to determine the target frame and the playback order according to the on-demand parameters;
[0146] A second determination submodule is used to determine the position range information of each target frame in the target video file according to the index information of each target frame in the target video file contained in the target index file;
[0147] A request construction submodule, used to sequentially generate a data request corresponding to each target frame in the target video file according to the playback order, and fill in the position range information of the target frame in the target video file in the preset field of the data request corresponding to each target frame;
[0148] The request sending submodule is used to send the data request corresponding to each target frame to the server in sequence according to the playback order.
[0149] Optionally, the on-demand parameter indicates that the playback mode is normal playback; the first determination submodule is specifically used to: determine the playback order as the forward order of the index information in the target index file, and determine that the target frame includes every frame in the target video file.
[0150] Optionally, the on-demand parameters indicate that the playback mode is fast-forward playback, and the on-demand parameters include a fast-forward multiple and a first timestamp; the first determination submodule is specifically used to: determine that the playback order is the forward order of the index information in the target index file, and determine that the target frame includes key frames in the target video file starting from the first timestamp and every first number of frames in the forward order; the first number of frames is determined according to the fast-forward multiple.
[0151] Optionally, the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a second timestamp; the first determination submodule is specifically used to: determine that the playback order is the reverse order of the index information in the target index file, and determine that the target frame includes key frames in the target video file starting from the second timestamp and in the reverse order at intervals of a second number of frames; the second number of frames is determined according to the fast-forward multiple.
[0152] Optionally, the on-demand parameter indicates that the playback mode is positioned playback, and the on-demand parameter includes a third timestamp; the first determination submodule is specifically used to: determine the playback order as the forward order of the index information in the target index file, and determine that the target frame includes each frame in the target video file starting from the third timestamp.
[0153] Optionally, the index information includes the following contents: frame type, frame length, offset, and timestamp.
[0154] Optionally, the client supports HTTP protocol, and the data request is an HTTP request.
[0155] Reference Figure 6 , shows a structural block diagram of another embodiment of a video-on-demand device of the present invention, the device can be applied to a server, and the device includes:
[0156] The index request response module 601 is used to receive an index request from a client; the index request carries an identifier of a target video file; based on the identifier of the target video file, a target index file corresponding to the target video file is searched in a preset storage medium, and the target index file is returned to the client; the target index file contains index information of each frame in the target video file;
[0157] The data request response module 602 is used to receive a data request from the client; the data request carries the position range information of the target frame in the target video file; reads the target frame from the target video file according to the position range information in the data request, and returns the target frame to the client.
[0158] Optionally, the device further comprises:
[0159] A file receiving module, used to receive video files uploaded from a video recording device and index files corresponding to each video file, wherein the index file includes index information of each frame in the corresponding video file, and the index information includes frame type, frame length, offset, and timestamp;
[0160] The file storage module is used to save the received video files and the index files corresponding to each video file to the preset storage medium.
[0161] Optionally, the server supports HTTP protocol, and the data request is an HTTP request.
[0162] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0163] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0164] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0165] The embodiment of the present invention also provides a non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), the device can execute the above Figure 1The description of the variable magnification focusing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0166] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed by the present invention. The description and examples are to be regarded as exemplary only, and the true scope and spirit of the present invention is indicated by the following claims.
[0167] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0168] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0169] The above is a detailed introduction to a video on demand method and device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A video on demand method, characterized in that: Applied to a client, the method comprises: When receiving a video-on-demand request, sending an index request to the server; the video-on-demand request carries the identifier of the target video file and video-on-demand parameters; the index request carries the identifier of the target video file; Receive a target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file; According to the target index file and the on-demand parameter, for each target frame in the target video file to be requested by the on-demand request, a corresponding data request is generated, and the data requests are sent to the server in sequence; the data request carries the position range information of the target frame in the target video file; Receive the target frame returned by the server in response to the data request.
2. The method according to claim 1, characterized in that The step of generating a corresponding data request for each target frame in the target video file to be requested by the on-demand request according to the target index file and the on-demand parameter comprises: Determine the target frame and the play order according to the on-demand parameters; Determine the position range information of each target frame in the target video file according to the index information of each target frame in the target video file contained in the target index file; Generate a data request corresponding to each target frame in the target video file in sequence according to the playback order, and fill the position range information of the target frame in the target video file in the preset field of the data request corresponding to each target frame; The sending the data request to the server in sequence includes: According to the playback order, a data request corresponding to each target frame is sent to the server in sequence.
3. The method according to claim 2, characterized in that The step of determining the target frame and the playback order according to the on-demand parameters includes: If the on-demand parameter indicates that the playback mode is normal playback, determining the playback order to be the forward order of the index information in the target index file, and determining the target frame to include every frame in the target video file; or, If the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a first timestamp, the playback order is determined to be the forward order of the index information in the target index file, and the target frame is determined to include key frames in the target video file starting from the first timestamp and in the forward order at intervals of a first number of frames; the first number of frames is determined according to the fast-forward multiple; or If the on-demand parameter indicates that the playback mode is fast-forward playback, and the on-demand parameter includes a fast-forward multiple and a second timestamp, the playback order is determined to be the reverse order of the index information in the target index file, and the target frame is determined to include key frames in the target video file starting from the second timestamp and in the reverse order at intervals of a second number of frames; the second number of frames is determined according to the fast-forward multiple; or If the on-demand parameter indicates that the playback mode is positioned playback, and the on-demand parameter includes a third timestamp, the playback order is determined to be the forward order of the index information in the target index file, and the target frame is determined to include each frame in the target video file starting from the third timestamp.
4. The method according to claim 1, characterized in that: The index information includes at least one of the following contents: frame type, frame length, offset, and timestamp.
5. The method according to claim 1, characterized in that The client supports HTTP protocol, and the data request is an HTTP request.
6. A video on demand method, characterized in that: Applied to the server, the method includes: Receiving an index request from a client; the index request carries an identifier of a target video file; Based on the identifier of the target video file, searching a preset storage medium for a target index file corresponding to the target video file, and returning the target index file to the client; the target index file includes index information of each frame in the target video file; Receive a data request from the client; the data request carries position range information of the target frame in the target video file; The target frame is read from the target video file according to the position range information in the data request, and the target frame is returned to the client.
7. The method according to claim 6, characterized in that The method further comprises: Receiving a video file uploaded from a video recording device and an index file corresponding to each video file, wherein the index file includes index information of each frame in the corresponding video file, and the index information includes at least one of the following contents: frame type, frame length, offset, and timestamp; The received video files and the index files corresponding to each video file are saved in the preset storage medium.
8. The method according to claim 6, characterized in that The server supports HTTP protocol, and the data request is an HTTP request.
9. A video-on-demand device, characterized in that: Applied to a client, the device comprises: An index request module, configured to send an index request to a server upon receiving a video-on-demand request; the video-on-demand request carries an identifier of a target video file and video-on-demand parameters; the index request carries an identifier of the target video file; A playback control module is used to receive a target index file corresponding to the target video file returned by the server in response to the index request; the target index file contains index information of each frame in the target video file; the target index file is generated synchronously when the target video file is generated, and the target index file has a corresponding relationship with the target video file; according to the target index file and the on-demand parameter, a corresponding data request is generated for each target frame in the target video file requested by the on-demand request, and the data request is sent to the server in sequence; the data request carries the position range information of the target frame in the target video file; and the target frame returned by the server in response to the data request is received.
10. A video-on-demand device, characterized in that: Applied to the server, the device comprises: An index request response module, configured to receive an index request from a client; the index request carries an identifier of a target video file; based on the identifier of the target video file, a target index file corresponding to the target video file is searched in a preset storage medium, and the target index file is returned to the client; the target index file contains index information of each frame in the target video file; A data request response module is used to receive a data request from the client; the data request carries the position range information of the target frame in the target video file; reads the target frame from the target video file according to the position range information in the data request, and returns the target frame to the client.