WO2020228128A1 - 一种用于存储流媒体数据的方法、装置、存储介质 - Google Patents

一种用于存储流媒体数据的方法、装置、存储介质 Download PDF

Info

Publication number
WO2020228128A1
WO2020228128A1 PCT/CN2019/096562 CN2019096562W WO2020228128A1 WO 2020228128 A1 WO2020228128 A1 WO 2020228128A1 CN 2019096562 W CN2019096562 W CN 2019096562W WO 2020228128 A1 WO2020228128 A1 WO 2020228128A1
Authority
WO
WIPO (PCT)
Prior art keywords
media data
streaming media
file block
file
index
Prior art date
Application number
PCT/CN2019/096562
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 WO2020228128A1 publication Critical patent/WO2020228128A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files

Definitions

  • the present disclosure relates to the field of data storage, and in particular to a method, device, and storage medium for storing streaming media data.
  • Video storage service is a very important part in the application of streaming media technology.
  • the method of creating new streaming media files and deleting old streaming media files is used to realize the cyclic storage of storage space.
  • disk fragmentation will increase, leading to disk reads.
  • the writing efficiency is reduced and the disk life is shortened.
  • the traditional storage method by file does not support cross-file, arbitrary jump progress and fast playback according to time in the process of stored data retrieval and playback.
  • the embodiments of the present disclosure disclose a use Methods, devices, and storage media for storing streaming media data.
  • the present disclosure proposes a method for storing streaming media data, including the following steps:
  • S2 Select a suitable file block to store streaming media data, and at the same time mark the selected file block as occupied, and establish an index between the stored streaming media data and the number of seconds of storage time;
  • step S2 includes the following steps:
  • S21 Select a file block according to the file size of the streaming media data, and record the number of the file block and the offset of the streaming media data in the file block;
  • S24 Convert the storage time of the streaming media data into seconds, and record the file block number selected by the streaming media data, the offset of the streaming media data in the file block, and the offset of the key frame in the streaming media data To the second index information corresponding to the number of seconds.
  • step S21 specifically includes: when the file size of the streaming media data is less than or equal to the remaining space of the file block, storing the streaming media data in the current file block, and when the file size of the streaming media data is larger than the file block size With the remaining space, the streaming media data is stored in the next file block of the current file block. Therefore, a suitable file block can be selected for storage according to the size of the streaming media data, and the full use of the file block space can be effectively realized.
  • step S22 specifically includes: judging whether the streaming media data corresponding to any one second is a key frame or a non-key frame, if it is a key frame, recording the offset of the key frame in the streaming media data, if it is not Key frame, record the offset of the previous key frame of the non-key frame in the streaming media data.
  • the time index file is created in units of days, and the index information at the time of initialization is marked as an invalid index. Through the time index file, the position of the streaming media data in the file block can be quickly located.
  • step S3 includes the following steps:
  • S31 Input the read start date and time and end date and time, and judge whether the corresponding time index file can be obtained according to the start date, if yes, proceed to the next step, if not, end;
  • S32 Convert the start time to the Nth second, locate the second index information of the Nth second in the time index file corresponding to the start date, and determine whether the second index information of the Nth second is a valid index, and if so, proceed as follows One step, if not, end;
  • S35 Repeat the steps of S31-S34 for the next second and end after the end time is exceeded.
  • the file block is configured to store streaming media data containing at least 1 GOP size
  • the streaming media data is stored in the file block in chronological order
  • the location of the file block corresponding to the deleted streaming media data is marked as Idle state. Therefore, storing and deleting streaming media data in file blocks can solve the problem of disk fragmentation caused by the cyclic storage of storage space, and realize the extension of disk life.
  • the present disclosure also proposes a device for storing streaming media data, including:
  • the storage module is configured to fill the storage space with pre-created fixed-size file blocks
  • the index module is configured to select a suitable file block to store streaming media data, and at the same time mark the selected file block as occupied, and establish an index between the stored streaming media data and the number of seconds of storage time;
  • the positioning module is configured to use the index to locate the location of the stored streaming media data.
  • the index module includes:
  • the number index module is configured to select the file block according to the file size of the streaming media data, and record the number of the file block and the offset of the streaming media data in the file block;
  • the key frame index module is configured to determine the offset in the streaming media data of the key frame corresponding to any second in the storage time
  • the index file module is configured to create a time index file and create second index information in time seconds;
  • the index generation module is configured to convert the storage time of the streaming media data into seconds, and the file block number selected by the streaming media data, the offset of the streaming media data in the file block, and the key frame in the streaming media data The offset of is recorded in the second index information corresponding to the number of seconds.
  • the numbering index module is configured to store the streaming media data in the current file block when the file size of the streaming media data is less than or equal to the remaining space of the file block.
  • the file size of the streaming media data is larger than the file block If the remaining space is left, the streaming media data is stored in the next file block of the current file block.
  • the key frame index module is configured to determine whether the streaming media data corresponding to any one second is a key frame or a non-key frame, and if it is a key frame, record the offset of the key frame in the streaming media data, If it is a non-key frame, record the offset of the previous key frame of the non-key frame in the streaming media data.
  • the time index file is created in units of days, and the index information at the time of initialization is marked as an invalid index.
  • the positioning module includes:
  • the time index file positioning module is configured to input the read start date and time and end date and time, and judge whether the corresponding time index file can be obtained according to the start date, if yes, proceed to the next step, if not, end;
  • the second index information positioning module is configured to convert the start time into the Nth second, locate the second index information of the Nth second in the time index file corresponding to the start date, and determine whether the second index information of the Nth second is valid Index, if yes, proceed to the next step, if no, end;
  • the file block positioning module is configured to read the second index information of the Nth second, and determine whether the second index information of the Nth second has a file block displaying a specified number, if yes, proceed to the next step, if not, end;
  • the key frame positioning module is configured to read the key frame according to the offset of the streaming media data in the file block in the file block of the specified number in the second index information of the Nth second, and pass the key frame in the streaming media data Offset to read streaming media data;
  • the repeat module is configured to repeat the steps performed by the above module for the next second and end after the end time is exceeded.
  • embodiments of the present disclosure provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method as described in any implementation manner in the first aspect is implemented.
  • the embodiment of the present disclosure discloses a method for storing streaming media data.
  • the storage space is filled with a fixed-size file block created in advance; and a suitable file block is selected to store the streaming media data, and the selected The file block is marked as occupied, and an index between the stored streaming media data and the number of seconds of storage time is established; finally, the index is used to locate the location of the stored streaming media data.
  • Streaming media is stored in file blocks for storage and deletion, which can effectively solve the disk fragmentation problem caused by the storage space circular storage in the process of streaming media data storage, extend the life of the disk, and achieve the purpose of improving disk usage efficiency.
  • the present disclosure also proposes a fast indexing method of time and streaming media data, which realizes fast retrieval of streaming media data and arbitrary jump and playback according to time, and improves the efficiency of streaming media video retrieval and positioning.
  • FIG. 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure can be applied
  • FIG. 2 is a schematic flowchart of a method for storing streaming media data according to an embodiment of the disclosure
  • step S2 of the method for storing streaming media data according to an embodiment of the present disclosure
  • step S3 is a schematic flowchart of step S3 of the method for storing streaming media data according to an embodiment of the disclosure
  • FIG. 5 is a schematic diagram of an apparatus for storing streaming media data according to an embodiment of the disclosure
  • Fig. 6 is a schematic structural diagram of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure.
  • FIG. 1 shows an exemplary system architecture 100 of a method for storing streaming media data or a device for storing streaming media data to which embodiments of the present disclosure can be applied.
  • the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105.
  • the network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105.
  • the network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables.
  • the user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages and so on.
  • Various applications may be installed on the terminal devices 101, 102, 103, such as data processing applications, file processing applications, and so on.
  • the terminal devices 101, 102, and 103 may be hardware or software.
  • the terminal devices 101, 102, and 103 may be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and so on.
  • the terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or as a single software or software module. There is no specific limitation here.
  • the server 105 may be a server that provides various services, for example, a background data processing server that processes files or data uploaded by the terminal devices 101, 102, and 103.
  • the background data processing server may process the acquired file or data to generate a processing result (for example, a standard file containing the standard header line and the data contained in the corresponding segment).
  • the method for storing streaming media data may be executed by the server 105, or may be executed by the terminal devices 101, 102, 103, and accordingly, the device for storing streaming media data may It is set in the server 105, and may also be set in the terminal devices 101, 102, 103.
  • terminal devices, networks, and servers in FIG. 1 are merely illustrative. According to implementation needs, there can be any number of terminal devices, networks and servers.
  • the above system architecture may not include a network, but only a server or terminal device.
  • FIG. 2 it shows a process 200 applied to an embodiment of storing streaming media data according to the present disclosure.
  • the method includes the following steps:
  • S1 Fill the storage space with a fixed-size file block created in advance.
  • the size of the created file block can store at least 1 GOP size of streaming media data, and the streaming media data is stored in the file block in chronological order.
  • the streaming media data storage process there is no need to create new files. Only need to find the free file block, and overwrite the streaming media data into the file block.
  • the file block is not deleted directly, but the location of the corresponding file block is marked as an idle state after the streaming media data is deleted. Therefore, during the entire storage process, no new file blocks are created or deleted, which effectively avoids the generation of disk fragments and prolongs the life of the disk.
  • the use of file block storage does not require the use of conventional database systems, but is directly based on storage space.
  • the file block may be stored in a preset storage area.
  • the foregoing storage area may be various types of storage areas, including but not limited to: cache, memory, hard disk, etc.
  • the size of the file block is 128M.
  • the file block can store the streaming media data of multiple GOPs.
  • the size of the streaming media data of each GOP is much smaller than the size of the file block, so the file block is stored
  • the size of the file block can also be other suitable sizes, as long as the location where the streaming media data is stored in the file block can be located, that is to say, the streaming media data can be used in the The offset in the file block to get the location of the streaming media data.
  • S2 Select an appropriate file block to store the streaming media data, and mark the selected file block as occupied and establish an index between the stored streaming media data and the number of seconds of storage time.
  • step S2 may complete the process of step S2 according to the following steps:
  • S21 Select a file block according to the file size of the streaming media data, and record the number of the file block and the offset of the streaming media data in the file block. Specifically, when streaming media data is stored in a file block, first compare the size between the file of the streaming media data and the remaining space in the file block selected for storage. When the file size of the streaming media data is less than or equal to the remaining space of the file block Space, the streaming media data is stored in the current file block. When the file size of the streaming media data is larger than the remaining space of the file block, the streaming media data is stored in the next file block of the current file block. Therefore, a suitable file block can be selected for storage according to the size of the streaming media data, which effectively realizes the full use of the file block space and effectively improves the utilization rate of the storage space.
  • S22 Determine the offset in the streaming media data of the key frame corresponding to any second of the storage time; specifically, determine whether the streaming media data corresponding to any second is a key frame or a non-key frame, if it is a key frame, Record the offset of the key frame in the streaming media data, if it is a non-key frame, record the offset of the previous key frame of the non-key frame in the streaming media data.
  • the normal playback of the streaming media data can be realized, and by accurately finding the key frame corresponding to any second in the storage time, the streaming media data can be quickly located to perform the playback without having to The beginning of the streaming media data is played to the corresponding number of seconds to quickly realize the second-level positioning and progress jump of the streaming media data.
  • S23 Create a time index file, and create second index information in time seconds; specifically, the time index file is created in units of days, and the time and second index information is initialized as an invalid index.
  • the time index file is created in the unit of days.
  • the time index file is named after the date.
  • the minimum time unit of the time index file is seconds.
  • Each device has a time index file every day, one second index information per second, and a time index file has a total of 24* 3600 second index information, each second index information points to the file block number where the streaming media data corresponding to the second is located, the offset of the streaming media data in the file block, and the offset of the key frame in the streaming media data. Therefore, the position of streaming media data in the file block can be quickly located by the second index information in the time index file.
  • S24 Convert the storage time of the streaming media data into seconds, and record the file block number selected by the streaming media data, the offset of the streaming media data in the file block, and the offset of the key frame in the streaming media data To the second index information corresponding to the number of seconds. Specifically, if the streaming media data stored at 12:38:24 on January 1, 2019 is stored, it will be converted to the 45504 second data stored in the appropriate file block, and January 1, 2019 will be obtained. The second index information corresponding to the 45504 second in the time index file created on the day. At this time, the second index information corresponding to the 45504 second stores the file block number where the corresponding streaming media data is located, and the offset of the streaming media data in the file block. The amount of shift, the offset of the key frame in the streaming media data.
  • step S3 may complete the process of step S3 according to the following steps:
  • S31 Input the read start date and time and end date and time, and judge whether the corresponding time index file can be obtained according to the start date, if yes, proceed to the next step, if not, end. Specifically, the reading time starts from the selected start date and time and ends at the selected end date and time. Choosing an appropriate reading time can choose to realize cross-file, jump progress and fast playback according to time.
  • S32 Convert the start time to the Nth second, locate the second index information of the Nth second in the time index file corresponding to the start date, and determine whether the second index information of the Nth second is a valid index, and if so, proceed as follows One step, if not, end. If the second index information of the Nth second is a valid index, it means that the position information of the corresponding streaming media data in the file block is stored in the second index information. For example, if the start date and time are 12:38:24 on January 1, 2019, search for the second index information corresponding to the 45504 second in the time index file created on January 1, 2019, and read the corresponding to the 45504 second Second index information to obtain the location information of the streaming media data stored in the 45504 second.
  • S33 Read the second index information of the Nth second, and judge whether the second index information of the Nth second has a file block displaying the designated number, if yes, proceed to the next step, if not, end.
  • the stream media data stored in the 45504 second is in the file block number 6.
  • the streaming media data stored in the 45504 second is in the file block number 6, and the streaming media data stored in the 45504 second has an offset of 12 bytes in the file block, and the offset of the key frame in the streaming data The amount is 16 bytes, and accordingly, the specific position of the streaming media data in the file block is located, and even the key frame of the streaming media data is located for playing the streaming media data.
  • S35 Repeat the steps of S31-S34 for the next second and end after the end time is exceeded.
  • the above process is adopted to read one by one according to the number of time seconds, or it can be read at a certain time point.
  • the present disclosure provides an embodiment of a device for storing streaming media data.
  • the device embodiment corresponds to the method embodiment shown in FIG. 2 ,
  • the device can be specifically applied to various electronic equipment.
  • the apparatus 500 for storing streaming media data of this embodiment includes: a storage module 501 configured to fill the storage space with a fixed-size file block created in advance; and an indexing module 502 configured to Select the appropriate file block to store the streaming media data and mark the selected file block as occupied and establish an index between the stored streaming media data and the number of seconds of storage time; the positioning module 503 is configured to use the index to locate The location of the stored streaming media data.
  • the above-mentioned index module 501 specifically includes: a numbered index module configured to select file blocks according to the file size of the streaming media data, and record the number of the file block and the offset of the streaming media data in the file block. Specifically, the number index module is used to determine when the file size of the streaming media data is less than or equal to the remaining space of the file block, then the streaming media data is stored in the current file block, and when the file size of the streaming media data is greater than the remaining space of the file block , The streaming media data is stored in the next file block of the current file block.
  • the key frame index module is configured to determine the offset in the streaming media data of the key frame corresponding to any second of the storage time.
  • the key frame index module is configured to determine whether the streaming media data corresponding to any one second is a key frame or a non-key frame. If it is a key frame, record the offset of the key frame in the streaming media data. If it is a non-key frame, then Record the offset of the previous key frame of the non-key frame in the streaming data.
  • the index file module is configured to create a time index file and create second index information in time seconds.
  • the time index file is used to create a time index file in units of days, and the initialization time and second index information is marked as an invalid index. Therefore, each day's time index file can create 86400 seconds of index information.
  • the index generation module is configured to convert the storage time of the streaming media data into seconds, and the file block number selected by the streaming media data, the offset of the streaming media data in the file block, and the key frame in the streaming media data The offset of is recorded in the second index information corresponding to the number of seconds.
  • the positioning module 503 includes:
  • the time index file positioning module is configured to input the read start date and time and end date and time, and judge whether the corresponding time index file can be obtained according to the start date, if yes, proceed to the next step, if not, end;
  • the second index information positioning module is configured to convert the start time into the Nth second, locate the second index information of the Nth second in the time index file corresponding to the start date, and determine whether the second index information of the Nth second is valid Index, if yes, proceed to the next step, if no, end;
  • the file block positioning module is configured to read the second index information of the Nth second, and determine whether the second index information of the Nth second has a file block displaying a specified number, if yes, proceed to the next step, if not, end;
  • the key frame positioning module is configured to read the key frame according to the offset of the streaming media data in the file block in the file block of the specified number in the second index information of the Nth second, and pass the key frame in the streaming media data Offset to read streaming media data;
  • the repeat module is configured to repeat the steps performed by the above module for the next second and end after the end time is exceeded.
  • FIG. 6 shows a schematic structural diagram of a computer system 600 suitable for implementing an electronic device (such as the server or terminal device shown in FIG. 1) of an embodiment of the present disclosure.
  • the electronic device shown in FIG. 6 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the computer system 600 includes a central processing unit (CPU) 601, which can be based on a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603 And perform various appropriate actions and processing.
  • the RAM 603 also stores various programs and data required for the operation of the system 600.
  • the CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604.
  • the following components are connected to the I/O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a LAN card
  • the communication section 609 performs communication processing via a network such as the Internet.
  • the driver 610 can also be connected to the I/O interface 605 as needed.
  • a removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that the computer program read from it is installed into the storage part 608 as needed.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication part 609, and/or installed from the removable medium 611.
  • the central processing unit (CPU) 601 the above-mentioned functions defined in the method of the present disclosure are executed.
  • the computer-readable medium described in the present disclosure may be a computer-readable signal medium or a computer-readable medium, or any combination of the two.
  • the computer-readable medium may be, for example, but not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable Read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable medium, and the computer-readable medium may send, propagate or transmit the program for use by or in combination with the instruction execution system, apparatus, or device.
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
  • the computer program code used to perform the operations of the present disclosure can be written in one or more programming languages or a combination thereof.
  • the programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user’s computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider for example, using an Internet service provider to pass Internet connection.
  • each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the modules involved in the embodiments described in the present disclosure can be implemented in software or hardware.
  • the described modules may also be provided in the processor.
  • a processor includes a storage module 501, an index module 502, and a positioning module 503.
  • the names of these modules do not constitute a limitation on the module itself under certain circumstances.
  • the storage module 501 can also be described as "a module that divides storage space into fixed-size file blocks for storage".
  • the present disclosure also provides a computer-readable medium.
  • the computer-readable medium may be included in the electronic device described in the above-mentioned embodiment; or it may exist alone without being assembled into the electronic device. in.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the electronic device fills up the storage space with a fixed-size file block created in advance; and selects the appropriate The file block is used to store the streaming media data, and the selected file block is marked as occupied, and an index between the stored streaming media data and the number of seconds of storage time is established; finally, the index is used to locate the stored streaming media The location of the data.
  • Streaming media is stored in file blocks for storage and deletion, which can effectively solve the disk fragmentation problem caused by the storage space circular storage in the process of streaming media data storage, extend the life of the disk, and achieve the purpose of improving disk usage efficiency.
  • the present disclosure also proposes a fast indexing method for time and streaming media data, which realizes fast retrieval of streaming media data and arbitrary jump and playback according to time, and improves the efficiency of streaming media video retrieval and positioning.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

公开了一种用于存储流媒体数据的方法,包括以下步骤:S1:利用预先创建的固定大小的文件块将存储空间填满;S2:选择合适的文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;以及S3:利用索引来定位所存储的流媒体数据所在的位置。流媒体数据存储在文件块中进行存储和删除,可以有效解决流媒体数据存储过程中存储空间循环存储带来的磁盘碎片问题,实现磁盘寿命的延长,并达到提高磁盘使用效率的目的。并可以实现流媒体数据的快速检索以及按时间任意跳转和回放,提高流媒体数据检索和定位的效率。

Description

一种用于存储流媒体数据的方法、装置、存储介质
相关申请
本申请要求保护在2019年5月16日提交的申请号为201910407291.9的中国专利申请的优先权,该申请的全部内容以引用的方式结合到本文中。
技术领域
本公开涉及数据存储领域,具体涉及一种用于存储流媒体数据的方法、装置、存储介质。
背景技术
随着网络技术的不断发展,数字信号处理、图像压缩等技术的逐渐进步,视音频应用得到蓬勃发展,视音频监控技术发展经历了从模拟到数字的转换,作为视音频监控最关键功能录像存储也经历了前端存储到后端集中存储的发展过程。因此视音频的流媒体数据的存储需求越来越大,特别是在视频监控领域,存在大量摄像机拍摄的视音频数据需要进行长时间存储和检索回放,因此要求流媒体数据可以实现高效、稳定的存储和读取。
视频存储服务是流媒体技术应用中非常重要的一环。在传统的流媒体数据存储实现采用循环创建新流媒体文件并删除旧流媒体文件的方式,实现对存储空间的循环存储,在循环创建文件和删除文件过程中会导致磁盘碎片增加,导致磁盘读写效率下降和磁盘使用寿命缩短。同时,传统的按文件存储方式,在存储数据检索和回放过程不支持跨文件、按时间任意跳转进度和快速回放。
因此提出一种新型的流媒体数据存储方法,来解决流媒体数据存储过程中存储空间循环存储带来的磁盘碎片以及流媒体数据无法快速定位回放等问题是至关重要的。
公开内容
针对上述流媒体数据存储过程中存储空间循环存储带来的磁盘碎片、磁盘寿命短、磁盘使用效率低、流媒体数据无法快速定位以及跳转回放等问题,本公开的实施例公开了一种用于存储流媒体数据的方法、装置、存储介质。
第一方面,本公开提出了一种用于存储流媒体数据的方法,包括以下步骤:
S1:利用预先创建的固定大小的文件块将存储空间填满;
S2:选择合适的文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;
S3:利用索引来定位所存储的流媒体数据所在的位置。
在一些实施例中,步骤S2包括以下步骤:
S21:根据流媒体数据的文件大小选择文件块,并记录文件块的编号以及流媒体数据在文件块中的偏移量;
S22:确定存储时间中的任一秒所对应的关键帧在流媒体数据中的偏移量;
S23:创建时间索引文件,并以时间秒数建立秒索引信息;
S24:将流媒体数据的存储时间转换为秒数,并将流媒体数据所选择的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量记录到秒数对应的秒索引信息中。
在一些实施例中,步骤S21具体包括:当流媒体数据的文件大小小于或等于文件块的剩余空间,则将流媒体数据存储在当前文件块中,当流媒体数据的文件大小大于文件块的剩余空间,则将流媒体数据存储在当前文件块的下一个文件块中。因此可以根据流媒体数据的大小选择合适的文件块进行存储,有效实现文件块空间的充分利用。
在一些实施例中,步骤S22具体包括:判断任一秒所对应的流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下关键帧在流媒体数据中的偏移量,若是非关键帧,则记录下非关键帧的前一个关键帧在流媒体数据中的偏移量。通过确认流媒体数据中关键帧的位置,可以有效实现流媒体数据的播放。
在一些实施例中,时间索引文件以天为单位建立,初始化时秒索引信息标记为无效索引。通过时间索引文件可以实现流媒体数据在文件块中位置的快速定位。
在一些实施例中,步骤S3包括以下步骤:
S31:输入读取的开始日期和时间以及结束日期和时间,根据开始日期判断是否能获得对应的时间索引文件,若是,则进行下一步,若否,则结束;
S32:将开始时间转换成第N秒,在开始日期所对应的时间索引文件中定位到第N秒的秒索引信息,并判断第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束;
S33:读取第N秒的秒索引信息,判断第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束;
S34:在第N秒的秒索引信息中指定编号的文件块中,通过流媒体数据在文件块中的偏 移量读取关键帧,通过关键帧在流媒体数据中的偏移量读取流媒体数据;
S35:对下一秒重复S31-S34的步骤并截止到超出结束时间后结束。
在一些实施例中,文件块被配置为存储至少包含1个GOP大小的流媒体数据,流媒体数据以时间顺序存储在文件块中,被删除后的流媒体数据所对应的文件块位置标记为空闲状态。因此将流媒体数据在文件块中进行存储和删除可以解决存储空间循环存储带来的磁盘碎片问题,实现磁盘寿命的延长。
第二方面,本公开还提出了一种用于存储流媒体数据的装置,包括:
存储模块,被配置为利用预先创建的固定大小的文件块将存储空间填满;
索引模块,被配置为选择合适的文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;
定位模块,被配置利用索引来定位所存储的流媒体数据所在的位置。
在一些实施例中,索引模块包括:
编号索引模块,被配置为根据流媒体数据的文件大小选择文件块,并记录文件块的编号以及流媒体数据在文件块中的偏移量;
关键帧索引模块,被配置为确定存储时间中的任一秒所对应的关键帧在流媒体数据中的偏移量;
索引文件模块,被配置为创建时间索引文件,并以时间秒数建立秒索引信息;
索引生成模块,被配置为将流媒体数据的存储时间转换为秒数,并将流媒体数据所选择的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量记录到秒数对应的秒索引信息中。
在一些实施例中,编号索引模块被配置为当流媒体数据的文件大小小于或等于文件块的剩余空间,则将流媒体数据存储在当前文件块中,当流媒体数据的文件大小大于文件块的剩余空间,则将流媒体数据存储在当前文件块的下一个文件块中。
在一些实施例中,关键帧索引模块被配置为判断任一秒所对应的流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下关键帧在流媒体数据中的偏移量,若是非关键帧,则记录下非关键帧的前一个关键帧在流媒体数据中的偏移量。
在一些实施例中,时间索引文件以天为单位建立,初始化时秒索引信息标记为无效索引。
在一些实施例中,定位模块包括:
时间索引文件定位模块,被配置为输入读取的开始日期和时间以及结束日期和时间,根据开始日期判断是否能获得对应的时间索引文件,若是,则进行下一步,若否,则结束;
秒索引信息定位模块,被配置为将开始时间转换成第N秒,在开始日期所对应的时间索引文件中定位到第N秒的秒索引信息,并判断第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束;
文件块定位模块,被配置为读取第N秒的秒索引信息,判断第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束;
关键帧定位模块,被配置为在第N秒的秒索引信息中指定编号的文件块中,通过流媒体数据在文件块中的偏移量读取关键帧,通过关键帧在流媒体数据中的偏移量读取流媒体数据;
重复模块,被配置为对下一秒重复执行上述模块进行的步骤并截止到超出结束时间后结束。
第三方面,本公开实施例提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现如第一方面中任一实现方式描述的方法。
本公开的实施例公开了一种用于存储流媒体数据的方法,通过预先创建的固定大小的文件块将存储空间填满;并选择合适的文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;最后利用索引来定位所存储的流媒体数据所在的位置。流媒体存储在文件块中进行存储和删除,可以有效解决流媒体数据存储过程中存储空间循环存储带来的磁盘碎片问题,实现磁盘寿命的延长,并达到提高磁盘使用效率的目的。同时,本公开还提出一种时间与流媒体数据的快速索引方法,实现流媒体数据的快速检索以及按时间任意跳转和回放,提高流媒体视频检索和定位的效率。
附图说明
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本公开的一个实施例可以应用于其中的示例性系统架构图;
图2为本公开的实施例的用于存储流媒体数据的方法的流程示意图;
图3为本公开的实施例的用于存储流媒体数据的方法的步骤S2的流程示意图;
图4为本公开的实施例的用于存储流媒体数据的方法的步骤S3的流程示意图;
图5为本公开的实施例的用于存储流媒体数据的装置的示意图;
图6是适于用来实现本公开实施例的电子设备的计算机系统的结构示意图。
具体实施方式
为了使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开作进一步地详细描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本公开保护的范围。
图1示出了可以应用本公开实施例的用于存储流媒体数据的方法或用于存储流媒体数据的装置的示例性系统架构100。
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种应用,例如数据处理类应用、文件处理类应用等。
终端设备101、102、103可以是硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当终端设备101、102、103为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以实现成单个软件或软件模块。在此不做具体限定。
服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上传的文件或数据进行处理的后台数据处理服务器。后台数据处理服务器可以对获取的文件或数据进行处理,生成处理结果(例如包含标准标题行和对应的分段包含的数据的标准文件)。
需要说明的是,本公开实施例所提供的用于存储流媒体数据的方法可以由服务器105执行,也可以由终端设备101、102、103执行,相应地,用于存储流媒体数据的装置可以设置于服务器105中,也可以设置于终端设备101、102、103中。
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。在所处理的数据不需要从远程获取的情况下,上述系统架构可以不包括网络,而只需服务器或终端设备。
继续参考图2,其示出了根据本公开的应用于存储流媒体数据的一个实施例的流程200。该方法包括以下步骤:
S1:利用预先创建的固定大小的文件块将存储空间填满。
在本实施例中,创建的文件块大小至少可以存储包含1个GOP大小的流媒体数据,流媒体数据按时间顺序存储在文件块中,在流媒体数据存储过程中,不需要再新建文件,只需要找到空闲的文件块,将流媒体数据覆盖写入文件块中。在流媒体数据被删除时,并不直接将文件块删除,而是在流媒体数据被删除后将对应的文件块的位置标记为空闲状态。因此在整个存储过程中,不再新建和删除文件块,有效避免了磁盘碎片的产生,延长磁盘寿命。另外,采用文件块存储就不需要使用常规的数据库系统,而是直接建立在存储空间上。
在本实施例的一些可选的实现方式中,文件块可以存储在预设的存储区中。上述存储区可以是各种类型的存储区,包括但不限于:缓存、内存、硬盘等。
在优选的实施例中,文件块的大小为128M,此时文件块中可以存储多个GOP的流媒体数据,每个GOP的流媒体数据大小远远小于文件块的大小,因此在文件块存储的最后剩余的空间不足以存储至少一个GOP大小的流媒体数据时,文件块所剩余的空间远比文件块本身的空间大小小得多,因此可以有效避免文件块中更多多余空间的浪费。在其他可选的实施例中,文件块的大小也可以选择其他合适的大小,只要满足流媒体数据在文件块中存储的位置可以被定位到即可,也就是说可以通过该流媒体数据在文件块中的偏移量来获取流媒体数据的位置。
S2:选择合适的文件块来存储流媒体数据同时将所选择的文件块标记为占用状态并且建立所存储的流媒体数据与存储时间的秒数之间的索引。
在本实施例的一些可选的实现方式中,如图3所示,上述执行主体可以按照如下步骤完成步骤S2的过程:
S21:根据流媒体数据的文件大小选择文件块,并记录文件块的编号以及流媒体数据在文件块中的偏移量。具体地,在流媒体数据存入文件块时,首先对比流媒体数据的文件与所选择存入的文件块中剩余空间之间的大小,当流媒体数据的文件大小小于或等于文件块的剩余空间,则将流媒体数据存储在当前文件块中,当流媒体数据的文件大小大于文件块的剩余空间,则将流媒体数据存储在当前文件块的下一个文件块中。因此可以根据流媒体数据的大小选择合适的文件块进行存储,有效实现文件块空间的充分利用,并且有效提高存储空间的利用率。
S22:确定存储时间中的任一秒所对应的关键帧在流媒体数据中的偏移量;具体地,判 断任一秒所对应的流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下关键帧在流媒体数据中的偏移量,若是非关键帧,则记录下非关键帧的前一个关键帧在流媒体数据中的偏移量。通过确认流媒体数据中关键帧的位置,可以实现流媒体数据的正常播放,而且通过准确查找存储时间中的任一秒所对应的关键帧可以快速定位到流媒体数据以执行播放,而不用从流媒体数据的开头进行播放到对应的秒数,快速实现流媒体数据的秒级定位和进度跳转。
S23:创建时间索引文件,并以时间秒数建立秒索引信息;具体地,时间索引文件以天为单位进行建立,初始化时秒索引信息标记为无效索引。以天为单位创建时间索引文件,时间索引文件以日期命名,时间索引文件最小时间单元为秒,每个设备每一天有一个时间索引文件,每秒一个秒索引信息,一个时间索引文件共有24*3600个秒索引信息,每个秒索引信息指向该秒对应的流媒体数据所在的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量。因此通过时间索引文件中的秒索引信息可以实现流媒体数据在文件块中位置的快速定位。
S24:将流媒体数据的存储时间转换为秒数,并将流媒体数据所选择的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量记录到秒数对应的秒索引信息中。具体地,如果将存储时间为2019年1月1日12点38分24秒的流媒体数据进行存储,即转换为将查找合适的文件块存储第45504秒的数据,并获得2019年1月1日建立的时间索引文件中第45504秒所对应的秒索引信息,此时第45504秒所对应的秒索引信息存储着对应的流媒体数据所在的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量。
S3:利用索引来定位所存储的流媒体数据所在的位置。
在本实施例的一些可选的实现方式中,如图4所示,上述执行主体可以按照如下步骤完成步骤S3的过程:
S31:输入读取的开始日期和时间以及结束日期和时间,根据开始日期判断是否能获得对应的时间索引文件,若是,则进行下一步,若否,则结束。具体地,读取时间从所选择的开始日期和时间开始进行读取到所选择的结束日期和时间为止。选择合适的读取的时间可以选择实现跨文件,按时间任意跳转进度和快速回放。
S32:将开始时间转换成第N秒,在开始日期所对应的时间索引文件中定位到第N秒的秒索引信息,并判断第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束。若第N秒的秒索引信息是有效索引,则说明该秒索引信息内存储有对应的流媒体数据在文件块中的位置信息。例如开始日期和时间为2019年1月1日12点38分24秒, 则查找2019年1月1日建立的时间索引文件中第45504秒所对应的秒索引信息,读取第45504秒所对应的秒索引信息,获得第45504秒所存储的流媒体数据的位置信息。
S33:读取第N秒的秒索引信息,判断第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束。例如第45504秒所存储的流媒体数据在文件块编号为6中。
S34:在第N秒的秒索引信息中指定编号的文件块中,通过流媒体数据在文件块中的偏移量读取关键帧,通过关键帧在流媒体数据中的偏移量读取流媒体数据。例如第45504秒所存储的流媒体数据在文件块编号为6中,第45504秒所存储的流媒体数据在文件块中的偏移量为12字节,关键帧在流媒体数据中的偏移量为16字节,依此定位到所述流媒体数据在文件块中的具体位置,甚至定位到所述流媒体数据的关键帧以进行流媒体数据的播放。
S35:对下一秒重复S31-S34的步骤并截止到超出结束时间后结束。
对于一个时间段的流媒体数据的读取采用上述过程以按时间秒数逐一进行读取,也可以对某一个时间点进行读取。
进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种用于存储流媒体数据的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。
如图5所示,本实施例的用于存储流媒体数据的装置500包括:存储模块501,被配置为利用预先创建的固定大小的文件块将存储空间填满;索引模块502,被配置为选择合适的文件块来存储流媒体数据同时将所选择的文件块标记为占用状态并且建立所存储的流媒体数据与存储时间的秒数之间的索引;定位模块503,被配置利用索引来定位所存储的流媒体数据所在的位置。
在本实施例中,上述索引模块501具体包括:编号索引模块,被配置为根据流媒体数据的文件大小选择文件块,并记录文件块的编号以及流媒体数据在文件块中的偏移量。具体地,编号索引模块用于判断当流媒体数据的文件大小小于或等于文件块的剩余空间,则将流媒体数据存储在当前文件块中,当流媒体数据的文件大小大于文件块的剩余空间,则将流媒体数据存储在当前文件块的下一个文件块中。
关键帧索引模块,被配置为确定存储时间中的任一秒所对应的关键帧在流媒体数据中的偏移量。关键帧索引模块被配置为判断任一秒所对应的流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下关键帧在流媒体数据中的偏移量,若是非关键帧,则记录下非关键帧的前一个关键帧在流媒体数据中的偏移量。
索引文件模块,被配置为创建时间索引文件,并以时间秒数建立秒索引信息。具体地,时间索引文件以天为单位建立时间索引文件,初始化时秒索引信息标记为无效索引。因此每一天的时间索引文件可以建立86400个秒索引信息。
索引生成模块,被配置为将流媒体数据的存储时间转换为秒数,并将流媒体数据所选择的文件块编号、流媒体数据在文件块中的偏移量、关键帧在流媒体数据中的偏移量记录到该秒数对应的秒索引信息中。
在一些实施例中,定位模块503包括:
时间索引文件定位模块,被配置为输入读取的开始日期和时间以及结束日期和时间,根据开始日期判断是否能获得对应的时间索引文件,若是,则进行下一步,若否,则结束;
秒索引信息定位模块,被配置为将开始时间转换成第N秒,在开始日期所对应的时间索引文件中定位到第N秒的秒索引信息,并判断第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束;
文件块定位模块,被配置为读取第N秒的秒索引信息,判断第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束;
关键帧定位模块,被配置为在第N秒的秒索引信息中指定编号的文件块中,通过流媒体数据在文件块中的偏移量读取关键帧,通过关键帧在流媒体数据中的偏移量读取流媒体数据;
重复模块,被配置为对下一秒重复执行上述模块进行的步骤并截止到超出结束时间后结束。
下面参考图6,其示出了适于用来实现本公开实施例的电子设备(例如图1所示的服务器或终端设备)的计算机系统600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,计算机系统600包括中央处理单元(CPU)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储部分608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有系统600操作所需的各种程序和数据。CPU 601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如、液晶显示器(LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包 括诸如LAN卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也可以根据需要连接至I/O接口605。可拆卸介质611,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器610上,以便于从其上读出的计算机程序根据需要被安装入存储部分608。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元(CPU)601执行时,执行本公开的方法中限定的上述功能。
需要说明的是,本公开所述的计算机可读介质可以是计算机可读信号介质或者计算机可读介质或者是上述两者的任意组合。计算机可读介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包 括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的模块也可以设置在处理器中,例如,可以描述为:一种处理器包括存储模块501、索引模块502和定位模块503。其中,这些模块的名称在某种情况下并不构成对该模块本身的限定,例如,存储模块501还可以被描述为“将存储空间分成固定大小的文件块用以存储的模块”。
作为另一方面,本公开还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:通过预先创建的固定大小的文件块将存储空间填满;并选择合适的文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;最后利用索引来定位所存储的流媒体数据所在的位置。流媒体存储在文件块中进行存储和删除,可以有效解决流媒体数据存储过程中存储空间循环存储带来的磁盘碎片问题,实现磁盘寿命的延长,并达到提高磁盘使用效率的目的。同时,本公开还提出一种时间与流媒体数据的快速索引方法,实现流媒体数据的快速检索以及按时间任意跳转和回放,提高流媒体视频检索和定位的效率。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (14)

  1. 一种用于存储流媒体数据的方法,其特征在于,包括以下步骤:
    S1:利用预先创建的固定大小的文件块将存储空间填满;
    S2:选择合适的所述文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;
    S3:利用所述索引来定位所存储的流媒体数据所在的位置。
  2. 根据权利要求1所述的用于存储流媒体数据的方法,其特征在于,所述步骤S2包括以下步骤:
    S21:根据所述流媒体数据的文件大小选择所述文件块,并记录所述文件块的编号以及所述流媒体数据在所述文件块中的偏移量;
    S22:确定所述存储时间中的任一秒所对应的关键帧在所述流媒体数据中的偏移量;
    S23:创建时间索引文件,并以时间秒数建立秒索引信息;
    S24:将所述流媒体数据的存储时间转换为秒数,并将所述流媒体数据所选择的文件块编号、所述流媒体数据在所述文件块中的偏移量、所述关键帧在所述流媒体数据中的偏移量记录到所述秒数对应的秒索引信息中。
  3. 根据权利要求2所述的用于存储流媒体数据的方法,其特征在于,所述步骤S21具体包括:当所述流媒体数据的文件大小小于或等于所述文件块的剩余空间,则将所述流媒体数据存储在当前文件块中,当所述流媒体数据的文件大小大于所述文件块的剩余空间,则将所述流媒体数据存储在当前文件块的下一个文件块中。
  4. 根据权利要求2所述的用于存储流媒体数据的方法,其特征在于,所述步骤S22具体包括:判断任一秒所对应的所述流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下所述关键帧在所述流媒体数据中的偏移量,若是非关键帧,则记录下所述非关键帧的前一个关键帧在所述流媒体数据中的偏移量。
  5. 根据权利要求2所述的用于存储流媒体数据的方法,其特征在于,所述时间索引文件以天为单位建立,初始化时所述秒索引信息标记为无效索引。
  6. 根据权利要求1所述的用于存储流媒体数据的方法,其特征在于,所述步骤S3包括以下步骤:
    S31:输入读取的开始日期和时间以及结束日期和时间,根据所述开始日期判断是否能获得对应的所述时间索引文件,若是,则进行下一步,若否,则结束;
    S32:将开始时间转换成第N秒,在开始日期所对应的所述时间索引文件中定位到第N秒的秒索引信息,并判断所述第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束;
    S33:读取所述第N秒的秒索引信息,判断所述第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束;
    S34:在所述第N秒的秒索引信息中指定编号的所述文件块中,通过所述所述流媒体数据在所述文件块中的偏移量读取所述关键帧,通过所述关键帧在所述流媒体数据中的偏移量读取所述流媒体数据;
    S35:对下一秒重复S31-S34的步骤并截止到超出结束时间后结束。
  7. 根据权利要求1所述的用于存储流媒体数据的方法,其特征在于,所述文件块被配置为存储至少包含1个GOP大小的流媒体数据,所述流媒体数据以时间顺序存储在所述文件块中,被删除后的所述流媒体数据所对应的文件块位置标记为空闲状态。
  8. 一种用于存储流媒体数据的装置,其特征在于,包括:
    存储模块,被配置为利用预先创建的固定大小的文件块将存储空间填满;
    索引模块,被配置为选择合适的所述文件块来存储流媒体数据,同时将所选择的文件块标记为占用状态,并且建立所存储的流媒体数据与存储时间的秒数之间的索引;
    定位模块,被配置利用所述索引来定位所存储的流媒体数据所在的位置。
  9. 根据权利要求8所述的用于存储流媒体数据的装置,其特征在于,所述索引模块包括:
    编号索引模块,被配置为根据所述流媒体数据的文件大小选择所述文件块,并记录所述文件块的编号以及所述流媒体数据在所述文件块中的偏移量;
    关键帧索引模块,被配置为确定所述存储时间中的任一秒所对应的关键帧在所述流媒体数据中的偏移量;
    索引文件模块,被配置为创建时间索引文件,并以时间秒数建立秒索引信息;
    索引生成模块,被配置为将所述流媒体数据的存储时间转换为秒数,并将所述流媒体数据所选择的文件块编号、所述流媒体数据在所述文件块中的偏移量、所述关键帧在所述流媒体数据中的偏移量记录到所述秒数对应的秒索引信息中。
  10. 根据权利要求9所述的用于存储流媒体数据的装置,其特征在于,所述编号索引模块被配置为当所述流媒体数据的文件大小小于或等于所述文件块的剩余空间,则将所述流媒体数据存储在当前文件块中,当所述流媒体数据的文件大小大于所述文件块的剩余空间,则将所述流媒体数据存储在当前文件块的下一个文件块中。
  11. 根据权利要求9所述的用于存储流媒体数据的装置,其特征在于,所述关键帧索引模块被配置为判断任一秒所对应的所述流媒体数据是关键帧还是非关键帧,若是关键帧,则记录下所述关键帧在所述流媒体数据中的偏移量,若是非关键帧,则记录下所述非关键帧的前一个关键帧在所述流媒体数据中的偏移量。
  12. 根据权利要求9所述的用于存储流媒体数据的装置,其特征在于,所述时间索引文件以天为单位建立,初始化时所述秒索引信息标记为无效索引。
  13. 根据权利要求8所述的用于存储流媒体数据的装置,其特征在于,所述定位模块包括:
    时间索引文件定位模块,被配置为输入读取的开始日期和时间以及结束日期和时间,根据所述开始日期判断是否能获得对应的所述时间索引文件,若是,则进行下一步,若否,则结束;
    秒索引信息定位模块,被配置为将开始时间转换成第N秒,在开始日期所对应的所述时间索引文件中定位到第N秒的秒索引信息,并判断所述第N秒的秒索引信息是否为有效索引,若是,则进行下一步,若否,则结束;
    文件块定位模块,被配置为读取所述第N秒的秒索引信息,判断所述第N秒的秒索引信息是否具有显示指定编号的文件块,若是,则进行下一步,若否,则结束;
    关键帧定位模块,被配置为在所述第N秒的秒索引信息中指定编号的所述文件块中,通过所述流媒体数据在所述文件块中的偏移量读取所述关键帧,通过所述关键帧在所述流媒体数据中的偏移量读取所述流媒体数据;
    重复模块,被配置为对下一秒重复执行上述模块进行的步骤并截止到超出结束时间后结束。
  14. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7中任一所述的方法。
PCT/CN2019/096562 2019-05-16 2019-07-18 一种用于存储流媒体数据的方法、装置、存储介质 WO2020228128A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910407291.9A CN110262752B (zh) 2019-05-16 2019-05-16 一种用于存储流媒体数据的方法、装置、存储介质
CN201910407291.9 2019-05-16

Publications (1)

Publication Number Publication Date
WO2020228128A1 true WO2020228128A1 (zh) 2020-11-19

Family

ID=67913266

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/096562 WO2020228128A1 (zh) 2019-05-16 2019-07-18 一种用于存储流媒体数据的方法、装置、存储介质

Country Status (2)

Country Link
CN (1) CN110262752B (zh)
WO (1) WO2020228128A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112699124B (zh) * 2020-12-30 2022-05-17 罗普特科技集团股份有限公司 一种基于分布式多存储服务的循环存储方法和系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539884A (zh) * 2009-04-30 2009-09-23 杭州华三通信技术有限公司 数据存储方法和装置
CN103761056A (zh) * 2014-01-17 2014-04-30 浪潮电子信息产业股份有限公司 一种视频监控应用中流式数据的存储方法
US20150071599A1 (en) * 2013-09-12 2015-03-12 International Business Machines Corporation Storage space savings via partial digital stream deletion
CN107229418A (zh) * 2017-05-02 2017-10-03 浙江宇视科技有限公司 一种录像文件存储方法及装置
CN107707600A (zh) * 2017-05-26 2018-02-16 贵州白山云科技有限公司 一种数据存储方法及装置

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685123B (zh) * 2012-05-04 2015-04-15 杭州天视智能系统有限公司 一种基于云存储发布流媒体的装置、系统及方法
CN103064633B (zh) * 2012-12-13 2016-12-21 广东威创视讯科技股份有限公司 一种数据存储方法及装置
CN103077200B (zh) * 2012-12-27 2016-12-28 深圳市赛为智能股份有限公司 一种音视频存储索引方法及装置
CN103678638B (zh) * 2013-12-20 2018-10-19 厦门雅迅网络股份有限公司 一种基于磁盘的对象缓存方法
CN104581436B (zh) * 2015-01-28 2017-12-05 青岛海信宽带多媒体技术有限公司 一种视频帧定位方法及装置
CN107231581B (zh) * 2016-03-25 2020-04-28 中国电信股份有限公司 用于视频播放的方法、系统及流媒体播放控制服务器
CN106303671B (zh) * 2016-08-16 2019-04-16 任晋军 一种流媒体的播放方法
CN107205174B (zh) * 2017-07-14 2019-12-10 广东工业大学 一种快速回放视频文件方法及系统
CN107870973B (zh) * 2017-09-20 2021-11-26 广东东为信息技术有限公司 一种加快多路监控同时回放的文件存储系统
CN109327760B (zh) * 2018-08-13 2019-12-31 北京中科睿芯科技有限公司 一种智能音响及其播放控制方法
CN109656474B (zh) * 2018-11-15 2022-02-15 金蝶软件(中国)有限公司 数据存储方法、装置、计算机设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539884A (zh) * 2009-04-30 2009-09-23 杭州华三通信技术有限公司 数据存储方法和装置
US20150071599A1 (en) * 2013-09-12 2015-03-12 International Business Machines Corporation Storage space savings via partial digital stream deletion
CN103761056A (zh) * 2014-01-17 2014-04-30 浪潮电子信息产业股份有限公司 一种视频监控应用中流式数据的存储方法
CN107229418A (zh) * 2017-05-02 2017-10-03 浙江宇视科技有限公司 一种录像文件存储方法及装置
CN107707600A (zh) * 2017-05-26 2018-02-16 贵州白山云科技有限公司 一种数据存储方法及装置

Also Published As

Publication number Publication date
CN110262752A (zh) 2019-09-20
CN110262752B (zh) 2020-08-11

Similar Documents

Publication Publication Date Title
EP2661863B1 (en) Apparatus and method for transmitting live media content
WO2018076952A1 (zh) 一种视频文件的存储、定位播放方法及装置
CN102084338B (zh) 用于多平台非线性视频编辑系统的新型媒体文件
CN109840879B (zh) 图像渲染方法、装置、计算机存储介质及终端
JP2008243367A (ja) 同報通信データを記録するための方法、および、装置
JP2008065546A (ja) データ転送システム、データ転送装置、ファイル形式変換装置、およびデータ転送方法
US20220256226A1 (en) Video data processing method, electronic device and computer-readable medium
WO2022110943A1 (zh) 语音预览的方法及装置
US20240126803A1 (en) System and method for dynamically accessing media assets
CN102510519A (zh) 流媒体数据的处理方法、播放方法以及装置
WO2020228128A1 (zh) 一种用于存储流媒体数据的方法、装置、存储介质
CN113873288A (zh) 在直播过程中生成回放的方法和装置
US20160225407A1 (en) Full fidelity remote video editing
CN113377770A (zh) 一种数据处理方法和装置
CN1241139C (zh) 文件配送方法以及文件配送装置
JP2007267356A (ja) ファイル管理プログラム、サムネイル画像表示方法および動画再生装置
CN114630143B (zh) 视频流存储方法、装置、电子设备和存储介质
WO2021227481A1 (zh) 基于hls的文件管理方法、装置、电子设备和存储介质
US20210117129A1 (en) Method and Apparatus for Writing Data
US8200067B2 (en) Processing of scalable compressed video data formats for nonlinear video editing systems
JP2008310889A (ja) 記録再生装置
KR20180039575A (ko) 데이터의 관리
CN115250266B (zh) 视频处理方法及装置、流媒体设备及存储点播系统
JP2004363825A (ja) 記録再生装置、記録再生方法、その記録媒体およびプログラム
JP2003174608A (ja) デジタル放送受信装置

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: 19928508

Country of ref document: EP

Kind code of ref document: A1

DPE1 Request for preliminary examination filed after expiration of 19th month from priority date (pct application filed from 20040101)
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19928508

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19928508

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 30/05/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19928508

Country of ref document: EP

Kind code of ref document: A1