WO2018076952A1 - 一种视频文件的存储、定位播放方法及装置 - Google Patents

一种视频文件的存储、定位播放方法及装置 Download PDF

Info

Publication number
WO2018076952A1
WO2018076952A1 PCT/CN2017/101813 CN2017101813W WO2018076952A1 WO 2018076952 A1 WO2018076952 A1 WO 2018076952A1 CN 2017101813 W CN2017101813 W CN 2017101813W WO 2018076952 A1 WO2018076952 A1 WO 2018076952A1
Authority
WO
WIPO (PCT)
Prior art keywords
video file
frame data
file
information
storage system
Prior art date
Application number
PCT/CN2017/101813
Other languages
English (en)
French (fr)
Inventor
李海燕
许爱秋
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2018076952A1 publication Critical patent/WO2018076952A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/232Content retrieval operation locally within server, e.g. reading video streams from disk arrays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/432Content retrieval operation from a local storage medium, e.g. hard-disk
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44008Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics in the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content

Definitions

  • the present application relates to the field of video cloud storage, and in particular, to a method and device for storing, locating and playing a video file.
  • the initial positioning of video cloud storage is to store video data, usually by streaming video data generated by a front-end recording device (such as a camera) directly into a storage node of the video cloud storage.
  • a front-end recording device such as a camera
  • For directly storing streaming video data when the stored streaming video data is played later, it can only rely on a specific video playing device for decoding and playing.
  • each device sharing the video data needs to install the specific video playing device, so that the sharing of the video data has limitations.
  • video cloud storage has added a storage function for video files, that is, streaming video data is stored in the form of video files.
  • streaming video data is stored in the form of a video file
  • the video file can be stored in a variety of formats (such as AVI, WMA, RMVB, RM, FLASH, MP4, MID, 3GP, etc.).
  • formats such as AVI, WMA, RMVB, RM, FLASH, MP4, MID, 3GP, etc.
  • the embodiment of the present application discloses a method and a device for storing, locating and playing a video file, so as to realize positioning and playing of a video file in a time point manner.
  • the specific plan is as follows:
  • the embodiment of the present application provides a method for storing a video file, where the method includes:
  • the video file is stored in a cloud storage system, and the index file is stored in the cloud storage system.
  • the method further includes:
  • the method further includes:
  • Steps including:
  • the method further includes:
  • the step of storing the video file in a cloud storage system and storing the index file in the cloud storage system includes:
  • the cloud storage system adds a preset video file header to the video file when the video file is stored, where the preset video file header includes a file header identifier and the video file. Start time information and end time information of the video file, or
  • the preset video file header includes start time information of the video file and end time information of the video file.
  • the step of storing the video file into a cloud storage system and storing the index file into the cloud storage system includes:
  • the step of storing the video file in the cloud storage system in the form of the GOP package, and storing the index file in the cloud storage system includes:
  • the index file is stored to the cloud storage system.
  • the method further includes:
  • the length information is stored in the index file for each I frame data.
  • the method further includes:
  • the frame rate information is stored in the index file for each I frame data.
  • an embodiment of the present application provides a method for positioning and playing a video file, where the method includes:
  • the video file is positioned to be played from the read position.
  • the method before the step of obtaining a positioning play instruction for the video file, the method further includes:
  • the video file is determined from the cloud storage system based on the globally unique identifier URL.
  • the preset video file header includes a file header identifier, start time information of the video file, and end time information of the video file;
  • the process of determining the video file from the cloud storage system is:
  • the video file is determined in a video file to be determined, wherein the key value is a value determined according to a media access control MAC address of a device that uploads the video file.
  • the step of reading the video file from the location of the target I frame data according to the offset information includes:
  • the index file further includes length information of a group of GOP packets, where each GOP packet corresponds to I frame data and non-I frame data corresponding to the I frame data, and the non-I frame data And the data in the video file except the I frame data;
  • the step of reading the video file from the location of the target I frame data according to the offset information includes:
  • the I frame data corresponding to the predetermined reverse play rule is determined as New target I frame data, and reading the GOP packet in which the new target I frame data is located, wherein the predetermined reverse play rule is: adjacent to the current target I frame data, and in the current The rule before the timestamp information corresponding to the target I frame data.
  • the index file further includes frame rate information corresponding to each I frame data
  • the step of positioning the video file from the read position including:
  • an embodiment of the present application provides a storage device for a video file, where the device includes:
  • a first obtaining module configured to perform frame analysis on the obtained video file, obtain timestamp information corresponding to each I frame data in the video file, and offset information of each I frame data in the video file ;
  • a first generation module configured to generate an index file corresponding to the video file, where the index file includes timestamp information and offset information corresponding to each I frame data in the video file;
  • the first storage module is configured to store the video file into a cloud storage system, and store the index file into the cloud storage system.
  • the device further includes a second obtaining module, a second generating module, an information receiving module, and a third generating module;
  • the second obtaining module is configured to obtain start time information and end time information of the video file
  • the second generating module is configured to generate a key value corresponding to the video file according to a local media access control MAC address
  • the information receiving module is configured to receive storage path information about the video file sent by the cloud storage system
  • the third generating module is configured to generate a globally unique identifier URL corresponding to the video file after the step of storing the video file into a cloud storage system, where the URL carries the start Time information, end time information, the key value, and the storage path information.
  • the first obtaining module is configured to: perform frame analysis on the obtained video file, obtain each I frame data, non-I frame data corresponding to each I frame data, and each I The timestamp information corresponding to the frame data and the offset information of each I frame data in the video file, wherein the non-I frame data is data in the video file other than the I frame data;
  • the device also includes a combination module
  • the combining module is configured to combine each I frame data and the corresponding non-I frame data into a picture group GOP packet;
  • the first storage module is configured to store the video file in the cloud storage system in the form of the GOP package, and store the index file to the cloud storage system.
  • the cloud storage system adds a preset video file header to the video file when the video file is stored, where the preset video file header includes a file header identifier and the video file. Start time information and end time information of the video file, or
  • the preset video file header includes start time information of the video file and end time information of the video file.
  • the first storage module is configured to store the video file and the index file into the cloud storage system, where the video file and the index file are in the same file. The way the name is associated.
  • the first storage module includes a first storage unit, a second storage unit, and a third storage unit;
  • the first storage unit is configured to store the I frame data included in the GOP packet into the cloud storage system
  • the second storage unit is configured to store a non-I frame data group packet corresponding to the I frame data in the GOP packet to the cloud storage system, where the data volume of the non-I frame data group packet Do not exceed the data volume threshold;
  • the third storage unit is configured to store the index file to the cloud storage system.
  • the device further includes a recording module and a second storage module;
  • the recording module is configured to record, after combining the I frame data and the corresponding non-I frame data into a picture group GOP packet, record length information of each GOP packet;
  • the second storage module is configured to store the length information in the index file corresponding to each I frame data.
  • the device further includes a second obtaining module and a third storage module;
  • the second obtaining module is configured to obtain frame rate information of the video file after the step of generating an index file corresponding to the video file;
  • the third storage module is configured to store the frame rate information in the index file corresponding to each I frame data.
  • the embodiment of the present application provides a positioning and playing device for a video file, where the device includes:
  • a third obtaining module configured to obtain a positioning play instruction for the video file, where the positioning play instruction carries time information about the to-be-positioned playing of the video file;
  • a first determining module configured to determine offset information of target I frame data corresponding to the time information from an index file corresponding to the video file, where the index file includes Timestamp information corresponding to each I frame data in the video file and the number of each I frame According to the offset information in the video file;
  • a reading module configured to read the video file from a location where the target I frame data is located according to the offset information
  • the device further includes a second determining module
  • the second determining module is configured to determine the video file from a cloud storage system according to a global unique identifier URL.
  • the preset video file header includes a file header identifier, start time information of the video file, and end time information of the video file;
  • the process of determining, by the cloud storage system, the video file is:
  • the video file is determined in a video file to be determined, wherein the key value is a value determined according to a media access control MAC address of a device that uploads the video file.
  • the reading module is specifically configured to read the sequence from the position of the target I frame data according to the offset information.
  • a video file wherein the process of reading the video file in the positive sequence is:
  • the index file further includes length information of a group of GOP packets, where each GOP packet corresponds to I frame data and non-I frame data corresponding to the I frame data, and the non-I frame data And the data in the video file except the I frame data;
  • the reading module is specifically used to And reading the video file in reverse order from the location of the target I frame data according to the offset information, where the process of reading the video file in reverse order is:
  • the I frame data corresponding to the predetermined reverse play rule is determined as New target I frame data, and reading the GOP packet in which the new target I frame data is located, wherein the predetermined reverse play rule is: adjacent to the current target I frame data, and in the current The rule before the timestamp information corresponding to the target I frame data.
  • the index file further includes frame rate information corresponding to each I frame data
  • the positioning and playing module is configured to: according to the frame rate information corresponding to the target I frame data included in the index file, locate and play the video file from a location where the target I frame data is located.
  • an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
  • a memory for storing a computer program
  • the storage method of any of the video files provided by the embodiments of the present application is implemented when the processor is configured to execute a computer program stored in the memory.
  • the embodiment of the present application provides a computer program for executing a storage method of any of the video files provided by the embodiments of the present application.
  • an embodiment of the present application provides a storage medium for storing a computer program, where the computer program is executed to execute a storage method of any of the video files provided by the embodiments of the present application.
  • an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
  • a memory for storing a computer program
  • the processor when used to execute a computer program stored in the memory, implements a positioning and playing method of any of the video files provided by the embodiments of the present application.
  • the embodiment of the present application provides a computer program, which is used to perform a positioning and playing method of any of the video files provided by the embodiments of the present application.
  • the embodiment of the present application provides a storage medium, where the storage medium is used to store a computer program, and the computer program is executed to perform the positioning and playing method of any of the video files provided by the embodiments of the present application. .
  • performing frame analysis on the obtained video file obtaining timestamp information corresponding to each I frame data in the video file, and offset information of each I frame data in the video file; generating and An index file corresponding to the video file, where the index file includes timestamp information corresponding to each I frame data in the video file and offset information; storing the video file in a cloud storage system, and the index file Stored in the cloud storage system.
  • an index file corresponding to the timestamp information and the offset information corresponding to each I frame data in the video file is generated, so as to implement the point-in-time manner through the index file.
  • the video file is positioned for playback.
  • FIG. 1 is a schematic flowchart diagram of a method for storing a video file according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a file format for storing a video file in a cloud storage system
  • FIG. 3 is a schematic diagram of a storage format of an index file
  • FIG. 4 is a schematic diagram of a file format of an index file
  • FIG. 5 is a schematic flowchart of a method for positioning and playing a video file according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a video file storage device according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a positioning and playing device for a video file according to an embodiment of the present disclosure.
  • the embodiment of the present application provides a method, a device, and a device for storing, locating, and playing a video file, so as to implement positioning and playing of a video file in a time point manner.
  • a method for storing a video file provided by the embodiment of the present application is first introduced.
  • the storage method of the video file may be applied to a platform device for storing and playing video files, and the platform device may be a client, a server, and any other electronic device that can be connected to the cloud storage system.
  • the embodiment of the present application provides a method for storing a video file, which may include the following steps:
  • S101 performing frame analysis on the obtained video file, obtaining timestamp information corresponding to each I frame data in the video file, and offset information of each I frame data in the video file;
  • the video file includes a video file header and a video file data body, wherein the video file header includes global information of the video file, such as the number of streams (video or audio), the width and height of the video image, and the like.
  • the video file header (such as the first 40 bytes) of the video file is first read, and the subsequent video file data body is analyzed by using the stored global information.
  • the analysis process Obtaining timestamp information corresponding to each I frame data in the video file and offset information of each I frame data in the video file.
  • the front-end recording device such as a camera
  • the data amount of each video frame can be obtained, and thus the offset information of each I frame data in the video file can be obtained.
  • the frame analysis process may adopt related technologies, and details are not described herein.
  • the video file needs to be obtained first.
  • the user can input the storage path information of the video file in the platform device in the platform device, and the platform device can obtain the storage path information, and obtain the information from the platform device according to the storage path information.
  • Video file is a codec
  • the user may also input a video file type corresponding to the video file, so that the platform device can decode the video file in a decoding manner corresponding to the video file type.
  • S102 Generate an index file corresponding to the video file, where the index file includes timestamp information and offset information corresponding to each I frame data in the video file;
  • the timestamp information corresponding to each I frame data obtained and the offset information may be stored in the index file according to the order of the timestamp information corresponding to each I frame data.
  • the index file can be stored in a binary file format or in a normal text file format, which is ok.
  • the platform device When storing in the binary file format, the platform device does not need to perform information conversion after obtaining the information stored in the index file; when storing in a normal text file format, the platform device obtains the information stored in the index file. After the information, you need to convert the information (convert to binary).
  • the file name of the index file can be set to the file KEY+index:FileKey.index.
  • S103 Store the video file in a cloud storage system, and store the index file in a cloud storage system.
  • the platform device can store the obtained video file into the cloud storage system by calling the upload video file interface, and can store the index file into the cloud storage system by calling the upload video file interface, where The uploaded video file interface is a new interface on the cloud storage system side.
  • the platform device can call the uploaded video file interface to store video files to the cloud storage system.
  • the cloud storage system stores the video file (for example, the device uploads the video file interface by calling the third-party video file for later access and reducing the modification of the original playback interface.
  • a preset video file header is added to the stored video file, as shown in FIG. 2 .
  • the preset video file header may include a file header identifier, a start time information of the video file, and an end time information of the video file, or the preset video file header may include start time information of the video file and The end time information of the video file, and a reserved bit exists in the preset video file header to increase the subsequent information (such as the video file type, the number of video file backups, etc.).
  • the playback interface is used to provide a user with a playback function service of a video file.
  • the playback interface needs to pass the preset video.
  • the information contained in the file header is used to decode the video file.
  • the cloud storage system needs to add a preset video file header to the video file.
  • the step of storing the video file in the cloud storage system and storing the index file in the cloud storage system may include:
  • the video file and the index file are stored in a cloud storage system, wherein the video file is associated with the index file by the same file name.
  • the video file and the index file need to be associated, wherein the same file name can be used.
  • the video file and the index file may be distinguished by adding different suffixes.
  • the suffix corresponding to the video file may be set according to the video file format (eg, avi, wma, or rmvb, etc.), and the corresponding index file is The suffix can be "index".
  • the method for storing a video file may further include:
  • the method for storing the video file may further include:
  • the start time information corresponding to the video file and the end time information can be distinguished.
  • the key value of the video file may be calculated according to the MAC address of the platform device.
  • the calculation process of the key value may be performed by performing a MD5 (Message Digest Algorithm, fifth edition) operation on the MAC address of the platform device, and performing a universal unique identifier UUID encoding on the operation result; The key value corresponding to the video file.
  • MD5 Message Digest Algorithm, fifth edition
  • the cloud storage system can return a storage path for the video file to the platform device. Further, the platform device generates a URL corresponding to the video file, where the URL carries start time information, end time information, the key value, and storage path information, and the video file can be uniquely searched from the cloud storage system.
  • the start time information and the end time information of the video file are obtained, and the time axis including the time range may be correspondingly drawn and displayed in the video file play interface.
  • the time range is determined by the start time information and the end time information.
  • performing frame analysis on the obtained video file obtaining timestamp information corresponding to each I frame data in the video file, and offset of each I frame data in the video file.
  • the steps of the amount information including:
  • the step of storing the video file in the cloud storage system and storing the index file in the cloud storage system includes:
  • the video file is stored in the cloud storage system in the form of a GOP package, and the index file is stored in the cloud storage system.
  • each I frame data and the non-I frame data corresponding to the I frame data are also obtained.
  • the data between the I frame data and the previous I frame data is the former.
  • Non-I frame data corresponding to one I frame data, the previous I frame data and the corresponding non-I frame data are combined into one GOP packet, wherein the non-I frame data includes B/P frame data corresponding to the I frame data.
  • the platform device stores the video files in the form of GOP packets to the cloud storage system.
  • the cloud storage system stores the video file in chronological order, that is, the video file is stored in the order of time stamp information corresponding to the I frame data included in the video file.
  • the cloud storage system may include a management node CVM of the video cloud storage and a storage node CVS of the video cloud storage, wherein the CVM can be used for scheduling management of each CVS, and the CVS can be used for storing video files and streaming video data.
  • the cloud storage system can divide the video file into multiple data segments and store them in different CVSs, wherein each data segment stored in each CVS can start with I frame data, and each data segment contains The video data may all be complete GOP packets and stored in the order of timestamp information.
  • the step of storing the video file in the cloud storage system in the form of the GOP packet, and storing the index file in the cloud storage system includes:
  • the I frame data included in the GOP package is stored in the cloud storage system
  • the video file is stored in the cloud storage system as a GOP packet
  • the I frame data in the GOP packet is first sent to the cloud storage system, and then the non-I frame data in the GOP packet is sent to the cloud storage. system.
  • the data size of the B/P frame single frame data in the non-I frame data is between several K and 200 K. If only one frame of B/P frame data is transmitted per transmission during the transmission process, the data consumption is relatively small. Big Network resources.
  • the non-I frame data when the platform device sends the non-I frame data to the cloud storage system by uploading the video file interface, the non-I frame data needs to be sent in groups, and The stability of the network, the amount of data sent by the non-I frame data packet per time does not exceed the data volume threshold, wherein the data volume threshold can be adjusted according to the network condition, and the data volume threshold can be 512K. It should be emphasized that the I frame data is not grouped during transmission.
  • the method for storing a video file provided by the embodiment of the present application further Can include:
  • the length information is stored in the index file for each I frame data.
  • the I frame is a key frame.
  • the non-I frame data needs to be played by referring to the corresponding I frame data. Therefore, the video file needs to be explicitly located to each I frame data in the reverse playback process. And need to accurately locate each GOP packet, and then perform the reverse playback of the video file.
  • the length information of each GOP packet needs to be recorded in the index file, and the length information is stored corresponding to each I frame data.
  • the method for storing a video file may further include:
  • the frame rate information is stored in the index file for each I frame data.
  • the frame rate information is also needed in the process of playing the video file.
  • a storage format diagram of the index file is shown in FIG. 3, where a reserved bit exists in the index file for subsequent addition of other information.
  • FIG. 4 it is a schematic diagram of a file format of an index file.
  • the embodiment of the present application provides a method for positioning and playing a video file, which may include the following steps:
  • S501 Obtain a positioning play instruction for the video file, where the positioning play instruction carries time information about the to-be-positioned playback of the video file;
  • the positioning instruction for the video file is obtained by using the related technology. Subsequent positioning of the video file by time is performed according to the positioning play command.
  • the positioning play instruction may be an instruction triggered by the user by inputting a time point (a time point in the corresponding video file) that is desired to be positioned, or an instruction triggered by the user by dragging the progress bar.
  • the time stamp information of each I frame data of the corresponding video file is mapped to the progress bar.
  • S502 Determine, according to the time information, the offset information of the target I frame data corresponding to the time information from the index file corresponding to the video file, where the index file includes each I frame data corresponding to the video file. Timestamp information and offset information of each I frame data in the video file;
  • the time information of the to-be-positioned playback carried in the positioning and playing instruction, and the timestamp information corresponding to each I-frame data included in the index file are matched, and further, the offset of the corresponding target I-frame data is determined.
  • the time information corresponding to each I frame data may not completely correspond to the time information, and the offset information of the I frame data corresponding to the timestamp information closest to the time information may be determined as the target I frame data. Offset information.
  • the video file is associated with the index file by the same file name, and the index file corresponding to the video file can be directly determined by the file name.
  • the target I frame data After determining the offset information of the target I frame data from the index file, the target I frame data is located from the corresponding video file according to the offset information, and the video is read from the location of the target I frame data. file. Further, from the read position, the read video file is positioned and played.
  • the related technologies can be used for reading and playing video files, and will not be described here.
  • the positioning playback instruction carries time information about the to-be-positioned playback of the video file, and determines the time information from the index file corresponding to the video file according to the time information.
  • Offset information of the corresponding target I frame data wherein the index file includes timestamp information corresponding to each I frame data in the video file and each I
  • the offset information of the frame data in the video file according to the offset information, the video file is read from the location of the target I frame data; and the video file is located and played from the read position.
  • the video file is positioned and played in a time-point manner according to the index file.
  • the method for positioning and playing the video file provided by the embodiment of the present application may further include:
  • the video file is determined from the cloud storage system based on the global unique identifier URL.
  • the platform device calls a cloud storage API (such as a file query interface) to determine a video file from the cloud storage system according to the URL corresponding to the video file.
  • a cloud storage API such as a file query interface
  • the preset video file header includes a file header identifier, start time information of the video file, and end time information of the video file;
  • the process of determining a video file from a cloud storage system is:
  • the start time information and the end time information corresponding to the video file in the preset video file header are determined from the The video file is determined in the video file, wherein the key value is a value determined according to a media access control MAC address of the platform device.
  • the file header identifier contained in the video file header By presetting the file header identifier contained in the video file header, it is possible to identify whether the file is a video file. According to the start time information, the end time information corresponding to the video file carried in the URL, and the start time information and the end time information of the corresponding video file recorded in the preset video file header, the storage path information stored in the URL is stored. In the video file in the corresponding storage path, the corresponding video file is determined, and the accuracy of the video file is verified by using the carried key value.
  • the step of reading the video file from the location of the target I frame data according to the offset information may include:
  • the video file is read in the order from the location of the target I frame data according to the offset information, where The process of reading the video file in the positive sequence is:
  • the video file is read in the order from the location of the target I frame data according to the sequence of the timestamp information corresponding to each I frame data in the index file.
  • the time stamp information and the offset information of each I frame data in the corresponding video file are stored in the index file, and can be determined according to the sequence of time stamp information of each I frame data in the index file.
  • the reading order of each I frame data can determine the position of each I frame data in the video file by using the offset information corresponding to each I frame data, and further, the position corresponding to the target I frame data can be determined.
  • the video file is sequentially read from the location of the target I frame data.
  • the index file may further include length information of a group of GOP packets, where each GOP packet corresponds to I frame data and non-I frame data corresponding to the I frame data, and the non- The I frame data is data in the video file other than the I frame data;
  • the step of reading the video file from the location of the target I frame data according to the offset information includes:
  • the video file is read in reverse order from the location of the target I frame data according to the offset information, wherein the process of reading the video file in reverse order is:
  • the I frame data corresponding to the predetermined reverse sequence playing rule is determined to be new.
  • Target I frame data, and reading the GOP packet in which the new target I frame data is located, wherein the predetermined reverse play rule is: adjacent to the current target I frame data, and corresponding to the current target I frame data The timestamp information before the rule.
  • the non-I frame data needs to be played by referring to the corresponding I frame data.
  • the GOP packet needs to be accurately positioned, and the current target I frame data is completed when the playback is completed.
  • the GOP packet corresponding to the previous I frame data needs to be determined, and then played, the previous I frame data is adjacent to the current target I frame data, and corresponds to the current target I frame data. The timestamp information before the I frame data.
  • the cloud storage system may include a video cloud storage management node CVM and a video cloud storage storage node CVS, wherein the CVM may be used to schedule and manage each CVS, and the CVS may be used to store video files (and streaming video data). Storing video files in a cloud storage system may be The CVM scheduling is stored in different CVSs, that is, the video file is divided into a plurality of data segments and stored in different CVSs.
  • the platform device determines, according to the time information in the positioning play instruction, the offset information of the corresponding target I frame data from the index file, and the platform device queries the cloud storage API to query the CVS information of the video file through the CVM (also That is, the information is stored), and further, the corresponding content (the GOP packet in which the target I frame data is located) is read from the CVS corresponding to the CVS information.
  • playing the video file further needs to be based on the corresponding frame rate information.
  • the index file may further include frame rate information corresponding to each I frame data.
  • the step of positioning the video file from the read position including:
  • the frame rate information is stored in the information corresponding to each I frame data in the index file, and it is possible to locate and play the video file from any I frame data.
  • the embodiment of the present application provides a storage device for a video file.
  • the device may include:
  • a first obtaining module 610 configured to perform frame analysis on the obtained video file, obtain timestamp information corresponding to each I frame data in the video file, and an offset of each I frame data in the video file. information;
  • the first generation module 620 is configured to generate an index file corresponding to the video file, where the index file includes timestamp information and offset information corresponding to each I frame data in the video file;
  • the first storage module 630 is configured to store the video file into a cloud storage system, and store the index file into the cloud storage system.
  • the apparatus further includes a second obtaining module, a second generating module, an information receiving module, and a third generating module;
  • the second obtaining module is configured to obtain start time information and end time information of the video file
  • the second generating module is configured to generate a key value corresponding to the video file according to a local media access control MAC address
  • the information receiving module is configured to receive storage path information about the video file sent by the cloud storage system
  • the third generating module is configured to generate a globally unique identifier URL corresponding to the video file after the step of storing the video file into a cloud storage system, where the URL carries the start Time information, end time information, the key value, and the storage path information.
  • the first obtaining module is specifically configured to perform frame analysis on the obtained video file, and obtain each I frame data and non-I frame data corresponding to each I frame data. And time offset information corresponding to each I frame data and offset information of each I frame data in the video file, where the non-I frame data is in the video file except the I frame data.
  • the device further includes a combination module, configured to combine each I frame data and the corresponding non-I frame data into a picture group GOP packet;
  • the first storage module is configured to store the video file in the cloud storage system in the form of the GOP package, and store the index file to the cloud storage system.
  • the cloud storage system adds a preset video file header to the video file when the video file is stored, where the preset video file header includes a file header identifier and a The start time information of the video file and the end time information of the video file, or
  • the preset video file header includes start time information of the video file and the video file End time information of the piece.
  • the first storage module is specifically configured to store the video file and the index file into the cloud storage system, where the video file is the same as the index file. The way the file name is associated.
  • the first storage module includes a first storage unit, a second storage unit, and a third storage unit;
  • the first storage unit is configured to store the I frame data included in the GOP packet into the cloud storage system
  • the second storage unit is configured to store a non-I frame data group packet corresponding to the I frame data in the GOP packet to the cloud storage system, where the data volume of the non-I frame data group packet Do not exceed the data volume threshold;
  • the third storage unit is configured to store the index file to the cloud storage system.
  • the device further includes a recording module and a second storage module;
  • the recording module is configured to record, after combining the I frame data and the corresponding non-I frame data into a picture group GOP packet, record length information of each GOP packet;
  • the second storage module is configured to store the length information in the index file corresponding to each I frame data.
  • the device further includes a second obtaining module and a third storage module;
  • the second obtaining module is configured to obtain frame rate information of the video file after the step of generating an index file corresponding to the video file;
  • the third storage module is configured to store the frame rate information in the index file corresponding to each I frame data.
  • the embodiment of the present application further provides a positioning and playing device for a video file.
  • the device may include:
  • the third obtaining module 710 is configured to obtain a positioning play instruction for the video file, where the positioning play instruction carries time information about the to-be-positioned playing of the video file;
  • the first determining module 720 is configured to determine offset information of the target I frame data corresponding to the time information from the index file corresponding to the video file according to the time information, where the index file includes Timestamp information corresponding to each I frame data in the video file and offset information of each I frame data in the video file;
  • the reading module 730 is configured to read the video file from a location where the target I frame data is located according to the offset information
  • the positioning play module 740 is configured to play the video file from the read position.
  • the positioning playback instruction carries time information about the to-be-positioned playback of the video file, and determines the time information from the index file corresponding to the video file according to the time information.
  • the offset information of the corresponding target I frame data wherein the index file includes timestamp information corresponding to each I frame data in the video file and offset information of each I frame data in the video file;
  • the video file is read from the location of the target I frame data; and the video file is located and played from the read position.
  • the video file is positioned and played in a time-point manner according to the index file.
  • the apparatus further includes a second determining module
  • the second determining module is configured to determine the video file from a cloud storage system according to a global unique identifier URL.
  • the preset video file header includes a file header identifier, start time information of the video file, and end time information of the video file; the cloud storage system determines the video file. The process is:
  • the video file is determined in a video file to be determined, wherein the key value is a value determined according to a media access control MAC address of a device that uploads the video file.
  • the reading module is specifically configured to: positively sequence from the target I frame data according to the offset information Reading the video file, wherein the process of reading the video file in the positive sequence is:
  • the index file further includes length information of a group of GOP packets, where each GOP packet corresponds to I frame data and non-I frame data corresponding to the I frame data, Non-I frame data is data in the video file other than the I frame data;
  • the reading module is specifically configured to read the video file in reverse order from the location of the target I frame data according to the offset information, where The process of reading the video file in reverse order is:
  • the I frame data corresponding to the predetermined reverse play rule is determined as New target I frame data, and reading the GOP packet in which the new target I frame data is located, wherein the predetermined reverse play rule is: adjacent to the current target I frame data, and in the current The rule before the timestamp information corresponding to the target I frame data.
  • the index file further includes frame rate information corresponding to each I frame data
  • the positioning and playing module is configured to: according to the frame rate information corresponding to the target I frame data included in the index file, locate and play the video file from a location where the target I frame data is located.
  • the embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through a communication bus; Storing computer programs;
  • the method for storing a video file may include the following steps:
  • the video file is stored in a cloud storage system, and the index file is stored in the cloud storage system.
  • the processor of the electronic device runs the computer program stored in the memory to perform the storage method of the video file provided by the embodiment of the present application, so that when the video file is stored in the cloud storage system, Corresponding to generating an index file including timestamp information corresponding to each I frame data in the video file and offset information, to realize positioning and playing of the video file in a point-in-time manner through the index file.
  • the embodiment of the present application further provides a computer program, where the computer program is used to execute the storage method of any of the foregoing video files provided by the embodiments of the present application, where the method for storing the video file may include the following steps:
  • the video file is stored in a cloud storage system, and the index file is stored in the cloud storage system.
  • the computer program can execute the storage method of the video file provided by the embodiment of the present application at the time of running, so that when the video file is stored in the cloud storage system, correspondingly generating each I in the included video file is implemented.
  • the time stamp information corresponding to the frame data and the index file of the offset information are used to perform positioning and playing of the video file in a time point manner through the index file.
  • the embodiment of the present application provides a storage medium for storing a computer program, where the computer program is executed to execute any of the above video files provided by the embodiments of the present application.
  • a storage method, wherein the storage method of the video file may include the steps of:
  • the video file is stored in a cloud storage system, and the index file is stored in the cloud storage system.
  • the storage medium stores a computer program for executing the storage method of the video file provided by the embodiment of the present application at the time of running, so that when the video file is stored in the cloud storage system, the corresponding video file is generated.
  • the time stamp information corresponding to each I frame data and the index file of the offset information are used to perform positioning and playback of the video file in a time point manner through the index file.
  • the embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through a communication bus; Storing computer programs;
  • the processor when used to execute the computer program stored in the memory, implements the positioning and playing method of any of the above-mentioned video files provided by the embodiment of the present application, wherein the positioning and playing method of the video file may include the following steps:
  • the video file is positioned to be played from the read position.
  • the processor of the electronic device runs the computer program stored in the memory to perform the positioning and playing method of the video file provided by the embodiment of the present application, so that the time point can be realized according to the index file.
  • the method is to position and play the video file.
  • the embodiment of the present application further provides a computer program, where the computer program is used to perform the positioning and playing method of any of the foregoing video files provided by the embodiments of the present application, where the positioning and playing method of the video file may include the following steps. :
  • the video file is positioned to be played from the read position.
  • the computer program can perform the positioning and playing method of the video file provided by the embodiment of the present application at the time of running, so that the video file can be positioned and played in a time-point manner according to the index file.
  • the embodiment of the present application provides a storage medium for storing a computer program, where the computer program is executed to perform the positioning and playing method of any of the foregoing video files provided by the embodiments of the present application, wherein the video
  • the method for positioning the file can include the following steps:
  • the video file is positioned to be played from the read position.
  • the storage medium stores a computer program for performing the positioning and playing method of the video file provided by the embodiment of the present application at the time of running, so that the video file can be implemented in a time-point manner according to the index file. Position playback.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

本申请实施例公开了一种视频文件的存储、定位播放方法及装置,该方法包括:对所获得的视频文件进行帧分析,获得视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在视频文件中的偏移量信息;生成与该视频文件对应的索引文件,其中,索引文件中包含该视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;将该视频文件存储至云存储系统中,并将该索引文件存储至该云存储系统中。可见,将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。

Description

一种视频文件的存储、定位播放方法及装置
本申请要求于2016年10月24日提交中国专利局、申请号为201610924040.4发明名称为“一种视频文件的存储、定位播放方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及视频云存储领域,特别涉及一种视频文件的存储、定位播放方法及装置。
背景技术
视频云存储的最初定位是存储视频数据,通常是将前端录制设备(如摄像头)产生的流式视频数据直接存储到视频云存储的存储节点中。对于直接存储流式视频数据来说,在后期播放该存储的流式视频数据时,仅能依靠特定的视频播放设备进行解码播放。在一些特定场景中,如果需要进行视频数据的共享,每个共享该视频数据的设备均需安装该特定的视频播放设备,使得该视频数据的共享具有局限性。
为了解决这一问题,视频云存储增加了对视频文件的存储功能,即将流式视频数据以视频文件的形式进行存储。在将流式视频数据以视频文件的形式进行存储时,可以将视频文件存储成多种格式(如AVI、WMA、RMVB、RM、FLASH、MP4、MID及3GP等)。对于上述的视频文件格式,目前市场上主流的视频播放设备均可播放,解决了共享具有局限性的问题。
然而,对于视频文件来说,其不具备流式视频数据对应的时间属性。因此,在对视频文件进行定位播放时,仅能依赖字节偏移的方式进行定位播放,存在局限性。
发明内容
本申请实施例公开了一种视频文件的存储、定位播放方法及装置,以实现按时间点的方式对视频文件进行定位播放。具体方案如下:
一方面,本申请实施例提供了一种视频文件的存储方法,所述方法包括:
对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应 的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
可选地,所述方法还包括:
获得所述视频文件的开始时间信息以及结束时间信息;
根据本地的媒体访问控制MAC地址,生成所述视频文件对应的键值;
在所述将所述视频文件存储至云存储系统中的步骤之后,所述方法还包括:
接收所述云存储系统发送的关于所述视频文件的存储路径信息;
生成所述视频文件对应的全球唯一标识符URL,其中,所述URL中携带所述开始时间信息、结束时间信息、所述键值以及所述存储路径信息。
可选地,所述对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息的步骤,包括:
对所获得的视频文件进行帧分析,获得每个I帧数据、与所述每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息,其中,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
所述方法还包括;
将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包;
所述将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中的步骤,包括:
将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统。
可选地,所述云存储系统在存储所述视频文件时,为所述视频文件添加预设视频文件头,其中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息,或者
所述预设视频文件头中包括所述视频文件的开始时间信息和所述视频文件的结束时间信息。
可选地,所述将所述将视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中的步骤,包括:
将所述视频文件与所述索引文件存储至所述云存储系统中,其中,所述视频文件与所述索引文件以相同文件名的方式进行关联。
可选地,所述将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统的步骤中,包括:
将所述GOP包中所包括的I帧数据存储至所述云存储系统中;
将所述GOP包中与所述I帧数据对应的非I帧数据组包存储至所述云存储系统,其中,所述非I帧数据组包的数据量不超过数据量阈值;
将所述索引文件存储至所述云存储系统。
可选地,所述将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,所述方法还包括:
记录每个GOP包的长度信息;
对应每个I帧数据,将所述长度信息存储于所述索引文件中。
可选地,在所述生成与所述视频文件对应的索引文件的步骤之后,所述方法还包括:
获得所述视频文件的帧率信息;
对应每个I帧数据,将所述帧率信息存储于所述索引文件中。
第二方面,本申请实施例提供了一种视频文件的定位播放方法,所述方法包括:
获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
从所读取的位置定位播放所述视频文件。
可选地,在所述获得对视频文件的定位播放指令的步骤之前,所述方法还包括:
依据全球唯一标识符URL,从云存储系统中确定所述视频文件。
可选地,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;
所述从云存储系统确定所述视频文件的过程为:
依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文件;
依据所述预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和所述URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出所述视频文件,其中,所述键值为根据上传所述视频文件的设备的媒体访问控制MAC地址确定的值。
可选地,当所述定位播放指令为正序定位播放指令时,所述依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件的步骤,包括:
依据所述偏移量信息,从所述目标I帧数据所在位置正序读取所述视频文件,其中,所述正序读取所述视频文件的过程为:
依据所述索引文件中每个I帧数据对应的时间戳信息的先后顺序,从所述 目标I帧数据所在位置正序读取所述视频文件。
可选地,所述索引文件中还包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与所述I帧数据对应的非I帧数据,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
当所述定位播放指令为倒序定位播放指令时,所述依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件的步骤,包括:
依据所述偏移量信息,从所述目标I帧数据所在位置倒序读取所述视频文件,其中,所述倒序读取所述视频文件的过程为:
依据所对应GOP包的长度信息,从所述目标I帧数据所在位置读取完成所述目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取所述新的目标I帧数据所在的GOP包,其中,所述预定倒序播放规则为:与当前的目标I帧数据相邻的,且在所述当前的目标I帧数据对应的时间戳信息之前的规则。
可选地,所述索引文件中还包括每个I帧数据对应的帧率信息;
所述从所读取的位置定位播放所述视频文件的步骤,包括:
依据所述索引文件中包括的所述目标I帧数据对应的帧率信息,从所述目标I帧数据所在位置定位播放所述视频文件。
第三方面,本申请实施例提供了一种视频文件的存储装置,所述装置包括:
第一获得模块,用于对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
第一生成模块,用于生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
第一存储模块,用于将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
可选地,所述装置还包括第二获得模块、第二生成模块、信息接收模块和第三生成模块;
所述第二获得模块,用于获得所述视频文件的开始时间信息以及结束时间信息;
所述第二生成模块,用于根据本地的媒体访问控制MAC地址,生成所述视频文件对应的键值;
所述信息接收模块,用于接收所述云存储系统发送的关于所述视频文件的存储路径信息;
所述第三生成模块,用于在所述将所述视频文件存储至云存储系统中的步骤之后,生成所述视频文件对应的全球唯一标识符URL,其中,所述URL中携带所述开始时间信息、结束时间信息、所述键值以及所述存储路径信息。
可选地,所述第一获得模块,具体用于:对所获得的视频文件进行帧分析,获得每个I帧数据、与所述每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息,其中,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
所述装置还包括组合模块;
所述组合模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包;
所述第一存储模块,用于将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统。
可选地,所述云存储系统在存储所述视频文件时,为所述视频文件添加预设视频文件头,其中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息,或者
所述预设视频文件头中包括所述视频文件的开始时间信息和所述视频文件的结束时间信息。
可选地,所述第一存储模块,具体用于将所述视频文件与所述索引文件存储至所述云存储系统中,其中,所述视频文件与所述索引文件以相同文件 名的方式进行关联。
可选地,所述第一存储模块包括第一存储单元、第二存储单元和第三存储单元;
所述第一存储单元,用于将所述GOP包中所包括的I帧数据存储至所述云存储系统中;
所述第二存储单元,用于将所述GOP包中与所述I帧数据对应的非I帧数据组包存储至所述云存储系统,其中,所述非I帧数据组包的数据量不超过数据量阈值;
所述第三存储单元,用于将所述索引文件存储至所述云存储系统。
可选地,所述装置还包括记录模块和第二存储模块;
所述记录模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,记录每个GOP包的长度信息;
所述第二存储模块,用于对应每个I帧数据,将所述长度信息存储于所述索引文件中。
可选地,所述装置还包括第二获得模块和第三存储模块;
所述第二获得模块,用于在所述生成与所述视频文件对应的索引文件的步骤之后,获得所述视频文件的帧率信息;
所述第三存储模块,用于对应每个I帧数据,将所述帧率信息存储于所述索引文件中。
第四方面,本申请实施例提供了一种视频文件的定位播放装置,所述装置包括:
第三获得模块,用于获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
第一确定模块,用于根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数 据在所述视频文件中的偏移量信息;
读取模块,用于依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
定位播放模块,用于从所读取的位置定位播放所述视频文件。
可选地,所述装置还包括第二确定模块;
所述第二确定模块,用于依据全球唯一标识符URL,从云存储系统中确定所述视频文件。
可选地,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;
所述云存储系统确定所述视频文件的过程为:
依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文件;
依据所述预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和所述URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出所述视频文件,其中,所述键值为根据上传所述视频文件的设备的媒体访问控制MAC地址确定的值。
可选地,当所述定位播放指令为正序定位播放指令时,所述读取模块,具体用于依据所述偏移量信息,从所述目标I帧数据所在位置正序读取所述视频文件,其中,所述正序读取所述视频文件的过程为:
依据所述索引文件中每个I帧数据对应的时间戳信息的先后顺序,从所述目标I帧数据所在位置正序读取所述视频文件。
可选地,所述索引文件中还包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与所述I帧数据对应的非I帧数据,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
当所述定位播放指令为倒序定位播放指令时,所述读取模块,具体用于 依据所述偏移量信息,从所述目标I帧数据所在位置倒序读取所述视频文件,其中,所述倒序读取所述视频文件的过程为:
依据所对应GOP包的长度信息,从所述目标I帧数据所在位置读取完成所述目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取所述新的目标I帧数据所在的GOP包,其中,所述预定倒序播放规则为:与当前的目标I帧数据相邻的,且在所述当前的目标I帧数据对应的时间戳信息之前的规则。
可选地,所述索引文件中还包括每个I帧数据对应的帧率信息;
所述定位播放模块,具体用于依据所述索引文件中包括的所述目标I帧数据对应的帧率信息,从所述目标I帧数据所在位置定位播放所述视频文件。
另一方面,本申请实施例提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的计算机程序时,实现本申请实施例所提供的任一所述视频文件的存储方法。
另一方面,本申请实施例提供了一种计算机程序,所述计算机程序用于被运行以执行本申请实施例所提供的任一所述视频文件的存储方法。
另一方面,本申请实施例提供了一种存储介质,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行本申请实施例所提供的任一所述视频文件的存储方法。
另一方面,本申请实施例提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的计算机程序时,实现本申请实施例所提供的任一所述视频文件的定位播放方法。
另一方面,本申请实施例提供了一种计算机程序,所述计算机程序用于被运行以执行本申请实施例所提供的任一所述视频文件的定位播放方法。
另一方面,本申请实施例提供了一种存储介质,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行本申请实施例所提供的任一所述视频文件的定位播放方法。
在本申请实施例中,对所获得的视频文件进行帧分析,获得视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在视频文件中的偏移量信息;生成与该视频文件对应的索引文件,其中,索引文件中包含该视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;将该视频文件存储至云存储系统中,并将该索引文件存储至该云存储系统中。可见,将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。当然,实施本申请的任一产品或方法必不一定需要同时达到以上所述的所有优点。
附图说明
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种视频文件的存储方法的流程示意图;
图2为云存储系统存储视频文件的文件格式的示意图;
图3为索引文件的一种存储格式示意图;
图4为索引文件的一种文件格式示意图;
图5为本申请实施例提供的一种视频文件的定位播放方法的流程示意图;
图6为本申请实施例提供的一种视频文件的存储装置的结构示意图;
图7为本申请实施例提供的一种视频文件的定位播放装置的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例提供了一种视频文件的存储、定位播放方法及装置,以实现按时间点的方式对视频文件进行定位播放。
下面首先对本申请实施例所提供的一种视频文件的存储方法进行介绍。其中,视频文件的存储方法可以应用于关于视频文件存储、播放的平台设备,该平台设备可以是客户端、服务器以及任何其他的可以连接至云存储系统的电子设备。
如图1所示,本申请实施例提供了一种视频文件的存储方法,可以包括如下步骤:
S101:对所获得的视频文件进行帧分析,获得该视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在该视频文件中的偏移量信息;
可以理解的是,视频文件包括视频文件头以及视频文件数据体,其中,视频文件头中包含有视频文件的全局信息,如流(视频或音频)的数量、视频图像的宽和高等等。对视频文件进行帧分析时,首先读取到该视频文件的视频文件头(如前40个字节),利用其所存储的全局信息对后续的视频文件数据体进行分析,在分析过程中,获得该视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在该视频文件中的偏移量信息。可以理解的是,前端录制设备(如摄像头)在录制该视频文件的过程中,为该视频文件的每个I帧数据标记对应的时间戳信息。在帧分析过程中,可以得到每个视频帧的数据量,进而可以获得每个I帧数据在该视频文件中的偏移量信息。其中,该帧分析过程可以采用相关技术,在此不做赘述。
进一步的,对视频文件进行帧分析前,首先需要获得该视频文件。用户可以在该平台设备中输入视频文件在平台设备中的存储路径信息,该平台设备可以获得该存储路径信息,并根据该存储路径信息,从平台设备中获得该 视频文件。
另外的,用户还可以输入视频文件对应的视频文件类型,以使平台设备可以以该视频文件类型对应的解码方式解码该视频文件。
S102:生成与该视频文件对应的索引文件,其中,索引文件中包含该视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
可以按照每个I帧数据对应的时间戳信息的先后顺序,将所获得每个I帧数据对应的时间戳信息以及偏移量信息存储于索引文件中。
该索引文件可以是以二进制文件格式进行存储,也可以是以普通的文本文件格式进行存储,这都是可以的。当以二进制文件格式进行存储时,该平台设备获得该索引文件中所存储的信息后,无需再进行信息转换;当以普通的文本文件格式进行存储时,该平台设备获得该索引文件中所存储的信息后,需要进行信息转换(转换为二进制文件)。其中,举例而言:存储索引文件时,该索引文件的文件名可以设置为文件KEY+index:FileKey.index。
S103:将该视频文件存储至云存储系统中,并将该索引文件存储至云存储系统中。
需要说明的是,该平台设备可以通过调用上传视频文件接口将所获得的视频文件存储至云存储系统中,并可以通过调用上传视频文件接口将该索引文件存储至云存储系统中,其中,该上传视频文件接口为云存储系统侧的新增接口,平台设备可以调用该上传视频文件接口向云存储系统存储视频文件。
在一种具体实现方式中,云存储系统为了兼容后期接入的第三方视频文件以及减少对自身原有的回放接口的修改,云存储系统在存储视频文件(如:设备通过调用上传视频文件接口存储至云存储系统的视频文件)时,为所存储的视频文件添加了预设视频文件头,如图2所示。其中,该预设视频文件头中可以包括文件头标识符、该视频文件的开始时间信息和该视频文件的结束时间信息,或者该预设视频文件头中可以包括该视频文件的开始时间信息和该视频文件的结束时间信息,该预设视频文件头中存在保留位,以进行后续的信息(如:视频文件类型、视频文件备份数量等等)的增加。该回放接口用于为用户提供视频文件的回放功能服务。该回放接口需要通过该预设视频 文件头所包含的信息,对视频文件进行解码。为了减少对原有的回放接口的修改,本申请实施例中,云存储系统在存储视频文件时,需要为该视频文件添加预设视频文件头。
在一种具体实现方式中,所述将视频文件存储至云存储系统中,并将该索引文件存储至云存储系统中的步骤,可以包括:
将该视频文件与该索引文件存储至云存储系统中,其中,该视频文件与该索引文件以相同文件名的方式进行关联。
可以理解的是,由于视频文件与索引文件之间存在对应关系,在将视频文件与索引文件存储至云存储系统中时,需要对该视频文件与索引文件进行关联,其中,可以以相同文件名的方式进行关联。进一步的,还可以以添加不同的后缀的方式进行视频文件与索引文件的区分,例如:视频文件对应的后缀可以根据视频文件格式设置(如:avi、wma或rmvb等),对应的索引文件的后缀可以为“index”。
应用本申请实施例,对所获得的视频文件进行帧分析,获得视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在视频文件中的偏移量信息;生成与该视频文件对应的索引文件,其中,索引文件中包含该视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;将该视频文件存储至云存储系统中,并将该索引文件存储至该云存储系统中。可见,将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。
在一种具体实现方式中,本申请实施例所提供的一种视频文件的存储方法还可以包括:
获得该视频文件的开始时间信息以及结束时间信息;
根据本地的媒体访问控制MAC地址,生成该视频文件对应的键值;
在所述将视频文件存储至云存储系统中的步骤之后,本申请实施例所提供的一种视频文件的存储方法还可以包括:
接收云存储系统发送的关于视频文件的存储路径信息;
生成该视频文件对应的全球唯一标识符URL,其中,该URL中携带开始时间信息、结束时间信息、该键值以及存储路径信息。
可以理解的是,对于本地所存储的视频文件,也就是上述的平台设备所存储的视频文件,可以通过视频文件对应的开始时间信息与结束时间信息进行区分。进一步的,由于本地的MAC地址存在唯一性,即由于平台设备的MAC地址存在唯一性,为了保证该视频文件的唯一性,可以根据平台设备的MAC地址计算该视频文件的键值。其中,对于该键值的计算过程可以为对平台设备的MAC地址进行MD5(Message Digest Algorithm,消息摘要算法第五版)运算,并对运算结果进行通用唯一标识符UUID编码;将编码所得结果确定为该视频文件对应的键值。
为了保证用户能够准确的查找到该视频文件,在将视频文件存储于云存储系统后,该云存储系统可以向平台设备返回关于该视频文件的存储路径。进而,平台设备生成视频文件对应的URL,其中,该URL中携带开始时间信息、结束时间信息、该键值以及存储路径信息,通过该URL可以唯一的从云存储系统中查找到该视频文件。
另外的,获得该视频文件的开始时间信息以及结束时间信息,可以在视频文件播放界面中对应描绘出包含该时间范围的时间轴,进行展示。其中,时间范围通过开始时间信息以及结束时间信息确定。
在一种具体实现方式中,所述对所获得的视频文件进行帧分析,获得该视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息的步骤,包括:
对所获得的视频文件进行帧分析,获得每个I帧数据、与该每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在该视频文件中的偏移量信息,其中,该非I帧数据为该视频文件中除该I帧数据外的数据;
本申请实施例所提供的一种视频文件的存储方法还可以包括;
将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包;
所述将该视频文件存储至云存储系统中,并将该索引文件存储至云存储系统中的步骤,包括:
将该视频文件以GOP包的形式存储至云存储系统中,并将该索引文件存储至云存储系统。
在进行帧分析过程中,还可以获得每个I帧数据以及I帧数据对应的非I帧数据,当分析出I帧数据后,该I帧数据与前一个I帧数据之间的数据为前一个I帧数据对应的非I帧数据,该前一个I帧数据与所对应的非I帧数据组合成一个GOP包,其中,该非I帧数据包括I帧数据对应的B/P帧数据。平台设备将视频文件以GOP包的形式存储至云存储系统。
云存储系统按时间顺序存储该视频文件,即按视频文件中所包含的I帧数据对应的时间戳信息的先后顺序,存储该视频文件。可以理解的是,云存储系统中可以包含视频云存储的管理节点CVM和视频云存储的存储节点CVS,其中,CVM可以用于调度管理各CVS,CVS可以用于存储视频文件以及流式视频数据。云存储系统可以将视频文件分成多个数据段,存储于不同的CVS中,其中,每个CVS中所存储的每个数据段可以均以I帧数据开始,并且每个数据段中所包含的视频数据可以均是完整的GOP包,且按时间戳信息的先后顺序存储。
在一种具体实现方式中,所述将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统的步骤中,包括:
将GOP包中所包括的I帧数据存储至云存储系统中;
将GOP包中与该I帧数据对应的非I帧数据组包存储至云存储系统,其中,该非I帧数据组包的数据量不超过数据量阈值;
将该索引文件存储至云存储系统。
需要说明的是,在将视频文件以GOP包的形式存储至云存储系统时,首先将GOP包中的I帧数据发送至云存储系统,然后再发送GOP包中的非I帧数据至云存储系统。一般的,非I帧数据中的B/P帧单帧数据的数据量大小在几K至200K之间,如果在发送过程中,每次发送仅发送一帧B/P帧数据,会消耗较大 的网络资源。因此,为了减少对网络资源的消耗,在本申请实施例中,当平台设备通过上传视频文件接口向云存储系统发送非I帧数据时,需要对非I帧数据进行组包发送,并且为了保证网络的稳定性,每次发送非I帧数据组包的数据量不超过数据量阈值,其中,该数据量阈值可以根据网络状况进行调整,该数据量阈值可以为512K。需要强调的是,在发送过程中并不对I帧数据进行组包。
在一种具体实现方式中,所述将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,本申请实施例所提供的一种视频文件的存储方法还可以包括:
记录每个GOP包的长度信息;
对应每个I帧数据,将长度信息存储于索引文件中。
可以理解的是,I帧为关键帧,在后续的播放视频文件时,非I帧数据均需要参照对应I帧数据才能播放,因此,视频文件在倒序播放过程需要明确定位到每一个I帧数据,并且需要精确定位到每个GOP包,进而进行视频文件的倒序播放。为了更好的实现GOP包的定位,该索引文件中还需要记录每个GOP包的长度信息,并将该长度信息对应每个I帧数据进行存储。
在一种具体实现方式中,在所述生成与所述视频文件对应的索引文件的步骤之后,本申请实施例所提供的一种视频文件的存储方法还可以包括:
获得该视频文件的帧率信息;
对应每个I帧数据,将帧率信息存储于索引文件中。
可以理解的是,在播放视频文件过程中还需要依据帧率信息。为了保证在倒序播放视频文件过程中,视频文件的正确播放,还需要获得该视频文件的帧率信息,对应每个I帧数据存储于索引文件中。其中,索引文件的一种存储格式示意图如图3所示,其中,该索引文件中存在保留位,用于后续的增加其他信息。如图4所示,为索引文件的文件格式的一种示意图。
如图5所示,本申请实施例提供了一种视频文件的定位播放方法,可以包括如下步骤:
S501:获得对视频文件的定位播放指令,其中,该定位播放指令中携带关于视频文件的待定位播放的时间信息;
利用相关技术获得对视频文件的定位播放指令。后续的根据该定位播放指令对视频文件进行按时间点的定位播放。其中,该定位播放指令可以是用户通过输入某一希望定位播放的时间点(对应的视频文件中的时间点),而触发的指令;或者是用户通过拖动进度条而触发的指令。其中,该进度条中映射有对应的视频文件的各I帧数据的时间戳信息。
S502:根据时间信息,从视频文件对应的索引文件中,确定该时间信息对应的目标I帧数据的偏移量信息,其中,该索引文件中包括该视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在该视频文件中的偏移量信息;
可以理解的是,匹配定位播放指令中所携带的待定位播放的时间信息,以及索引文件中包括的每个I帧数据对应的时间戳信息,进而,确定对应的目标I帧数据的偏移量信息。其中,该时间信息与每个I帧数据对应的时间戳信息可能不完全对应,可以将与该时间信息最相近的时间戳信息对应的I帧数据的偏移量信息,确定为目标I帧数据的偏移量信息。其中,该视频文件与该索引文件通过相同文件名进行关联,可以直接通过文件名确定出与视频文件对应的索引文件。
S503:依据该偏移量信息,从目标I帧数据所在位置读取该视频文件;
S504:从所读取的位置定位播放该视频文件。
从索引文件中确定出目标I帧数据的偏移量信息后,根据该偏移量信息从对应的视频文件中定位到该目标I帧数据,并从目标I帧数据所在位置开始读取该视频文件。进而,从所读取的位置,定位播放所读取的视频文件。其中,读取和播放视频文件均可以采用相关技术,在此不做赘述。
应用本申请实施例,获得对视频文件的定位播放指令,该定位播放指令中携带关于该视频文件的待定位播放的时间信息;根据时间信息,从视频文件对应的索引文件中,确定该时间信息对应的目标I帧数据的偏移量信息,其中,索引文件中包括该视频文件中的每个I帧数据对应的时间戳信息以及每个I 帧数据在该视频文件中的偏移量信息;依据该偏移量信息,从目标I帧数据所在位置读取视频文件;从所读取的位置定位播放该视频文件。以依据该索引文件实现按时间点的方式对视频文件进行定位播放。
在一种具体实现方式中,在所述获得对视频文件的定位播放指令的步骤之前,本申请实施例所提供的一种视频文件的定位播放方法还可以包括:
依据全球唯一标识符URL,从云存储系统中确定视频文件。
平台设备依据视频文件对应的URL,调用云存储API(如:文件查询接口)从云存储系统中确定视频文件。
进一步的,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;
所述从云存储系统确定视频文件的过程为:
依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文件;
依据该预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出该视频文件,其中,该键值为根据平台设备的媒体访问控制MAC地址确定的值。
通过预设视频文件头中所包含的文件头标识符,可以识别出文件是否为视频文件。根据该URL中所携带的视频文件对应的开始时间信息、结束时间信息,以及预设视频文件头中记录的对应视频文件的开始时间信息以及结束时间信息,从存储于该URL携带的存储路径信息对应的存储路径中的视频文件中,确定出对应的视频文件,并利用所携带的键值检验该视频文件的准确性。
在一种具体实现方式中,当所述定位播放指令为正序定位播放指令时,所述依据偏移量信息,从该目标I帧数据所在位置读取该视频文件的步骤,可以包括:
依据偏移量信息,从该目标I帧数据所在位置正序读取该视频文件,其中, 该正序读取该视频文件的过程为:
依据该索引文件中每个I帧数据对应的时间戳信息的先后顺序,从该目标I帧数据所在位置正序读取该视频文件。
可以理解的是,索引文件中存储有对应的视频文件中的每个I帧数据的时间戳信息以及偏移量信息,依据索引文件中每个I帧数据的时间戳信息的先后顺序,可以确定每个I帧数据的读取顺序,通过每个I帧数据对应的偏移量信息,可以确定每个I帧数据在视频文件中的位置,进而,可以确定出目标I帧数据对应的位置,从目标I帧数据所在位置依次读取该视频文件。
在一种具体实现方式中,所述索引文件中还可以包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与该I帧数据对应的非I帧数据,该非I帧数据为该视频文件中除该I帧数据外的数据;
当所述定位播放指令为倒序定位播放指令时,所述依据偏移量信息,从该目标I帧数据所在位置读取该视频文件的步骤,包括:
依据偏移量信息,从该目标I帧数据所在位置倒序读取视频文件,其中,该倒序读取视频文件的过程为:
依据所对应GOP包的长度信息,从该目标I帧数据所在位置读取完成该目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取该新的目标I帧数据所在的GOP包,其中,该预定倒序播放规则为:与当前的目标I帧数据相邻的,且在该当前的目标I帧数据对应的时间戳信息之前的规则。
由于I帧为关键帧,在播放视频文件时,非I帧数据需要参照对应I帧数据才能播放,当倒序定位播放视频文件时,需要精确定位到GOP包,当播放完成当前的目标I帧数据对应的GOP包后,需要确定出前一个I帧数据对应的GOP包,进而进行播放,该前一个I帧数据为与当前的目标I帧数据相邻的,且在该当前的目标I帧数据对应的时间戳信息之前的I帧数据。
其中,云存储系统中可以包含视频云存储管理节点CVM和视频云存储存储节点CVS,其中,该CVM可以用于调度管理各CVS,该CVS可以用于存储视频文件(以及流式视频数据)。在云存储系统存储视频文件,可能会被 CVM调度存储至不同的CVS中,即该视频文件被分成多个数据段分别存储于不同的CVS中。平台设备根据定位播放指令中的时间信息,从索引文件中确定出对应的目标I帧数据的偏移量信息后,平台设备通过调度云存储API通过CVM查询出存储该视频文件的CVS信息(也就是存储信息),进而,从该CVS信息对应的CVS中读取对应的内容(目标I帧数据所在GOP包)。
在一种具体实现方式中,播放视频文件还需要依据对应的帧率信息,具体的,所述索引文件中还可以包括每个I帧数据对应的帧率信息;
所述从所读取的位置定位播放所述视频文件的步骤,包括:
依据该索引文件中包括的该目标I帧数据对应的帧率信息,从该目标I帧数据所在位置定位播放该视频文件。
可以理解的是,索引文件中针对每个I帧数据对应的信息中,均存储有帧率信息,从任一I帧数据定位播放该视频文件,都是可以的。
相应于上述方法实施例,本申请实施例提供了一种视频文件的存储装置,如图6所示,所述装置可以包括:
第一获得模块610,用于对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
第一生成模块620,用于生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
第一存储模块630,用于将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
应用本申请实施例,对所获得的视频文件进行帧分析,获得视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在视频文件中的偏移量信息;生成与该视频文件对应的索引文件,其中,索引文件中包含该视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;将该视频文件存储至云存储系统中,并将该索引文件存储至该云存储系统中。可见,将视频文件存储至 云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。
在一种具体实现方式中,所述装置还包括第二获得模块、第二生成模块、信息接收模块和第三生成模块;
所述第二获得模块,用于获得所述视频文件的开始时间信息以及结束时间信息;
所述第二生成模块,用于根据本地的媒体访问控制MAC地址,生成所述视频文件对应的键值;
所述信息接收模块,用于接收所述云存储系统发送的关于所述视频文件的存储路径信息;
所述第三生成模块,用于在所述将所述视频文件存储至云存储系统中的步骤之后,生成所述视频文件对应的全球唯一标识符URL,其中,所述URL中携带所述开始时间信息、结束时间信息、所述键值以及所述存储路径信息。
在一种具体实现方式中,所述第一获得模块,具体用于:对所获得的视频文件进行帧分析,获得每个I帧数据、与所述每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息,其中,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
所述装置还包括组合模块;所述组合模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包;
所述第一存储模块,用于将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统。
在一种具体实现方式中,所述云存储系统在存储所述视频文件时,为所述视频文件添加预设视频文件头,其中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息,或者
所述预设视频文件头中包括所述视频文件的开始时间信息和所述视频文 件的结束时间信息。
在一种具体实现方式中,所述第一存储模块,具体用于将所述视频文件与所述索引文件存储至所述云存储系统中,其中,所述视频文件与所述索引文件以相同文件名的方式进行关联。
在一种具体实现方式中,所述第一存储模块包括第一存储单元、第二存储单元和第三存储单元;
所述第一存储单元,用于将所述GOP包中所包括的I帧数据存储至所述云存储系统中;
所述第二存储单元,用于将所述GOP包中与所述I帧数据对应的非I帧数据组包存储至所述云存储系统,其中,所述非I帧数据组包的数据量不超过数据量阈值;
所述第三存储单元,用于将所述索引文件存储至所述云存储系统。
在一种具体实现方式中,所述装置还包括记录模块和第二存储模块;
所述记录模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,记录每个GOP包的长度信息;
所述第二存储模块,用于对应每个I帧数据,将所述长度信息存储于所述索引文件中。
在一种具体实现方式中,所述装置还包括第二获得模块和第三存储模块;
所述第二获得模块,用于在所述生成与所述视频文件对应的索引文件的步骤之后,获得所述视频文件的帧率信息;
所述第三存储模块,用于对应每个I帧数据,将所述帧率信息存储于所述索引文件中。
相应于上述方法实施例,本申请实施例还提供了一种视频文件的定位播放装置,如图7所示,所述装置可以包括:
第三获得模块710,用于获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
第一确定模块720,用于根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
读取模块730,用于依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
定位播放模块740,用于从所读取的位置定位播放所述视频文件。
应用本申请实施例,获得对视频文件的定位播放指令,该定位播放指令中携带关于该视频文件的待定位播放的时间信息;根据时间信息,从视频文件对应的索引文件中,确定该时间信息对应的目标I帧数据的偏移量信息,其中,索引文件中包括该视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在该视频文件中的偏移量信息;依据该偏移量信息,从目标I帧数据所在位置读取视频文件;从所读取的位置定位播放该视频文件。以依据该索引文件实现按时间点的方式对视频文件进行定位播放。
在一种具体实现方式中,所述装置还包括第二确定模块;
所述第二确定模块,用于依据全球唯一标识符URL,从云存储系统中确定所述视频文件。
在一种具体实现方式中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;所述云存储系统确定所述视频文件的过程为:
依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文件;
依据所述预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和所述URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出所述视频文件,其中,所述键值为根据上传所述视频文件的设备的媒体访问控制MAC地址确定的值。
在一种具体实现方式中,当所述定位播放指令为正序定位播放指令时,所述读取模块,具体用于依据所述偏移量信息,从所述目标I帧数据所在位置正序读取所述视频文件,其中,所述正序读取所述视频文件的过程为:
依据所述索引文件中每个I帧数据对应的时间戳信息的先后顺序,从所述目标I帧数据所在位置正序读取所述视频文件。
在一种具体实现方式中,所述索引文件中还包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与所述I帧数据对应的非I帧数据,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
当所述定位播放指令为倒序定位播放指令时,所述读取模块,具体用于依据所述偏移量信息,从所述目标I帧数据所在位置倒序读取所述视频文件,其中,所述倒序读取所述视频文件的过程为:
依据所对应GOP包的长度信息,从所述目标I帧数据所在位置读取完成所述目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取所述新的目标I帧数据所在的GOP包,其中,所述预定倒序播放规则为:与当前的目标I帧数据相邻的,且在所述当前的目标I帧数据对应的时间戳信息之前的规则。
在一种具体实现方式中,所述索引文件中还包括每个I帧数据对应的帧率信息;
所述定位播放模块,具体用于依据所述索引文件中包括的所述目标I帧数据对应的帧率信息,从所述目标I帧数据所在位置定位播放所述视频文件。
本申请实施例还提供了一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的计算机程序时,实现本申请实施例所提供的任一上述的视频文件的存储方法,其中,该视频文件的存储方法可以包括步骤:
对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应 的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
应用本申请实施例,该电子设备的处理器运行存储器中存储的计算机程序,以执行本申请实施例所提供的视频文件的存储方法,因此能够实现:将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。
本申请实施例还提供了一种计算机程序,所述计算机程序用于被运行以执行本申请实施例所提供的任一上述的视频文件的存储方法,其中视频文件的存储方法可以包括步骤:
对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
应用本申请实施例,可计算机程序在运行时执行本申请实施例所提供的视频文件的存储方法,因此能够实现:将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。
本申请实施例提供了一种存储介质,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行本申请实施例所提供的任一上述的视频文件的 存储方法,其中,视频文件的存储方法可以包括步骤:
对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
应用本申请实施例,存储介质存储有在运行时执行本申请实施例所提供的视频文件的存储方法的计算机程序,因此能够实现:将视频文件存储至云存储系统中时,对应生成包含视频文件中每个I帧数据对应的时间戳信息以及偏移量信息的索引文件,以通过该索引文件实现按时间点的方式对视频文件进行定位播放。
本申请实施例还提供了一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的计算机程序时,实现本申请实施例所提供的任一上述的视频文件的定位播放方法,其中,该视频文件的定位播放方法可以包括步骤:
获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
从所读取的位置定位播放所述视频文件。
应用本申请实施例,该电子设备的处理器运行存储器中存储的计算机程序,以执行本申请实施例所提供的视频文件的定位播放方法,因此能够实现:以依据该索引文件实现按时间点的方式对视频文件进行定位播放。
本申请实施例还提供了一种计算机程序,所述计算机程序用于被运行以执行本申请实施例所提供的任一上述的视频文件的定位播放方法,其中视频文件的定位播放方法可以包括步骤:
获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
从所读取的位置定位播放所述视频文件。
应用本申请实施例,可计算机程序在运行时执行本申请实施例所提供的视频文件的定位播放方法,因此能够实现:以依据该索引文件实现按时间点的方式对视频文件进行定位播放。
本申请实施例提供了一种存储介质,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行本申请实施例所提供的任一上述的视频文件的定位播放方法,其中,视频文件的定位播放方法可以包括步骤:
获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中 的偏移量信息;
依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
从所读取的位置定位播放所述视频文件。
应用本申请实施例,存储介质存储有在运行时执行本申请实施例所提供的视频文件的定位播放方法的计算机程序,因此能够实现:以依据该索引文件实现按时间点的方式对视频文件进行定位播放。
对于系统/装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本领域普通技术人员可以理解实现上述方法实施方式中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于计算机可读取存储介质中,这里所称得的存储介质,如:ROM/RAM、磁碟、光盘等。
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。

Claims (34)

  1. 一种视频文件的存储方法,其特征在于,所述方法包括:
    对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
    生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
    将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    获得所述视频文件的开始时间信息以及结束时间信息;
    根据本地的媒体访问控制MAC地址,生成所述视频文件对应的键值;
    在所述将所述视频文件存储至云存储系统中的步骤之后,所述方法还包括:
    接收所述云存储系统发送的关于所述视频文件的存储路径信息;
    生成所述视频文件对应的全球唯一标识符URL,其中,所述URL中携带所述开始时间信息、结束时间信息、所述键值以及所述存储路径信息。
  3. 根据权利要求1所述的方法,其特征在于,所述对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息的步骤,包括:
    对所获得的视频文件进行帧分析,获得每个I帧数据、与所述每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息,其中,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
    所述方法还包括;
    将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包;
    所述将所述视频文件存储至云存储系统中,并将所述索引文件存储至所 述云存储系统中的步骤,包括:
    将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述云存储系统在存储所述视频文件时,为所述视频文件添加预设视频文件头,其中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息,或者
    所述预设视频文件头中包括所述视频文件的开始时间信息和所述视频文件的结束时间信息。
  5. 根据权利要求1-3任一项所述的方法,其特征在于,所述将所述将视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中的步骤,包括:
    将所述视频文件与所述索引文件存储至所述云存储系统中,其中,所述视频文件与所述索引文件以相同文件名的方式进行关联。
  6. 根据权利要求3所述的方法,其特征在于,所述将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统的步骤中,包括:
    将所述GOP包中所包括的I帧数据存储至所述云存储系统中;
    将所述GOP包中与所述I帧数据对应的非I帧数据组包存储至所述云存储系统,其中,所述非I帧数据组包的数据量不超过数据量阈值;
    将所述索引文件存储至所述云存储系统。
  7. 根据权利要求3所述的方法,其特征在于,所述将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,所述方法还包括:
    记录每个GOP包的长度信息;
    对应每个I帧数据,将所述长度信息存储于所述索引文件中。
  8. 根据权利要求3所述的方法,其特征在于,在所述生成与所述视频文 件对应的索引文件的步骤之后,所述方法还包括:
    获得所述视频文件的帧率信息;
    对应每个I帧数据,将所述帧率信息存储于所述索引文件中。
  9. 一种视频文件的定位播放方法,其特征在于,所述方法包括:
    获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
    根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
    依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
    从所读取的位置定位播放所述视频文件。
  10. 根据权利要求9所述的方法,其特征在于,在所述获得对视频文件的定位播放指令的步骤之前,所述方法还包括:
    依据全球唯一标识符URL,从云存储系统中确定所述视频文件。
  11. 根据权利要求10所述的方法,其特征在于,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;
    所述从云存储系统确定所述视频文件的过程为:
    依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文件;
    依据所述预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和所述URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出所述视频文件,其中,所述键值为根据上传所述视频文件的设备的媒体访问控制MAC地址确 定的值。
  12. 根据权利要求9所述的方法,其特征在于,当所述定位播放指令为正序定位播放指令时,所述依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件的步骤,包括:
    依据所述偏移量信息,从所述目标I帧数据所在位置正序读取所述视频文件,其中,所述正序读取所述视频文件的过程为:
    依据所述索引文件中每个I帧数据对应的时间戳信息的先后顺序,从所述目标I帧数据所在位置正序读取所述视频文件。
  13. 根据权利要求9所述的方法,其特征在于,所述索引文件中还包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与所述I帧数据对应的非I帧数据,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
    当所述定位播放指令为倒序定位播放指令时,所述依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件的步骤,包括:
    依据所述偏移量信息,从所述目标I帧数据所在位置倒序读取所述视频文件,其中,所述倒序读取所述视频文件的过程为:
    依据所对应GOP包的长度信息,从所述目标I帧数据所在位置读取完成所述目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取所述新的目标I帧数据所在的GOP包,其中,所述预定倒序播放规则为:与当前的目标I帧数据相邻的,且在所述当前的目标I帧数据对应的时间戳信息之前的规则。
  14. 根据权利要求9所述的方法,其特征在于,所述索引文件中还包括每个I帧数据对应的帧率信息;
    所述从所读取的位置定位播放所述视频文件的步骤,包括:
    依据所述索引文件中包括的所述目标I帧数据对应的帧率信息,从所述目标I帧数据所在位置定位播放所述视频文件。
  15. 一种视频文件的存储装置,其特征在于,所述装置包括:
    第一获得模块,用于对所获得的视频文件进行帧分析,获得所述视频文件中每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
    第一生成模块,用于生成与所述视频文件对应的索引文件,其中,所述索引文件中包含所述视频文件中的每个I帧数据对应的时间戳信息以及偏移量信息;
    第一存储模块,用于将所述视频文件存储至云存储系统中,并将所述索引文件存储至所述云存储系统中。
  16. 根据权利要求15所述的装置,其特征在于,所述装置还包括第二获得模块、第二生成模块、信息接收模块和第三生成模块;
    所述第二获得模块,用于获得所述视频文件的开始时间信息以及结束时间信息;
    所述第二生成模块,用于根据本地的媒体访问控制MAC地址,生成所述视频文件对应的键值;
    所述信息接收模块,用于接收所述云存储系统发送的关于所述视频文件的存储路径信息;
    所述第三生成模块,用于在所述将所述视频文件存储至云存储系统中的步骤之后,生成所述视频文件对应的全球唯一标识符URL,其中,所述URL中携带所述开始时间信息、结束时间信息、所述键值以及所述存储路径信息。
  17. 根据权利要求15所述的装置,其特征在于,所述第一获得模块,具体用于:对所获得的视频文件进行帧分析,获得每个I帧数据、与所述每个I帧数据对应的非I帧数据、每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息,其中,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
    所述装置还包括组合模块;
    所述组合模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组 GOP包;
    所述第一存储模块,用于将所述视频文件以所述GOP包的形式存储至所述云存储系统中,并将所述索引文件存储至所述云存储系统。
  18. 根据权利要求15-17任一项所述的装置,其特征在于,所述云存储系统在存储所述视频文件时,为所述视频文件添加预设视频文件头,其中,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息,或者
    所述预设视频文件头中包括所述视频文件的开始时间信息和所述视频文件的结束时间信息。
  19. 根据权利要求15-17任一项所述的装置,其特征在于,所述第一存储模块,具体用于将所述视频文件与所述索引文件存储至所述云存储系统中,其中,所述视频文件与所述索引文件以相同文件名的方式进行关联。
  20. 根据权利要求17所述的装置,其特征在于,所述第一存储模块包括第一存储单元、第二存储单元和第三存储单元;
    所述第一存储单元,用于将所述GOP包中所包括的I帧数据存储至所述云存储系统中;
    所述第二存储单元,用于将所述GOP包中与所述I帧数据对应的非I帧数据组包存储至所述云存储系统,其中,所述非I帧数据组包的数据量不超过数据量阈值;
    所述第三存储单元,用于将所述索引文件存储至所述云存储系统。
  21. 根据权利要求17所述的装置,其特征在于,所述装置还包括记录模块和第二存储模块;
    所述记录模块,用于将每个I帧数据与所对应的非I帧数据,组合成画面组GOP包的步骤之后,记录每个GOP包的长度信息;
    所述第二存储模块,用于对应每个I帧数据,将所述长度信息存储于所述索引文件中。
  22. 根据权利要求17所述的装置,其特征在于,所述装置还包括第二获得模块和第三存储模块;
    所述第二获得模块,用于在所述生成与所述视频文件对应的索引文件的步骤之后,获得所述视频文件的帧率信息;
    所述第三存储模块,用于对应每个I帧数据,将所述帧率信息存储于所述索引文件中。
  23. 一种视频文件的定位播放装置,其特征在于,所述装置包括:
    第三获得模块,用于获得对视频文件的定位播放指令,其中,所述定位播放指令中携带关于所述视频文件的待定位播放的时间信息;
    第一确定模块,用于根据所述时间信息,从所述视频文件对应的索引文件中,确定所述时间信息对应的目标I帧数据的偏移量信息,其中,所述索引文件中包括所述视频文件中的每个I帧数据对应的时间戳信息以及每个I帧数据在所述视频文件中的偏移量信息;
    读取模块,用于依据所述偏移量信息,从所述目标I帧数据所在位置读取所述视频文件;
    定位播放模块,用于从所读取的位置定位播放所述视频文件。
  24. 根据权利要求23所述的装置,其特征在于,所述装置还包括第二确定模块;
    所述第二确定模块,用于依据全球唯一标识符URL,从云存储系统中确定所述视频文件。
  25. 根据权利要求24所述的装置,其特征在于,所述预设视频文件头中包括文件头标识符、所述视频文件的开始时间信息和所述视频文件的结束时间信息;
    所述云存储系统确定所述视频文件的过程为:
    依据预设视频文件头中所包含的文件头标识符,筛选出待确定的视频文 件;
    依据所述预设视频文件头中的视频文件对应的开始时间信息以及结束时间信息,和所述URL中所携带的视频文件对应的开始时间信息、结束时间信息、键值以及存储路径信息,从待确定的视频文件中确定出所述视频文件,其中,所述键值为根据上传所述视频文件的设备的媒体访问控制MAC地址确定的值。
  26. 根据权利要求23所述的装置,其特征在于,当所述定位播放指令为正序定位播放指令时,所述读取模块,具体用于依据所述偏移量信息,从所述目标I帧数据所在位置正序读取所述视频文件,其中,所述正序读取所述视频文件的过程为:
    依据所述索引文件中每个I帧数据对应的时间戳信息的先后顺序,从所述目标I帧数据所在位置正序读取所述视频文件。
  27. 根据权利要求23所述的装置,其特征在于,所述索引文件中还包括画面组GOP包的长度信息,其中,每个GOP包对应包含I帧数据以及与所述I帧数据对应的非I帧数据,所述非I帧数据为所述视频文件中除所述I帧数据外的数据;
    当所述定位播放指令为倒序定位播放指令时,所述读取模块,具体用于依据所述偏移量信息,从所述目标I帧数据所在位置倒序读取所述视频文件,其中,所述倒序读取所述视频文件的过程为:
    依据所对应GOP包的长度信息,从所述目标I帧数据所在位置读取完成所述目标I帧数据所在的GOP包后,将对应时间戳信息满足预定倒序播放规则的I帧数据,确定为新的目标I帧数据,并读取所述新的目标I帧数据所在的GOP包,其中,所述预定倒序播放规则为:与当前的目标I帧数据相邻的,且在所述当前的目标I帧数据对应的时间戳信息之前的规则。
  28. 根据权利要求23所述的装置,其特征在于,所述索引文件中还包括每个I帧数据对应的帧率信息;
    所述定位播放模块,具体用于依据所述索引文件中包括的所述目标I帧数据对应的帧率信息,从所述目标I帧数据所在位置定位播放所述视频文件。
  29. 一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
    存储器,用于存放计算机程序;
    处理器,用于执行存储器上所存放的计算机程序时,实现权利要求1-8任一项所述的视频文件的存储方法。
  30. 一种计算机程序,其特征在于,所述计算机程序用于被运行以执行权利要求1-8任一项所述的视频文件的存储方法。
  31. 一种存储介质,其特征在于,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行权利要求1-8任一项所述的视频文件的存储方法。
  32. 一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
    存储器,用于存放计算机程序;
    处理器,用于执行存储器上所存放的计算机程序时,实现权利要求9-14任一项所述的视频文件的定位播放方法。
  33. 一种计算机程序,其特征在于,所述计算机程序用于被运行以执行权利要求9-14任一项所述的视频文件的定位播放方法。
  34. 一种存储介质,其特征在于,所述存储介质用于存储计算机程序,所述计算机程序被运行以执行权利要求9-14任一项所述的视频文件的定位播放方法。
PCT/CN2017/101813 2016-10-24 2017-09-15 一种视频文件的存储、定位播放方法及装置 WO2018076952A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610924040.4A CN107979621A (zh) 2016-10-24 2016-10-24 一种视频文件的存储、定位播放方法及装置
CN201610924040.4 2016-10-24

Publications (1)

Publication Number Publication Date
WO2018076952A1 true WO2018076952A1 (zh) 2018-05-03

Family

ID=62004806

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/101813 WO2018076952A1 (zh) 2016-10-24 2017-09-15 一种视频文件的存储、定位播放方法及装置

Country Status (2)

Country Link
CN (1) CN107979621A (zh)
WO (1) WO2018076952A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086457A (zh) * 2018-09-05 2018-12-25 华南理工大学 一种分布式视频帧随机读取的元数据服务系统及工作方法
CN111436004A (zh) * 2019-01-11 2020-07-21 腾讯科技(深圳)有限公司 视频播放方法、装置和设备、计算机可读存储介质
CN111475676A (zh) * 2020-04-07 2020-07-31 深圳市超高清科技有限公司 视频数据处理方法、系统、装置、设备及可读存储介质
CN113934883A (zh) * 2021-10-13 2022-01-14 北京图安世纪科技股份有限公司 一种多类型数据同步回放展示方法与装置
CN115171241A (zh) * 2022-06-30 2022-10-11 南京领行科技股份有限公司 一种视频帧定位方法、装置、电子设备及存储介质
CN117093541A (zh) * 2023-08-18 2023-11-21 北京天华星航科技有限公司 一种遥感数据的数据提取和归档系统
WO2024103886A1 (zh) * 2022-11-17 2024-05-23 中兴通讯股份有限公司 文件存储方法、数据加载方法及相关设备

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110460790A (zh) * 2018-05-02 2019-11-15 北京视联动力国际信息技术有限公司 一种视频帧的抽取方法和装置
CN108717458A (zh) * 2018-05-24 2018-10-30 昆明联诚科技股份有限公司 一种用于监控行业的历史视频文件格式存储方法及系统
CN109327680A (zh) * 2018-09-21 2019-02-12 北京世纪东方国铁科技股份有限公司 多路视频数据并发存储及读取方法
CN111246240A (zh) * 2018-11-29 2020-06-05 杭州海康威视系统技术有限公司 存储媒体数据的方法和装置
CN109788372B (zh) * 2019-01-24 2021-06-08 维沃移动通信有限公司 一种流媒体的播放方法及相关装置
CN109951665A (zh) * 2019-03-18 2019-06-28 浙江大华技术股份有限公司 视频数据的存储方法、装置、存储介质及电子装置
CN111866549B (zh) * 2019-04-29 2023-03-24 腾讯科技(深圳)有限公司 一种视频处理方法及装置、终端、存储介质
CN111954082B (zh) * 2019-05-17 2023-03-24 上海哔哩哔哩科技有限公司 蒙版文件结构、蒙版文件的读取方法、计算机设备及可读存储介质
CN112449209B (zh) * 2019-08-29 2022-06-10 中移物联网有限公司 视频存储方法、装置、云服务器及计算机可读存储介质
CN112491937A (zh) * 2019-09-11 2021-03-12 北京陌陌信息技术有限公司 数据传输方法、装置、设备及存储介质
CN111125425A (zh) * 2019-12-13 2020-05-08 浪潮电子信息产业股份有限公司 一种视频数据的读写方法、系统、装置及可读存储介质
CN111405288A (zh) * 2020-03-19 2020-07-10 北京字节跳动网络技术有限公司 视频抽帧方法、装置、电子设备及计算机可读存储介质
CN112380165A (zh) * 2020-11-09 2021-02-19 北京电子工程总体研究所 一种检索记录数据文件的方法
CN112492345B (zh) * 2020-11-25 2023-03-24 深圳创维数字技术有限公司 音视频存储方法、系统、终端和计算机可读存储介质
CN112423140A (zh) * 2020-12-16 2021-02-26 富盛科技股份有限公司 视频播放方法、装置、电子设备和存储介质
CN112948332B (zh) * 2021-03-04 2023-07-21 北京奇艺世纪科技有限公司 一种点云文件封装、解析方法及装置
CN113596518B (zh) * 2021-08-13 2022-04-08 北京中电兴发科技有限公司 一种用于提升倍速播放性能的视频存取方法
CN113867632A (zh) * 2021-09-23 2021-12-31 恒睿(重庆)人工智能技术研究院有限公司 云视频识别方法、设备及计算机存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1873820A (zh) * 2006-05-18 2006-12-06 北京中星微电子有限公司 视频文件处理方法、视频索引方法和视频索引装置
CN101366026A (zh) * 2005-10-12 2009-02-11 索尼爱立信移动通讯股份有限公司 处理电子装置的媒体内容
US20110246603A1 (en) * 2008-09-05 2011-10-06 The Chinese University Of Hong Kong Methods and devices for live streaming using pre-indexed file formats
CN102761773A (zh) * 2012-07-03 2012-10-31 Ut斯达康通讯有限公司 一种利用i帧改善iptv业务的用户体验的方法
CN105847825A (zh) * 2015-01-16 2016-08-10 杭州海康威视数字技术股份有限公司 视频编码码流的编码、索引存储和访问方法及相应装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101366026A (zh) * 2005-10-12 2009-02-11 索尼爱立信移动通讯股份有限公司 处理电子装置的媒体内容
CN1873820A (zh) * 2006-05-18 2006-12-06 北京中星微电子有限公司 视频文件处理方法、视频索引方法和视频索引装置
US20110246603A1 (en) * 2008-09-05 2011-10-06 The Chinese University Of Hong Kong Methods and devices for live streaming using pre-indexed file formats
CN102761773A (zh) * 2012-07-03 2012-10-31 Ut斯达康通讯有限公司 一种利用i帧改善iptv业务的用户体验的方法
CN105847825A (zh) * 2015-01-16 2016-08-10 杭州海康威视数字技术股份有限公司 视频编码码流的编码、索引存储和访问方法及相应装置

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086457A (zh) * 2018-09-05 2018-12-25 华南理工大学 一种分布式视频帧随机读取的元数据服务系统及工作方法
CN111436004A (zh) * 2019-01-11 2020-07-21 腾讯科技(深圳)有限公司 视频播放方法、装置和设备、计算机可读存储介质
CN111475676A (zh) * 2020-04-07 2020-07-31 深圳市超高清科技有限公司 视频数据处理方法、系统、装置、设备及可读存储介质
CN111475676B (zh) * 2020-04-07 2023-03-24 深圳市超高清科技有限公司 视频数据处理方法、系统、装置、设备及可读存储介质
CN113934883A (zh) * 2021-10-13 2022-01-14 北京图安世纪科技股份有限公司 一种多类型数据同步回放展示方法与装置
CN115171241A (zh) * 2022-06-30 2022-10-11 南京领行科技股份有限公司 一种视频帧定位方法、装置、电子设备及存储介质
CN115171241B (zh) * 2022-06-30 2024-02-06 南京领行科技股份有限公司 一种视频帧定位方法、装置、电子设备及存储介质
WO2024103886A1 (zh) * 2022-11-17 2024-05-23 中兴通讯股份有限公司 文件存储方法、数据加载方法及相关设备
CN117093541A (zh) * 2023-08-18 2023-11-21 北京天华星航科技有限公司 一种遥感数据的数据提取和归档系统
CN117093541B (zh) * 2023-08-18 2024-02-23 北京天华星航科技有限公司 一种遥感数据的数据提取和归档系统

Also Published As

Publication number Publication date
CN107979621A (zh) 2018-05-01

Similar Documents

Publication Publication Date Title
WO2018076952A1 (zh) 一种视频文件的存储、定位播放方法及装置
US7941554B2 (en) Sparse caching for streaming media
US8886896B2 (en) Storage format for media streams
JP6920578B2 (ja) 映像ストリーミング装置、映像編集装置および映像配信システム
WO2015035942A1 (en) Method for playing back live video and device
KR101037263B1 (ko) 세션 기술 메시지 확장
CN107231581B (zh) 用于视频播放的方法、系统及流媒体播放控制服务器
US20160066007A1 (en) Video playback method, media device, playback device, and multimedia system
US10476928B2 (en) Network video playback method and apparatus
WO2017092327A1 (zh) 一种播放方法及装置
US10230812B1 (en) Dynamic allocation of subtitle packaging
WO2005059694A2 (en) Method and apparatus for buffering streaming media
JP2014532338A (ja) ストリーミングメディアを伝送するための方法およびデバイス
US9237363B2 (en) Dynamic injection of metadata into flash video
US11315604B2 (en) Thumbnail video player for video scrubbing
CN108810575B (zh) 一种发送目标视频的方法和装置
US11622164B2 (en) System and method for streaming video/s
CN110072123A (zh) 一种视频的恢复播放方法、视频播放终端及服务器
JP6397341B2 (ja) 受信装置、バッファ管理方法、及びプログラム
US20170329831A1 (en) System and method for analyzing content usage events
US10354695B2 (en) Data recording control device and data recording control method
Chernyshev Library for Remote Copying of Video File Fragments
US20150088943A1 (en) Media-Aware File System and Method
CN115103222A (zh) 一种视频音轨处理方法及相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17863760

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17863760

Country of ref document: EP

Kind code of ref document: A1