CN110262752B - Method, device and storage medium for storing streaming media data - Google Patents

Method, device and storage medium for storing streaming media data Download PDF

Info

Publication number
CN110262752B
CN110262752B CN201910407291.9A CN201910407291A CN110262752B CN 110262752 B CN110262752 B CN 110262752B CN 201910407291 A CN201910407291 A CN 201910407291A CN 110262752 B CN110262752 B CN 110262752B
Authority
CN
China
Prior art keywords
media data
streaming media
file
file block
index
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910407291.9A
Other languages
Chinese (zh)
Other versions
CN110262752A (en
Inventor
卢天发
张龙
代加惠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ropt Technology Group Co ltd
Original Assignee
Ropt Technology Group Co ltd
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 Ropt Technology Group Co ltd filed Critical Ropt Technology Group Co ltd
Priority to CN201910407291.9A priority Critical patent/CN110262752B/en
Priority to PCT/CN2019/096562 priority patent/WO2020228128A1/en
Publication of CN110262752A publication Critical patent/CN110262752A/en
Application granted granted Critical
Publication of CN110262752B publication Critical patent/CN110262752B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The invention discloses a method for storing streaming media data, which comprises the following steps: s1: filling the storage space with pre-created file blocks with fixed sizes; s2: selecting a proper file block to store the streaming media data, marking the selected file block as an occupied state, and establishing an index between the stored streaming media data and the second of storage time; and S3: the index is used to locate where the stored streaming media data is located. The streaming media data is stored and deleted in the file block, so that the problem of disk fragments caused by cyclic storage of a storage space in the storage process of the streaming media data can be effectively solved, the service life of the disk is prolonged, and the purpose of improving the use efficiency of the disk is achieved. And the method can realize the quick retrieval of the streaming media data and the random jump and playback according to time, and improve the efficiency of the retrieval and the positioning of the streaming media data.

Description

Method, device and storage medium for storing streaming media data
Technical Field
The present invention relates to the field of data storage, and in particular, to a method, an apparatus, and a storage medium for storing streaming media data.
Background
With the continuous development of network technology and the gradual progress of digital signal processing, image compression and other technologies, video and audio applications are developed vigorously, the development of video and audio monitoring technology undergoes the conversion from analog to digital, and the video storage serving as the most key function of video and audio monitoring also undergoes the development process from front-end storage to back-end centralized storage. Therefore, the storage requirement of the video and audio streaming media data is increasing, and particularly in the field of video monitoring, a large amount of video and audio data shot by a camera needs to be stored and retrieved for a long time, so that the streaming media data is required to be stored and read efficiently and stably.
Video storage services are a very important ring in streaming media technology applications. In the traditional method for realizing the data storage of the streaming media, a mode of circularly creating a new streaming media file and deleting an old streaming media file is adopted to realize the circular storage of a storage space, and the increase of disk fragments can be caused in the processes of circularly creating and deleting the file, so that the read-write efficiency of a disk is reduced and the service life of the disk is shortened. Meanwhile, the traditional file-based storage mode does not support cross-file, arbitrary skip progress and quick playback in time in the storage data retrieval and playback processes.
Therefore, it is important to provide a novel streaming media data storage method to solve the problems of disk fragments caused by storage space cycle storage in the streaming media data storage process, and the inability of fast positioning and playback of streaming media data.
Disclosure of Invention
The embodiment of the invention discloses a method, a device and a storage medium for storing streaming media data, aiming at the problems of disk fragments, short disk service life, low disk use efficiency, incapability of quickly positioning and skipping playback of the streaming media data and the like caused by cyclic storage of a storage space in the storage process of the streaming media data.
In a first aspect, the present invention provides a method for storing streaming media data, comprising the following steps:
s1: filling the storage space with pre-created file blocks with fixed sizes;
s2: selecting a proper file block to store the streaming media data, marking the selected file block as an occupied state, and establishing an index between the stored streaming media data and the second of storage time;
s3: the index is used to locate where the stored streaming media data is located.
In some embodiments, step S2 includes the steps of:
s21: selecting a file block according to the file size of the streaming media data, and recording the number of the file block and the offset of the streaming media data in the file block;
s22: determining the offset of a key frame corresponding to any second in the storage time in the streaming media data;
s23: creating a time index file, and establishing second index information according to time seconds;
s24: converting the storage time of the streaming media data into seconds, and recording 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 into the second index information corresponding to the seconds.
In some embodiments, step S21 specifically includes: and when the file size of the streaming media data is smaller than or equal to the residual 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 residual space of the file block, storing the streaming media data in the next file block of the current file block. Therefore, a proper file block can be selected for storage according to the size of the streaming media data, and the full utilization of the file block space is effectively realized.
In some embodiments, step S22 specifically includes: and judging whether the streaming media data corresponding to any second is a key frame or a non-key frame, if so, recording the offset of the key frame in the streaming media data, and if not, recording the offset of the previous key frame of the non-key frame in the streaming media data. By confirming the position of the key frame in the streaming media data, the playing of the streaming media data can be effectively realized.
In some embodiments, the time index file is built in units of days, and the initialization time second index information is marked as an invalid index. The fast positioning of the position of the streaming media data in the file block can be realized through the time index file.
In some embodiments, step S3 includes the steps of:
s31: inputting the read start date and time and the read end date and time, judging whether the corresponding time index file can be obtained or not according to the start date, if so, carrying out the next step, and if not, ending;
s32: converting the starting time into Nth second, positioning the second index information of the Nth second in the time index file corresponding to the starting date, judging whether the second index information of the Nth second is a valid index, if so, carrying out the next step, and if not, ending;
s33: reading the second index information of the Nth second, judging whether the second index information of the Nth second has a file block displaying a specified number, if so, carrying out the next step, and if not, ending;
s34: in the file block with the specified number in the second index information of the Nth second, reading the key frame through the offset of the streaming media data in the file block, and reading the streaming media data through the offset of the key frame in the streaming media data;
s35: the steps of S31-S34 are repeated for the next second and end by the end time being exceeded.
In some embodiments, the file block is configured to store streaming media data at least containing 1 GOP size, the streaming media data are stored in the file block in time sequence, and the position of the file block corresponding to the deleted streaming media data is marked as an idle state. Therefore, the problem of disk fragments caused by cyclic storage of the storage space can be solved by storing and deleting the streaming media data in the file blocks, and the service life of the disk is prolonged.
In a second aspect, the present invention further provides an apparatus for storing streaming media data, including:
a storage module configured to fill up a storage space with pre-created fixed-size file blocks;
the index module is configured to select a proper file block to store the streaming media data, mark the selected file block in an occupied state, and establish an index between the stored streaming media data and the second of storage time;
and the positioning module is configured to position the position of the stored streaming media data by using the index.
In some embodiments, the indexing module comprises:
the number indexing module is configured to 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;
the key frame indexing module is configured to determine the offset of a key frame corresponding to any second in the storage time in the streaming media data;
the index file module is configured to create a time index file and establish second index information in time seconds;
and the index generation module is configured to 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 into second index information corresponding to the seconds.
In some embodiments, the number indexing 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, and store the streaming media data in a next file block of the current file block when the file size of the streaming media data is greater than the remaining space of the file block.
In some embodiments, the key frame indexing module is configured to determine whether streaming media data corresponding to any one second is a key frame or a non-key frame, record an offset of the key frame in the streaming media data if the key frame is the key frame, and record an offset of a previous key frame of the non-key frame in the streaming media data if the key frame is the non-key frame.
In some embodiments, the time index file is built in units of days, and the initialization time second index information is marked as an invalid index.
In some embodiments, the positioning module comprises:
the time index file positioning module is configured to input read start date and time and end date and time, judge whether a corresponding time index file can be obtained according to the start date, if so, perform the next step, and if not, end;
the second index information positioning module is configured to convert the starting time into the Nth second, position the second index information of the Nth second in the time index file corresponding to the starting date, judge whether the second index information of the Nth second is a valid index, if yes, perform the next step, and if not, finish the step;
the file block positioning module is configured to read the second index information of the Nth second, judge whether the second index information of the Nth second has a file block displaying a specified number, if so, perform the next step, and if not, end;
the key frame positioning module is configured to read a key frame through an offset of the streaming media data in a file block with a specified number in the second index information of the Nth second, and read the streaming media data through the offset of the key frame in the streaming media data;
and the repeating module is configured to repeatedly execute the steps performed by the modules for the next second and end after the end time is exceeded.
In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method as described in any implementation manner of the first aspect.
The embodiment of the invention discloses a method for storing streaming media data, which fills a storage space by pre-established file blocks with fixed sizes; selecting a proper file block to store the streaming media data, marking the selected file block as an occupied state, and establishing an index between the stored streaming media data and the second of storage time; and finally, positioning the position of the stored streaming media data by using the index. The stream media is stored and deleted in the file block, so that the problem of disk fragments caused by cyclic storage of a storage space in the process of storing the stream media data can be effectively solved, the service life of the disk is prolonged, and the purpose of improving the use efficiency of the disk is achieved. Meanwhile, the invention also provides a method for quickly indexing time and streaming media data, which realizes quick retrieval of the streaming media data and random skip and playback according to time and improves the efficiency of retrieving and positioning the streaming media video.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present application may be applied;
FIG. 2 is a flowchart illustrating a method for storing streaming media data according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating step S2 of the method for storing streaming media data according to the embodiment of the present invention;
fig. 4 is a flowchart illustrating step S3 of the method for storing streaming media data according to the embodiment of the present invention;
FIG. 5 is a diagram illustrating an apparatus for storing streaming media data according to an embodiment of the present invention;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing an electronic device according to embodiments of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 illustrates an exemplary system architecture 100 of a method for storing streaming media data or an apparatus for storing streaming media data to which embodiments of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various applications, such as data processing type applications, file processing type applications, etc., may be installed on the terminal apparatuses 101, 102, 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as a background data processing server that processes files or data uploaded by the terminal devices 101, 102, 103. The background data processing server may process the acquired file or data to generate a processing result (e.g., a standard file containing standard header lines and data contained in corresponding segments).
It should be noted that the method for storing streaming media data provided in the embodiment of the present application may be executed by the server 105, or may also be executed by the terminal devices 101, 102, and 103, and accordingly, the apparatus for storing streaming media data may be disposed in the server 105, or may also be disposed in the terminal devices 101, 102, and 103.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. In the case where the processed data does not need to be acquired from a remote location, the system architecture described above may not include a network, but only a server or a terminal device.
With continued reference to FIG. 2, a flow 200 for one embodiment of storing streaming media data according to the present application is shown. The method comprises the following steps:
s1: the storage space is filled with pre-created fixed-size file blocks.
In this embodiment, the created file block size can store at least streaming media data including 1 GOP size, the streaming media data are stored in the file block in time sequence, and in the process of storing the streaming media data, a new file is not needed, and only an idle file block needs to be found, and the streaming media data is written in the file block in an overlapping manner. When the streaming media data is deleted, the file block is not directly deleted, but the position of the corresponding file block is marked as an idle state after the streaming media data is deleted. Therefore, in the whole storage process, file blocks are not newly created or deleted, the generation of disk fragments is effectively avoided, and the service life of the disk is prolonged. In addition, the file block storage is adopted, so that a conventional database system is not needed, and the file block storage is directly built on a storage space.
In some optional implementations of this embodiment, the file block may be stored in a preset storage area. The memory area may be various types of memory areas including, but not limited to: cache, memory, hard disk, etc.
In a preferred embodiment, the size of the file block is 128M, at this time, the file block can store the streaming media data of multiple GOPs, and the size of the streaming media data of each GOP is much smaller than the size of the file block, so when the last remaining space of the file block storage is not enough to store the streaming media data of at least one GOP size, the remaining space of the file block is much smaller than the size of the file block itself, and thus waste of more redundant space in the file block can be effectively avoided. In other alternative embodiments, the size of the file block may also be selected to be other suitable sizes as long as it is satisfied that the position of the streaming media data stored in the file block can be located, that is, the position of the streaming media data can be obtained by the offset of the streaming media data in the file block.
S2: an appropriate file block is selected to store the streaming media data while marking the selected file block as occupied and indexing between the stored streaming media data and the number of seconds of storage time.
In some optional implementations of this embodiment, as shown in fig. 3, the executing main body may complete the process of step S2 according to the following steps:
s21: and selecting a file block according to the file size of the streaming media data, and recording the number of the file block and the offset of the streaming media data in the file block. Specifically, when the streaming media data is stored in the file block, the size between the file of the streaming media data and the remaining space in the selected stored file block is compared, when the file size of the streaming media data is smaller than or equal to the remaining space of the file block, the streaming media data is stored in the current file block, and 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 proper file block can be selected for storage according to the size of the streaming media data, the full utilization of the file block space is effectively realized, and the utilization rate of the storage space is effectively improved.
S22: determining the offset of a key frame corresponding to any second in the storage time in the streaming media data; specifically, whether the streaming media data corresponding to any second is a key frame or a non-key frame is judged, if yes, the offset of the key frame in the streaming media data is recorded, and if not, the offset of the previous key frame of the non-key frame in the streaming media data is recorded. The normal playing of the streaming media data can be realized by confirming the position of the key frame in the streaming media data, and the key frame corresponding to any second in the storage time can be quickly positioned to the streaming media data to execute the playing by accurately searching the key frame corresponding to any second in the storage time, so that the second-level positioning and the progress jump of the streaming media data can be quickly realized without playing from the beginning of the streaming media data to the corresponding second.
S23: creating a time index file, and establishing second index information according to time seconds; specifically, the time index file is established in units of days, and the second index information is marked as an invalid index when the time index file is initialized. The method comprises the steps of creating a time index file by taking days as a unit, naming the time index file by taking the date as a unit, setting the minimum time unit of the time index file as seconds, enabling each device to have one time index file every day, enabling each second index information to be one second index information, enabling each time index file to have 24 x 3600 second index information, and enabling each second index information to point to the file block number where streaming media data corresponding to the second are located, the offset of the streaming media data in a file block and the offset of a key frame in the streaming media data. Therefore, the fast positioning of the position of the streaming media data in the file block can be realized through the second index information in the time index file.
S24: converting the storage time of the streaming media data into seconds, and recording 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 into the second index information corresponding to the seconds. Specifically, if the streaming media data with the storage time of 12: 38: 24 seconds at 1/2019 is stored, that is, the streaming media data is converted into data for storing a suitable file block at 45504 seconds, and the second index information corresponding to 45504 seconds in the time index file established on 1/2019 is obtained, at this time, the second index information corresponding to 45504 seconds stores the file block number of the corresponding 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.
S3: the index is used to locate where the stored streaming media data is located.
In some optional implementations of this embodiment, as shown in fig. 4, the executing main body may complete the process of step S3 according to the following steps:
s31: and inputting the read start date and time and the read end date and time, judging whether the corresponding time index file can be obtained or not according to the start date, if so, carrying out the next step, and if not, ending. Specifically, the reading time is from the selected start date and time to the selected end date and time. The appropriate reading time can be selected to realize cross-file, arbitrary skip progress and quick playback according to time.
S32: and converting the starting time into the Nth second, positioning the second index information of the Nth second in the time index file corresponding to the starting date, judging whether the second index information of the Nth second is a valid index, if so, carrying out the next step, and if not, ending. If the second index information of the nth second is a valid index, the second index information stores the position information of the corresponding streaming media data in the file block. For example, if the start date and time is 12 o' clock 38 min 24 sec at 1 st/2019, the second index information corresponding to 45504 th second in the time index file created at 1 st/2019 is searched, the second index information corresponding to 45504 th second is read, and the location information of the streaming media data stored at 45504 th second is obtained.
S33: and reading the second index information of the Nth second, judging whether the second index information of the Nth second has a file block displaying the specified number, if so, carrying out the next step, and if not, ending. The streaming media data stored for example at 45504 th second is in file block number 6.
S34: and in the file block with the number specified in the second index information of the Nth second, reading the key frame through the offset of the streaming media data in the file block, and reading the streaming media data through the offset of the key frame in the streaming media data. For example, the 45504 th second stored streaming media data is in the file block number 6, the 45504 th second stored streaming media data has an offset of 12 bytes in the file block, and the key frame has an offset of 16 bytes in the streaming media data, so as to locate the specific position of the streaming media data in the file block, and even locate the key frame of the streaming media data for playing the streaming media data.
S35: the steps of S31-S34 are repeated for the next second and end by the end time being exceeded.
The above process is adopted for reading the streaming media data in a time period one by one according to the time seconds, and a certain time point can also be read.
With further reference to fig. 5, as an implementation of the method shown in the above figures, the present application provides an embodiment of an apparatus for storing streaming media data, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be applied to various electronic devices in particular.
As shown in fig. 5, the apparatus 500 for storing streaming media data of the present embodiment includes: a storage module 501 configured to fill up a storage space with pre-created fixed-size file blocks; an indexing module 502 configured to select suitable file blocks to store streaming media data while marking the selected file blocks as occupied and establishing an index between the stored streaming media data and a number of seconds of storage time; the positioning module 503 is configured to position the location of the stored streaming media data by using the index.
In this embodiment, the indexing module 501 specifically includes: and the number indexing module is configured to select the file blocks according to the file size of the streaming media data and record the numbers of the file blocks and the offset of the streaming media data in the file blocks. Specifically, the number indexing module is configured to store the streaming media data in the current file block when the file size of the streaming media data is smaller than or equal to the remaining space of the file block, and store the streaming media data in a next file block of the current file block when the file size of the streaming media data is larger than the remaining space of the file block.
And the key frame indexing module is configured to determine the offset of the key frame corresponding to any second in the storage time in the streaming media data. The key frame index module is configured to judge whether the streaming media data corresponding to any second is a key frame or a non-key frame, if so, record the offset of the key frame in the streaming media data, and if not, record the offset of the previous key frame of the non-key frame in the streaming media data.
And the index file module is configured to create a time index file and establish second index information in time seconds. Specifically, the time index file is established by taking days as a unit, and the second index information is marked as an invalid index when the time index file is initialized. The time index file for each day can establish 86400 seconds of index information.
And the index generation module is configured to 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 into second index information corresponding to the seconds.
In some embodiments, the positioning module 503 includes:
the time index file positioning module is configured to input read start date and time and end date and time, judge whether a corresponding time index file can be obtained according to the start date, if so, perform the next step, and if not, end;
the second index information positioning module is configured to convert the starting time into the Nth second, position the second index information of the Nth second in the time index file corresponding to the starting date, judge whether the second index information of the Nth second is a valid index, if yes, perform the next step, and if not, finish the step;
the file block positioning module is configured to read the second index information of the Nth second, judge whether the second index information of the Nth second has a file block displaying a specified number, if so, perform the next step, and if not, end;
the key frame positioning module is configured to read a key frame through an offset of the streaming media data in a file block with a specified number in the second index information of the Nth second, and read the streaming media data through the offset of the key frame in the streaming media data;
and the repeating module is configured to repeatedly execute the steps performed by the modules for the next second and end after the end time is exceeded.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use in implementing an electronic device (e.g., the server or terminal device shown in FIG. 1) of an embodiment of the present application is shown. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a signal such as a Liquid Crystal Display (LCD) and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 may 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, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable medium or any combination of the two. A computer readable medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present application may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a storage module 501, an indexing module 502, and a positioning module 503. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, the storage module 501 may also be described as a "module that divides a storage space into fixed-size file blocks for storage".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: filling up the storage space by pre-created file blocks with fixed size; selecting a proper file block to store the streaming media data, marking the selected file block as an occupied state, and establishing an index between the stored streaming media data and the second of storage time; and finally, positioning the position of the stored streaming media data by using the index. The stream media is stored and deleted in the file block, so that the problem of disk fragments caused by cyclic storage of a storage space in the process of storing the stream media data can be effectively solved, the service life of the disk is prolonged, and the purpose of improving the use efficiency of the disk is achieved. Meanwhile, the invention also provides a method for quickly indexing time and streaming media data, which realizes quick retrieval of the streaming media data and random skip and playback according to time and improves the efficiency of retrieving and positioning the streaming media video.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (12)

1. A method for storing streaming media data, comprising the steps of:
s1: filling the storage space with pre-created file blocks with fixed sizes;
s2: selecting a proper file block to store the streaming media data, marking the selected file block as an occupied state, and establishing an index between the stored streaming media data and the second of storage time;
the step S2 includes the steps of:
s21: selecting the file block according to the file size of the streaming media data, and recording the number of the file block and the offset of the streaming media data in the file block;
s22: determining the offset of a key frame corresponding to any second in the storage time in the streaming media data;
s23: creating a time index file, and creating second index information by time seconds, wherein the time index file is created by taking days as a unit;
s24: converting the storage time of the streaming media data into seconds, and recording 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 into second index information corresponding to the seconds;
s3: and utilizing the index to locate the position of the stored streaming media data.
2. The method for storing streaming media data according to claim 1, wherein the step S21 specifically comprises: and when the file size of the streaming media data is smaller than or equal to the residual 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 residual space of the file block, storing the streaming media data in the next file block of the current file block.
3. The method for storing streaming media data according to claim 1, wherein the step S22 specifically comprises: and judging whether the streaming media data corresponding to any second is a key frame or a non-key frame, if so, recording the offset of the key frame in the streaming media data, and if not, recording the offset of the previous key frame of the non-key frame in the streaming media data.
4. The method of claim 1, wherein the second index information is marked as an invalid index at initialization.
5. The method for storing streaming media data according to claim 1, wherein the step S3 comprises the steps of:
s31: inputting the read start date and time and the read end date and time, judging whether the corresponding time index file can be obtained or not according to the start date, if so, carrying out the next step, and if not, ending;
s32: converting the starting time into Nth second, positioning second index information of the Nth second in the time index file corresponding to the starting date, judging whether the second index information of the Nth second is a valid index, if so, carrying out the next step, and if not, ending;
s33: reading the second index information of the Nth second, judging whether the second index information of the Nth second has a file block displaying a specified number, if so, carrying out the next step, and if not, ending;
s34: in the file block with the number specified in the second index information of the Nth second, reading the key frame through the offset of the streaming media data in the file block, and reading the streaming media data through the offset of the key frame in the streaming media data;
s35: the steps of S31-S34 are repeated for the next second and end by the end time being exceeded.
6. The method according to claim 1, wherein the file block is configured to store streaming media data at least containing 1 GOP size, the streaming media data are stored in the file block in time sequence, and the position of the file block corresponding to the deleted streaming media data is marked as an idle state.
7. An apparatus for storing streaming media data, comprising:
a storage module configured to fill up a storage space with pre-created fixed-size file blocks;
an index module configured to select an appropriate file block to store streaming media data, mark the selected file block as an occupied state, and establish an index between the stored streaming media data and the number of seconds of storage time;
the indexing module comprises:
the number indexing 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 indexing module is configured to determine the offset of a key frame corresponding to any second in the storage time in the streaming media data;
the index file module is configured to create a time index file and create second index information in time seconds, wherein the time index file is created in a unit of days;
an index generation module configured to 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 into second index information corresponding to the seconds;
and the positioning module is configured to position the position of the stored streaming media data by using the index.
8. The apparatus of claim 7, wherein the number indexing module is configured to store the streaming media data in a current file block when a file size of the streaming media data is smaller than or equal to a remaining space of the file block, and store the streaming media data in a next file block of the current file block when the file size of the streaming media data is larger than the remaining space of the file block.
9. The apparatus according to claim 7, wherein the key frame indexing module is configured to determine whether the streaming media data corresponding to any second is a key frame or a non-key frame, record an offset of the key frame in the streaming media data if the key frame is the key frame, and record an offset of a previous key frame of the non-key frame in the streaming media data if the key frame is the non-key frame.
10. The apparatus of claim 7, wherein the second index information is marked as an invalid index at initialization.
11. The apparatus for storing streaming media data as in claim 7, wherein the positioning module comprises:
the time index file positioning module is configured to input read start date and time and end date and time, judge whether the corresponding time index file can be obtained according to the start date, if so, perform the next step, and if not, end;
the second index information positioning module is configured to convert the starting time into the Nth second, position the second index information of the Nth second in the time index file corresponding to the starting date, judge whether the second index information of the Nth second is a valid index, if yes, perform the next step, and if not, end;
the file block positioning module is configured to read the second index information of the Nth second, judge whether the second index information of the Nth second has a file block displaying a specified number, if so, perform the next step, and if not, end;
a key frame positioning module configured to read the key frame through an offset of the streaming media data in the file block of the second index information of the nth second, and read the streaming media data through an offset of the key frame in the streaming media data;
and the repeating module is configured to repeatedly execute the steps performed by the modules for the next second and end after the end time is exceeded.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201910407291.9A 2019-05-16 2019-05-16 Method, device and storage medium for storing streaming media data Active CN110262752B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910407291.9A CN110262752B (en) 2019-05-16 2019-05-16 Method, device and storage medium for storing streaming media data
PCT/CN2019/096562 WO2020228128A1 (en) 2019-05-16 2019-07-18 Method and device for storing streaming media data and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910407291.9A CN110262752B (en) 2019-05-16 2019-05-16 Method, device and storage medium for storing streaming media data

Publications (2)

Publication Number Publication Date
CN110262752A CN110262752A (en) 2019-09-20
CN110262752B true CN110262752B (en) 2020-08-11

Family

ID=67913266

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910407291.9A Active CN110262752B (en) 2019-05-16 2019-05-16 Method, device and storage medium for storing streaming media data

Country Status (2)

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

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112699124B (en) * 2020-12-30 2022-05-17 罗普特科技集团股份有限公司 Circulating storage method and system based on distributed multi-storage service

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685123A (en) * 2012-05-04 2012-09-19 安科智慧城市技术(中国)有限公司 Cloud-storage-based streaming media publication device, system and method
CN103064633A (en) * 2012-12-13 2013-04-24 广东威创视讯科技股份有限公司 Data storage method and device
CN103678638A (en) * 2013-12-20 2014-03-26 厦门雅迅网络股份有限公司 Object caching method based on disk
CN107205174A (en) * 2017-07-14 2017-09-26 广东工业大学 A kind of quick playback video file method and system
CN107231581A (en) * 2016-03-25 2017-10-03 中国电信股份有限公司 Method, system and streaming media playing for video playback control server
CN107870973A (en) * 2017-09-20 2018-04-03 广东东为信息技术有限公司 A kind of document storage system accelerated multi-path monitoring and played back simultaneously
CN109656474A (en) * 2018-11-15 2019-04-19 金蝶软件(中国)有限公司 Date storage method, device, computer equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539884B (en) * 2009-04-30 2012-07-11 杭州华三通信技术有限公司 Method and device for data storage
CN103077200B (en) * 2012-12-27 2016-12-28 深圳市赛为智能股份有限公司 A kind of audio/video index storage method and device
US9111577B2 (en) * 2013-09-12 2015-08-18 International Business Machines Corporation Storage space savings via partial digital stream deletion
CN103761056A (en) * 2014-01-17 2014-04-30 浪潮电子信息产业股份有限公司 Stream data storage method in video monitoring application
CN104581436B (en) * 2015-01-28 2017-12-05 青岛海信宽带多媒体技术有限公司 A kind of frame of video localization method and device
CN106303671B (en) * 2016-08-16 2019-04-16 任晋军 A kind of playback method of Streaming Media
CN107229418B (en) * 2017-05-02 2020-07-28 浙江宇视科技有限公司 Video file storage method and device
CN107707600B (en) * 2017-05-26 2018-09-18 贵州白山云科技有限公司 A kind of date storage method and device
CN109327760B (en) * 2018-08-13 2019-12-31 北京中科睿芯科技有限公司 Intelligent sound box and playing control method thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102685123A (en) * 2012-05-04 2012-09-19 安科智慧城市技术(中国)有限公司 Cloud-storage-based streaming media publication device, system and method
CN103064633A (en) * 2012-12-13 2013-04-24 广东威创视讯科技股份有限公司 Data storage method and device
CN103678638A (en) * 2013-12-20 2014-03-26 厦门雅迅网络股份有限公司 Object caching method based on disk
CN107231581A (en) * 2016-03-25 2017-10-03 中国电信股份有限公司 Method, system and streaming media playing for video playback control server
CN107205174A (en) * 2017-07-14 2017-09-26 广东工业大学 A kind of quick playback video file method and system
CN107870973A (en) * 2017-09-20 2018-04-03 广东东为信息技术有限公司 A kind of document storage system accelerated multi-path monitoring and played back simultaneously
CN109656474A (en) * 2018-11-15 2019-04-19 金蝶软件(中国)有限公司 Date storage method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110262752A (en) 2019-09-20
WO2020228128A1 (en) 2020-11-19

Similar Documents

Publication Publication Date Title
US20190147058A1 (en) Method and apparatus for pushing multimedia content
CN105052107B (en) Media content Adaptive Transmission is carried out using quality information
EP2060980A2 (en) Server and client device, and information processing system and method
US20210136464A1 (en) Providing Advanced Playback And Control Functionality To Video Client
CN104967862A (en) Video storage method and device, and video searching method and device
JP2008065546A (en) Data transfer system, data transfer device, file format conversion device and data transfer method
US20090079840A1 (en) Method for intelligently creating, consuming, and sharing video content on mobile devices
CN109840879B (en) Image rendering method and device, computer storage medium and terminal
KR20140024262A (en) Apparatus and method for transmitting live media content
CN101501775A (en) Media timeline processing infrastructure
US20220256226A1 (en) Video data processing method, electronic device and computer-readable medium
CN104572966A (en) Zip file unzipping method and device
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
JP2014532338A (en) Method and device for transmitting streaming media
CN102510519A (en) Streaming media data processing method, playing method and device
CN114299972A (en) Audio processing method, device, equipment and storage medium
CN110262752B (en) Method, device and storage medium for storing streaming media data
CN113742518A (en) Method, apparatus and computer program product for storing and providing video
US9081775B2 (en) Digital content supply system
CN114125551B (en) Video generation method, device, electronic equipment and computer readable medium
CN109618198A (en) Live content reports method and device, storage medium, electronic equipment
CN113377770A (en) Data processing method and device
JP2006074391A (en) File recording method and recorder
CN110536077B (en) Video synthesis and playing method, device and equipment
CN114630143B (en) Video stream storage method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant