CN107943849B - Video file retrieval method and device - Google Patents

Video file retrieval method and device Download PDF

Info

Publication number
CN107943849B
CN107943849B CN201711068816.8A CN201711068816A CN107943849B CN 107943849 B CN107943849 B CN 107943849B CN 201711068816 A CN201711068816 A CN 201711068816A CN 107943849 B CN107943849 B CN 107943849B
Authority
CN
China
Prior art keywords
video
preset
video file
retrieved
sampling
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
CN201711068816.8A
Other languages
Chinese (zh)
Other versions
CN107943849A (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.)
Green Bay Network Technology Co., Ltd.
Original Assignee
Green Bay Network Technology 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 Green Bay Network Technology Co Ltd filed Critical Green Bay Network Technology Co Ltd
Priority to CN201711068816.8A priority Critical patent/CN107943849B/en
Publication of CN107943849A publication Critical patent/CN107943849A/en
Application granted granted Critical
Publication of CN107943849B publication Critical patent/CN107943849B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/78Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/783Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • G06F16/7837Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using objects detected or recognised in the video content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Library & Information Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a video file retrieval method and a video file retrieval device, wherein the method comprises the following steps: the method comprises the steps of performing at least one round of sampling on a video file to be retrieved, sliding one frame for performing the next round of sampling if all sampled video segments of the previous round of sampling fail to be matched in a preset index base until at least one sampled video segment of a certain round successfully matches in the preset index base, then performing comprehensive retrieval on all video segments of the video file to be retrieved in the preset index base, or failing to be retrieved after sliding for enough times, and then indicating that no video file matched with the video to be retrieved exists in the index base. The method can quickly determine whether the matched retrieval result exists in the preset index database, and greatly improves the retrieval efficiency.

Description

Video file retrieval method and device
Technical Field
The invention relates to the technical field of data retrieval, in particular to a video file retrieval method and device.
Background
With the development of video networks, more and more video files in the networks need to be managed and retrieved. The retrieval of the video file is to find matching video segments from a large number of video sources. The common video file retrieval methods include content-based video retrieval, shot-based video retrieval, and the like, however, the retrieval efficiency of the current retrieval method is relatively low, and therefore, how to improve the detection efficiency of the video file becomes a technical problem to be solved urgently.
Disclosure of Invention
The object of the present invention is to solve at least to some extent one of the above mentioned technical problems.
Therefore, a first object of the present invention is to provide a video file retrieval method, in which at least one round of sampling is performed on a video file to be retrieved, if all sampled video segments of the previous round of sampling fail to be matched in a preset index library, a frame is slid to perform the next round of sampling until at least one sampled video segment of a certain round successfully matches in the preset index library, and then all video segments of the video file to be retrieved are comprehensively retrieved in the preset index library, or if the retrieval fails after the video segments are slid for a sufficient number of times, it indicates that there is no video file matched with the video to be retrieved in the index library. The method can quickly determine whether the matched retrieval result exists in the preset index database, and greatly improves the retrieval efficiency.
A second object of the present invention is to provide a video file retrieval apparatus.
A third object of the invention is to propose a computer device.
A fourth object of the invention is to propose a computer-readable storage medium.
In order to achieve the above object, a video file retrieval method according to an embodiment of the first aspect of the present invention includes:
adding 1 frame to the previous sampling start frame as a current sampling start frame, and judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number or not;
if the judgment result is negative, sampling the video file to be retrieved from the current sampling initial frame according to a preset sampling rule to obtain at least one sampling video segment;
inquiring whether at least one preset video segment matched with the sampling video segment exists in a preset index library, wherein the preset index library comprises the preset video segments;
if the video file to be retrieved exists, taking the current sampling initial frame as a segmentation initial frame, segmenting the video file to be retrieved according to a preset rule, and acquiring all video segments of the video file to be retrieved;
inquiring whether a preset video clip matched with the video clip exists in the preset index library or not;
and determining the preset video clip matched with the video clip as a retrieval result of the video file to be retrieved.
The method as described above, after the determining whether the frame number difference between the current sampling start frame and the first sampling start frame reaches the preset sliding frame number, further includes:
and if so, determining that the video file to be retrieved fails to be matched in the preset index library.
The method as described above, after querying the preset index library to determine whether there is at least one preset video segment matching the sampled video segment, further comprising:
if not, the step of adding 1 frame to the last sampling start frame as the current sampling start frame is returned to be executed.
According to the method, the preset index library comprises the corresponding relation between the feature codes and the preset video files;
the querying whether at least one preset video segment matching the sampled video segment exists in a preset index database comprises:
respectively acquiring the feature codes of the sampled video clips;
and inquiring whether at least one preset video segment matched with the sampled video segment exists in the preset index database according to the corresponding relation between the feature codes and the preset video file.
The method for querying whether the preset video segment matching with the video segment exists in the preset index library comprises the following steps:
respectively acquiring feature codes corresponding to the video clips;
and inquiring whether a preset video segment matched with the video segment exists in a preset index library according to the corresponding relation between the feature code and the preset video file.
As described above, the obtaining the feature codes of the respective sampled video segments includes:
respectively acquiring the feature codes of the sampled video segments by utilizing a Hash signature algorithm;
and/or the respectively obtaining the feature codes corresponding to the video segments comprises:
and respectively acquiring the feature codes corresponding to the video segments by utilizing the Hash signature algorithm.
The method as described above, further comprising:
acquiring at least one preset video file;
segmenting at least one preset video file respectively to obtain preset video clips corresponding to the preset video files;
and creating the preset index library according to the preset video clip.
The method for creating the preset index library according to the preset video clip comprises the following steps:
acquiring the feature code of the preset video clip;
establishing a corresponding relation between the feature codes and preset video clips;
and establishing the preset index library according to the corresponding relation.
The method as described above, after the creating the preset index library according to the preset video segment, further comprising:
acquiring a video clip corresponding to a video file to be put in storage;
inquiring whether a preset video clip matched with the video clip corresponding to the video file to be stored exists in the preset index library;
if so, re-segmenting the video file to be warehoused according to a preset video segment matched with the video segment corresponding to the video file to be warehoused;
and updating the preset index library according to the video segments corresponding to the video files to be stored obtained by re-segmentation.
In order to achieve the above object, a video file retrieval apparatus according to a second aspect of the present invention includes:
the calculation module is used for adding 1 frame to the last sampling start frame to be used as a current sampling start frame;
the judging module is used for judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number or not;
the first processing module is used for sampling the video file to be retrieved from the current sampling initial frame according to a preset sampling rule if the judgment result is negative, and acquiring at least one sampling video segment;
the first query module is used for querying whether at least one preset video segment matched with the sampling video segment exists in a preset index library, and the preset index library comprises the preset video segments;
the second processing module is used for segmenting the video file to be retrieved according to a preset rule by taking the current sampling initial frame as a segmentation initial frame if the video file to be retrieved exists, and acquiring all video segments of the video file to be retrieved;
the second query module is used for querying whether a preset video segment matched with the video segment exists in the preset index library or not;
and the determining module is used for determining the preset video clip matched with the video clip as a retrieval result of the video file to be retrieved.
To achieve the above object, a computer apparatus according to an embodiment of the third aspect of the present invention includes: a processor and a memory;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the video file retrieval method according to the first aspect.
In order to achieve the above object, a computer-readable storage medium according to a fourth aspect of the present invention has a computer program stored thereon, and when executed by a processor, the computer program implements the video file retrieval method according to the first aspect.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which,
fig. 1 is a flowchart of a video file retrieval method according to an embodiment of the present invention;
fig. 2 is a flowchart of a video file retrieval method according to still another embodiment of the present invention;
FIG. 3 is a flow chart of a video file retrieval method according to another embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for retrieving a video file according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
A video file retrieval method and apparatus according to an embodiment of the present invention will be described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a video file retrieval method according to an embodiment of the present invention. The video file retrieval method of the present embodiment is executed by a video file retrieval apparatus, which may be integrated in a server.
As shown in fig. 1, the video file retrieval method of the present embodiment includes the following steps:
s101, adding 1 frame to the previous sampling start frame to serve as a current sampling start frame, judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number, if not, executing a step S102, and if so, executing a step S107.
For example, for a 2-hour video file, the video file includes 30 frames per second, and if 150 frames of data are counted as one video clip in 5 consecutive seconds, the 2-hour video file may be divided into 2 × 60 × 60/5 — 1440 video clips. When the 2-hour video file needs to be searched, the conventional method is to search 1440 video clips one by one, and the searching amount is large and the searching efficiency is low.
However, the method of this embodiment is to extract a part of video segments from 1440 video segments, for example, starting from the first frame, 150 frames in total of 5 seconds are continuously extracted as a first video segment, then 5 seconds are extracted as a second video segment every 10 minutes, and so on, 12 video segments are extracted from a 2-hour file, so that only 12 video segments need to be retrieved once, and compared with the case that all 1440 video segments need to be retrieved one by one, the retrieval amount is significantly reduced, and the retrieval efficiency is high.
In this embodiment, multiple rounds of sampling may be performed on the video file to be retrieved according to the sequence, or multiple rounds of sampling may be performed on the video file to be retrieved at the same time, which is not limited herein.
The video files to be retrieved are sampled in multiple rounds in chronological order as briefly described herein: firstly, taking the first frame of the video file as the sampling start frame of the first round, continuously extracting 150 frames in total for 5 seconds as a first video segment, then taking 5 seconds at intervals of 10 minutes as a second video segment, and so on, and in the first round of sampling, extracting 12 video segments in total from a file of 2 hours. Then, the sampling start frame of the first round plus 1 frame is taken as the sampling start frame of the second round, that is, a frame is slid from the sampling start frame of the first round, the sampling start frame of the second round is determined as the second frame, 150 frames in total of 5 seconds are continuously extracted as a first video segment, then 5 seconds are extracted at intervals of 10 minutes as a second video segment, and so on, and in the second round of sampling, 12 video segments in total can be extracted from a file of 2 hours. In this way, the total number of sliding is 149 frames, sampling is 150 times, each sampling takes 12 video segments, and after the sliding is 149 times, if the sliding is performed again, the video segments extracted by the sampling are consistent with the video segments extracted by the first sampling, so that the comprehensive coverage sampling can be realized.
In the embodiment, the sampling start frame of each round is determined by the sliding frame, and the starting frame of the video file to be retrieved and the starting frame of the video file in the preset index library can be aligned by at least one round of the sampling start frame through a plurality of sliding frames, so that the problem of retrieval failure caused by the fact that the starting frames are not aligned is well solved.
In this embodiment, the number of samples to sample the video file to be retrieved is limited by a preset number of sliding frames. For example, for a 150 frame video clip, sampling 150 times can achieve full coverage. If sampling is carried out for 150 times, and no sampled video segment is matched in the preset index database, the matching failure of the video file to be retrieved in the preset index database is shown, namely, no video segment is matched with the video file to be retrieved in the preset index database, at this time, sampling is not carried out any more, and the matching result of re-sampling is the same as the matching result of any sampling in 150 times, so that the significance is avoided.
Therefore, before the sample retrieval, the present embodiment determines whether the current sample reaches the upper limit. Specifically, whether the current sample reaches the upper limit is judged by whether the frame number difference between the current sample start frame and the first sample start frame reaches the preset sliding frame number. For example, for a 150-frame video segment, the sampling start frame of the first round (i.e. the first sampling start frame) slides 149 frames to obtain the sampling start frame of the 150 th round, the sampling start frame of the 150 th round is the sampling start frame of the last round, and the sampling start frame of the 151 th round is the same as the sampling start frame of the first round. If the frame number difference between the current sampling start frame and the first sampling start frame is less than 150 frames, it indicates that the sampling frequency of the file to be retrieved does not reach the upper limit, and if the frame number difference is equal to or greater than 150 frames, it indicates that the sampling frequency of the file to be retrieved reaches the upper limit. In this embodiment, the preset sliding frame number is related to the selection of the video segment, and if 150 frames in total are continuously 5s as one video segment, the preset sliding frame number is 150 frames, and if 300 frames in total are continuously 10s as one video segment, the preset sliding frame number is 300 frames.
And for the video files to be retrieved simultaneously, carrying out multiple sampling rounds on the video files to be retrieved according to the sequence, wherein the multiple sampling rounds on the video files to be retrieved simultaneously are carried out simultaneously and parallelly, and the same time spent on the multiple sampling rounds and the same time spent on the sampling can be realized by means of the clustering technology.
For example, if the 12 sampled video segments of the first round of sampling are not successfully matched in the preset index database, the second round of sampling is performed, the 12 sampled video segments of the second round of sampling are matched in the preset index database, and so on until one of the 12 sampled video segments of a certain round of sampling is matched with the preset video segment in the preset index database.
And S102, if the judgment result is negative, sampling the video file to be retrieved from the current sampling start frame according to a preset sampling rule to obtain at least one sampling video segment, and executing the step S103.
For example, for the first round of sampling, 150 frames in total are continuously extracted for 5 seconds from the first frame as a first video segment, and then another 5 seconds are extracted for a second video segment every 10 minutes, and so on, a 2-hour file extracts 12 video segments in the first round of sampling. And so on, the sampling start frame of the second round is that 150 frames in total are continuously extracted from the second frame for 5 seconds as a first video segment, then another 5 seconds are extracted at intervals of 10 minutes as a second video segment, and so on, a 2-hour file is extracted to obtain 12 video segments in the second round of sampling.
S103, inquiring whether at least one preset video segment matched with the sampling video segment exists in a preset index library, wherein the preset index library comprises the preset video segment, if so, executing the step S104, and if not, returning to execute the step S101.
Specifically, a preset index library is created in advance according to a large amount of video resources, for example, a large amount of preset video clips are stored in the preset index library.
In a conventional method, 1440 video clips of a 2-hour video file are searched one by one in a preset index library, that is, 1440 searches are needed to determine whether a matching video clip exists in the preset index library.
Taking the example of performing multiple rounds of sampling on video files to be retrieved according to the sequence, the method of this embodiment is to retrieve 12 sampled video segments of the first round of sampling in the preset index library, that is, 12 times of retrieval is required, if there is a sampled video segment in the 12 sampled video segments of the first round of sampling that matches with the preset video segment in the preset index library, 1440 video segments in total of 2 hours are matched in the preset index library, and at the same time, the next round of sampling is not performed any more. If one of the 12 sampled video segments of the first round of sampling does not match with the preset video segment in the preset index database, the method returns to the step S101 to perform the second round of sampling, and determines whether one of the 12 sampled video segments of the second round of sampling matches with the preset video segment in the preset index database, and if only one of the 12 sampled video segments of a certain round of sampling matches with the preset video segment in the preset index database, the next round of sampling is not performed.
And S104, if the video file exists, segmenting the video file to be retrieved according to a preset rule by taking the current sampling initial frame as a segmentation initial frame to obtain all video segments of the video file to be retrieved, and executing the step S105.
S105, inquiring whether a preset video clip matched with the video clip exists in the preset index library, and executing the step S106.
And S106, determining the preset video clip matched with the video clip as a retrieval result of the video file to be retrieved.
Specifically, if it is determined in step S103 that one of the 12 sampled video segments of a certain round of sampling matches a preset video segment in the preset index library, it indicates that a video segment matching the video file to be retrieved exists in the preset index library, at this time, this embodiment obtains all video segments of the video file to be retrieved, and performs query one by one in the preset index library, taking the video file to be retrieved of 1440 video segments in total of 2 hours as an example, performs retrieval one by one in the preset index library of 1440 video segments in total of 2 hours, and determines all matched preset video segments in the preset index library, where all matched preset video segments are the retrieval result of the video file to be retrieved.
In the embodiment, all video segments of the video file can be retrieved only if the sampled video segments are matched in the preset index database, the number of the sampled video segments obtained by sampling is in proportion to all the video segments, and whether matched retrieval results exist in the preset index database can be quickly determined by utilizing the sampled video segments obtained by sampling to perform sampling retrieval in the preset index database, so that the retrieval efficiency is greatly improved.
And S107, if the judgment result is yes, determining that the video file to be retrieved fails to be matched in the preset index library.
For example, for a 150 frame video segment, sampling 150 times can achieve full coverage. If sampling is carried out for 150 times, and no sampled video segment is matched in the preset index database, the matching of the video file to be retrieved in the preset index database fails, at this time, sampling is not carried out any more, and the matching result of resampling is the same as the matching result of any sampling in 150 times, so that no significance is realized. Specifically, if the frame number difference between the current sampling start frame and the first sampling start frame is equal to or greater than the preset sliding frame number, it indicates that the sampling frequency of the file to be retrieved reaches the upper limit. At this time, the matching of the video file to be retrieved in the preset index library is considered to be failed, that is, no video segment in the preset index library is matched with the video file to be retrieved.
In the video file retrieval method provided by this embodiment, at least one round of sampling is performed on a video file to be retrieved, if all sampled video segments of the previous round of sampling fail to be matched in the preset index library, one frame is slid to perform the next round of sampling until at least one sampled video segment of a certain round successfully matches in the preset index library, then all video segments of the video file to be retrieved are comprehensively retrieved in the preset index library, or if the retrieval still fails after a sufficient number of frames are slid, it is indicated that there is no video file matched with the video to be retrieved in the preset index library. The method can quickly determine whether the matched retrieval result exists in the preset index database, and greatly improves the retrieval efficiency.
Fig. 2 is a flowchart of a video file retrieval method according to another embodiment of the present invention. On the basis of the above embodiment, a possible implementation manner of "inquiring whether there is at least one preset video segment matching the sample video segment in the preset index database" is to "respectively obtain feature codes of each sample video segment; and inquiring whether at least one preset video segment matched with the sampled video segment exists in the preset index database according to the corresponding relation between the feature codes and the preset video file. "and/or" whether a preset video segment matched with the video segment exists in the preset index database is queried "is realized by respectively acquiring feature codes corresponding to the video segments; and inquiring whether a preset video segment matched with the video segment exists in a preset index library according to the corresponding relation between the feature code and the preset video file. "
As shown in fig. 2, the video file retrieval method of the present embodiment includes the following steps:
s201, adding 1 frame to the previous sampling start frame to serve as a current sampling start frame, judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number, if not, executing a step S202, and if so, executing a step S207.
S202, if the judgment result is negative, sampling the video file to be retrieved from the current sampling start frame according to a preset sampling rule to obtain at least one sampling video segment, and executing the step S203.
The implementation manners of steps S201 and S202 in this embodiment are the same as the implementation manners of steps S101 and S102 in the above embodiments, and are not described herein again.
S203, respectively obtaining the feature codes of the sampled video segments, inquiring whether at least one preset video segment matched with the sampled video segments exists in the preset index database according to the corresponding relation between the feature codes and the preset video segments, if so, executing the step S204, and if not, returning to execute the step S201.
Specifically, the preset index library includes a corresponding relationship between the feature codes and the preset video files, that is, the preset index library is created according to the corresponding relationship between the feature codes and the preset video segments. Optionally, an inverted index technology is adopted, and a preset index library is created according to the corresponding relation between the feature codes and the preset video segments.
For example, in the embodiment, a Hash (Hash) signature algorithm may be used to perform feature coding on a video segment, where the feature coding obtained through the Hash (Hash) signature algorithm may be regarded as a word, and a preset index library may look at a dictionary storing correspondence between the word and the video segment, so that retrieval of a video file is changed into a word query in the dictionary, and retrieval is simpler and more convenient. Therefore, in this embodiment, feature codes of each sampled video segment need to be obtained, and then whether at least one preset video segment matching the sampled video segment exists in the preset index database is queried according to the corresponding relationship between the feature codes and the preset video segments.
Briefly introduced herein is the Hash signature algorithm, also known as Digital Digest (Digital Digest) or Digital fingerprint (Digital fingerprint Print), which uses a single Hash function to "Digest" the plaintext to be encrypted into a string of fixed length (128 bits) of ciphertext, also known as a Digital fingerprint, which has a fixed length, and different plaintext digests into ciphertext, the result of which is always different, and the digests of the same plaintext must be identical. To this end, the present embodiment may convert the video segments into feature codes in the form of digital fingerprints by a Hash (Hash) signature algorithm.
It should be noted that the method is not limited to acquiring the feature codes of the video segments and creating the preset index library based on the corresponding relationship between the feature codes and the preset video segments. For example, feature recognition may be performed on the video clip, key features of the video clip are obtained, and an index library is created based on a corresponding relationship between the key features and a preset video clip.
And S204, if the video file exists, segmenting the video file to be retrieved according to a preset rule by taking the current sampling initial frame as a segmentation initial frame to obtain all video segments of the video file to be retrieved, and executing the step S205.
S205, respectively obtaining the feature codes corresponding to the video segments, inquiring whether a preset video segment matched with the video segment exists in a preset index library according to the corresponding relation between the feature codes and a preset video file, and executing the step S206.
For example, in the embodiment, a Hash (Hash) signature algorithm may be used to perform feature coding on a video segment, where the feature coding obtained through the Hash (Hash) signature algorithm may be regarded as a word, and a preset index library may look at a dictionary storing correspondence between the word and the video segment, so that retrieval of a video file is changed into a word query in the dictionary, and retrieval is simpler and more convenient. Therefore, in this embodiment, feature codes corresponding to the video segments need to be obtained, and then, whether the preset video segments matching the video segments exist in the preset index library is queried according to the corresponding relationship between the feature codes and the preset video files.
S206, determining the preset video clip matched with the video clip as a retrieval result of the video file to be retrieved.
And S107, if the judgment result is yes, determining that the video file to be retrieved fails to be matched in the preset index library.
The implementation manners of steps S206 and S207 in this embodiment are the same as the implementation manners of steps S106 and S107 in the above embodiments, and are not described again here.
In the video file retrieval method provided by this embodiment, feature coding is performed on a video segment by using a Hash (Hash) signature algorithm, the obtained feature coding can be regarded as one word, and a preset index library can be regarded as a dictionary storing a corresponding relationship between words and video segments, so that retrieval of a video file becomes a word query in the dictionary, and can also be regarded as a word similar to a search engine for searching, and retrieval is simpler and more convenient.
Fig. 3 is a flowchart of a video file retrieval method according to another embodiment of the present invention. On the basis of the above embodiments, the present embodiment explains the creation of the preset index library.
As shown in fig. 3, the video file retrieval method of the present embodiment includes the following steps:
s301, at least one preset video file is obtained.
S302, segmenting at least one preset video file respectively to obtain preset video segments corresponding to the preset video files.
For example, a preset video file may be understood as a video file with known related information. For a 2-hour preset video file, which includes 30 frames per second, if 150 frames of data are counted in 5 consecutive seconds as one video segment, the 2-hour preset video file may be divided into 2 × 60 × 60/5 — 1440 video segments.
S303, creating the preset index library according to the preset video clip.
For example, the mass of preset video files corresponds to the mass of preset video clips, and a preset index library with a very large sample size can be created according to the mass of preset video clips, so that subsequent retrieval of video resources is facilitated.
In a possible implementation manner, the specific implementation manner of step S303 is: acquiring the feature code of the preset video clip; establishing a corresponding relation between the feature codes and preset video clips; and establishing the preset index library according to the corresponding relation.
Specifically, by performing feature coding on the preset video segment, the preset video segment can be regarded as a word, and accordingly, the preset video file can be regarded as a document consisting of a group of words. In this embodiment, a preset index library is created by establishing a corresponding relationship between the feature codes and the preset video segments, and then only the feature codes of the video file to be retrieved are queried in the preset index library, so that the video file can be retrieved.
Further, after step S303, the following steps may be further included:
s304, obtaining the video clip corresponding to the video file to be put in storage.
S305, inquiring whether a preset video clip matched with the video clip corresponding to the video file to be put in storage exists in the preset index library.
Specifically, for a video file to be stored in a preset index library, first querying whether a preset video segment matching with a video segment corresponding to the video file to be stored exists in the preset index library, and if not, storing the video file according to the method from step S301 to step S303.
And S306, if the video file exists, re-segmenting the video file to be warehoused according to the preset video segment matched with the video segment corresponding to the video file to be warehoused.
And S307, updating the preset index library according to the video segment corresponding to the video file to be stored in the library, which is obtained by re-segmentation.
Specifically, if the preset index library is queried to have the preset video segment matched with the video segment corresponding to the video file to be put in storage, the video file is re-segmented. For example, for the first segment of a preset video file of 2 hours, which includes 30 frames per second, starting from the first frame, if 150 frames of data are counted as one video segment in 5 consecutive seconds, the preset video file of 2 hours may be divided into 2 × 60 × 60/5 — 1440 video segments. If the 3 rd video segment is searched, a preset video segment matched with the 3 rd video segment exists in the preset index database. Then, taking the starting frame in the third segment of video segment, that is, the 301 th frame, as a re-segmentation starting frame, re-dividing the video file to be binned into 1440 video segments, and binning the 1440 video segments into the preset index library to update the preset index library, thereby ensuring the reliability of the preset index library and ensuring the reliability of video resource retrieval by using the preset index library.
Fig. 4 is a schematic structural diagram of a video file retrieval apparatus according to an embodiment of the present invention.
As shown in fig. 4, the video file search device of the present embodiment includes:
the calculating module 01 is used for adding 1 frame to the last sampling start frame to be used as a current sampling start frame;
the judging module 02 is used for judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number or not;
the first processing module 03 is configured to sample the video file to be retrieved from the current sampling start frame according to a preset sampling rule if the determination result is negative, and obtain at least one sampled video segment;
a first query module 04, configured to query whether there is at least one preset video segment matching the sample video segment in a preset index library, where the preset index library includes the preset video segments;
the second processing module 05 is configured to segment the video file to be retrieved according to a preset rule by using the current sampling start frame as a segmentation start frame if the video file to be retrieved exists, and obtain all video segments of the video file to be retrieved;
the second query module 06 is configured to query whether a preset video segment matching the video segment exists in the preset index library;
and the determining module 07 is configured to determine a preset video segment matched with the video segment as a retrieval result of the video file to be retrieved.
Further, the preset index library includes a corresponding relationship between feature codes and preset video files, and the first query module is specifically configured to obtain the feature codes of the sample video segments respectively; and inquiring whether at least one preset video segment matched with the sampled video segment exists in the preset index database according to the corresponding relation between the feature codes and the preset video file.
The second query module is specifically configured to obtain feature codes corresponding to the video segments respectively; and inquiring whether a preset video segment matched with the video segment exists in a preset index library according to the corresponding relation between the feature code and the preset video file.
Further, still include: a creation module;
the creating module is specifically used for acquiring at least one preset video file; segmenting at least one preset video file respectively to obtain preset video clips corresponding to the preset video files; and creating the preset index library according to the preset video clip.
The specific manner in which the respective modules perform operations has been described in detail in relation to the apparatus in this embodiment, and will not be elaborated upon here.
The video file retrieval device provided by this embodiment performs at least one round of sampling on a video file to be retrieved, if all sampled video segments of the previous round of sampling fail to be matched in the preset index library, slides one frame to perform the next round of sampling until at least one sampled video segment of a certain round successfully matches in the preset index library, then performs overall retrieval on all video segments of the video file to be retrieved in the preset index library, or if the retrieval still fails after sliding for a sufficient number of times, it indicates that there is no video file matched with the video to be retrieved in the index library. The device can quickly determine whether the matched retrieval result exists in the preset index library, and greatly improves the retrieval efficiency.
In order to achieve the above object, an embodiment of the present invention further provides a computer device.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 5, the computer apparatus includes: a memory 11, a processor 12 and a computer program stored on the memory 11 and executable on the processor 12.
The processor 12, when executing the program, implements the video file retrieval method provided in the embodiment shown in any one of fig. 1 to 3.
Further, the computer device further comprises:
a communication interface 13 for communication between the memory 11 and the processor 12.
A memory 11 for storing a computer program operable on the processor 12.
The memory 11 may comprise a high-speed RAM memory, and may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory.
And a processor 12, configured to implement the video file retrieval method provided in the embodiments shown in fig. 1 to fig. 3 when executing the program.
If the memory 11, the processor 12 and the communication interface 13 are implemented independently, the communication interface 13, the memory 11 and the processor 12 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (enhanced Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this does not mean only one bus or one type of bus.
Alternatively, in practical implementation, if the memory 11, the processor 12 and the communication interface 13 are integrated on one chip, the memory 11, the processor 12 and the communication interface 13 may complete communication with each other through an internal interface.
The processor 12 may be a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present invention.
To achieve the above object, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a video file retrieval method as provided in any one of the embodiments shown in fig. 1 to 3.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (12)

1. A method for retrieving a video file, comprising:
adding 1 frame to the previous sampling start frame as a current sampling start frame, and judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number or not;
if the judgment result is negative, sampling the video file to be retrieved from the current sampling initial frame according to a preset sampling rule to obtain at least one sampling video segment;
inquiring whether at least one preset video segment matched with the sampling video segment exists in a preset index library, wherein the preset index library comprises the preset video segments;
if the video file to be retrieved exists, taking the current sampling initial frame as a segmentation initial frame, segmenting the video file to be retrieved according to a preset rule, and acquiring all video segments of the video file to be retrieved;
inquiring whether a preset video clip matched with the video clip exists in the preset index library or not;
determining a preset video clip matched with the video clip as a retrieval result of the video file to be retrieved;
wherein, the current sampling start frame and the segmentation start frame are both for the video file to be retrieved.
2. The method as claimed in claim 1, wherein after said determining whether the frame number difference between the current sampling start frame and the first sampling start frame reaches the preset sliding frame number, further comprising:
and if so, determining that the video file to be retrieved fails to be matched in the preset index library.
3. The method of claim 1, wherein after querying a predetermined index repository for the presence of at least one predetermined video segment matching the sampled video segment, further comprising:
if not, the step of adding 1 frame to the last sampling start frame as the current sampling start frame is returned to be executed.
4. The method of claim 1, wherein the predetermined index library comprises a corresponding relationship between feature codes and predetermined video files;
the querying whether at least one preset video segment matching the sampled video segment exists in a preset index database comprises:
respectively acquiring the feature codes of the sampled video clips;
and inquiring whether at least one preset video segment matched with the sampled video segment exists in the preset index database according to the corresponding relation between the feature codes and the preset video file.
5. The method of claim 4, wherein the querying whether the preset video segment matching the video segment exists in the preset index database comprises:
respectively acquiring feature codes corresponding to the video clips;
and inquiring whether a preset video segment matched with the video segment exists in a preset index library according to the corresponding relation between the feature code and the preset video file.
6. The method of claim 5, wherein said separately obtaining the feature code for each of said sampled video segments comprises:
respectively acquiring the feature codes of the sampled video segments by utilizing a Hash signature algorithm;
and/or the respectively obtaining the feature codes corresponding to the video segments comprises:
and respectively acquiring the feature codes corresponding to the video segments by utilizing the Hash signature algorithm.
7. The method of claim 1, further comprising:
acquiring at least one preset video file;
segmenting at least one preset video file respectively to obtain preset video clips corresponding to the preset video files;
and creating the preset index library according to the preset video clip.
8. The method of claim 7, wherein the creating the pre-indexed library from the pre-defined video segments comprises:
acquiring the feature code of the preset video clip;
establishing a corresponding relation between the feature codes and preset video clips;
and establishing the preset index library according to the corresponding relation.
9. The method of claim 7, wherein after the creating the preset index library from the preset video segment, further comprising:
acquiring a video clip corresponding to a video file to be put in storage;
inquiring whether a preset video clip matched with the video clip corresponding to the video file to be stored exists in the preset index library;
if so, re-segmenting the video file to be warehoused according to a preset video segment matched with the video segment corresponding to the video file to be warehoused;
and updating the preset index library according to the video segments corresponding to the video files to be stored obtained by re-segmentation.
10. A video file retrieval apparatus, comprising:
the calculation module is used for adding 1 frame to the last sampling start frame to be used as a current sampling start frame;
the judging module is used for judging whether the frame number difference between the current sampling start frame and the first sampling start frame reaches a preset sliding frame number or not;
the first processing module is used for sampling the video file to be retrieved from the current sampling initial frame according to a preset sampling rule if the judgment result is negative, and acquiring at least one sampling video segment;
the first query module is used for querying whether at least one preset video segment matched with the sampling video segment exists in a preset index library, and the preset index library comprises the preset video segments;
the second processing module is used for segmenting the video file to be retrieved according to a preset rule by taking the current sampling initial frame as a segmentation initial frame if the video file to be retrieved exists, and acquiring all video segments of the video file to be retrieved;
the second query module is used for querying whether a preset video segment matched with the video segment exists in the preset index library or not;
the determining module is used for determining a preset video clip matched with the video clip as a retrieval result of the video file to be retrieved;
wherein, the current sampling start frame and the segmentation start frame are both for the video file to be retrieved.
11. A computer device, comprising: a processor and a memory;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the video file retrieval method according to any one of claims 1 to 9.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of retrieving a video file according to any one of claims 1 to 9.
CN201711068816.8A 2017-11-03 2017-11-03 Video file retrieval method and device Active CN107943849B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711068816.8A CN107943849B (en) 2017-11-03 2017-11-03 Video file retrieval method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711068816.8A CN107943849B (en) 2017-11-03 2017-11-03 Video file retrieval method and device

Publications (2)

Publication Number Publication Date
CN107943849A CN107943849A (en) 2018-04-20
CN107943849B true CN107943849B (en) 2020-05-08

Family

ID=61933267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711068816.8A Active CN107943849B (en) 2017-11-03 2017-11-03 Video file retrieval method and device

Country Status (1)

Country Link
CN (1) CN107943849B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111522996B (en) * 2020-04-09 2023-09-08 北京百度网讯科技有限公司 Video clip retrieval method and device
CN113065025A (en) * 2021-03-31 2021-07-02 厦门美图之家科技有限公司 Video duplicate checking method, device, equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1605211A (en) * 2001-12-21 2005-04-06 皇家飞利浦电子股份有限公司 Method and apparatus for motion compensated temporal interpolation of video sequences
CN1940926A (en) * 2006-03-15 2007-04-04 中国人民大学 Efficient musical database query method based on humming
CN101840435A (en) * 2010-05-14 2010-09-22 中兴通讯股份有限公司 Method and mobile terminal for realizing video preview and retrieval
CN101894251A (en) * 2009-05-21 2010-11-24 国家广播电影电视总局广播科学研究院 Video detection method and device
CN101950366A (en) * 2010-09-10 2011-01-19 北京大学 Method for detecting and identifying station logo
CN103188564A (en) * 2011-12-28 2013-07-03 联想(北京)有限公司 Electronic equipment and information processing method thereof
CN103514293A (en) * 2013-10-09 2014-01-15 北京中科模识科技有限公司 Method for video matching in video template library
CN106599789A (en) * 2016-07-29 2017-04-26 北京市商汤科技开发有限公司 Video class identification method and device, data processing device and electronic device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008136933A1 (en) * 2007-05-07 2008-11-13 Thomson Licensing Method and apparatus for processing video sequences

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1605211A (en) * 2001-12-21 2005-04-06 皇家飞利浦电子股份有限公司 Method and apparatus for motion compensated temporal interpolation of video sequences
CN1940926A (en) * 2006-03-15 2007-04-04 中国人民大学 Efficient musical database query method based on humming
CN101894251A (en) * 2009-05-21 2010-11-24 国家广播电影电视总局广播科学研究院 Video detection method and device
CN101840435A (en) * 2010-05-14 2010-09-22 中兴通讯股份有限公司 Method and mobile terminal for realizing video preview and retrieval
CN101950366A (en) * 2010-09-10 2011-01-19 北京大学 Method for detecting and identifying station logo
CN103188564A (en) * 2011-12-28 2013-07-03 联想(北京)有限公司 Electronic equipment and information processing method thereof
CN103514293A (en) * 2013-10-09 2014-01-15 北京中科模识科技有限公司 Method for video matching in video template library
CN106599789A (en) * 2016-07-29 2017-04-26 北京市商汤科技开发有限公司 Video class identification method and device, data processing device and electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
视频数据存储与检索方法的研究与实现;边步梅;《中国优秀硕士学位论文全文数据库 信息科技辑》;20160115;I138-904 *

Also Published As

Publication number Publication date
CN107943849A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
EP3767483A1 (en) Method, device, system, and server for image retrieval, and storage medium
CN107784110B (en) Index establishing method and device
US9348832B2 (en) Method and device for reassembling a data file
WO2009007183A1 (en) Generating a fingerprint of a bit sequence
CA2931184A1 (en) A method of generating a reference index data structure and method for finding a position of a data pattern in a reference data structure
CN114328545B (en) Data storage and query method, device and database system
CN107943849B (en) Video file retrieval method and device
CN113609347A (en) Data storage and query method, device and database system
Moia et al. Similarity digest search: A survey and comparative analysis of strategies to perform known file filtering using approximate matching
CN105488197B (en) Domain-based retrieval method in vertical search, and newly added document processing method and device
CN107590233B (en) File management method and device
CN113010477B (en) Method and device for retrieving metadata of persistent memory file system and storage structure
CN116821053B (en) Data reporting method, device, computer equipment and storage medium
CN113821630B (en) Data clustering method and device
CN116226681B (en) Text similarity judging method and device, computer equipment and storage medium
CN116303580A (en) Data query method, device and database system
CN113992625B (en) Domain name source station detection method, system, computer and readable storage medium
CN107315806B (en) Embedded storage method and device based on file system
CN107704472B (en) Method and device for searching data block
Moia et al. A comparative analysis about similarity search strategies for digital forensics investigations
CN112818007B (en) Data processing method and device and readable storage medium
CN115729752A (en) Register checking method and device and storage medium
CN110941730B (en) Retrieval method and device based on human face feature data migration
CN108132971B (en) Analysis method and device for database fragment files
CN113946365A (en) Page identification method and device, computer 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
TA01 Transfer of patent application right

Effective date of registration: 20190903

Address after: 100192 Dongsheng Science Park, Zhongguancun, 66 Xixiaokou Road, Haidian District, Beijing

Applicant after: Green Bay Network Technology Co., Ltd.

Address before: 100089 Beijing Haidian District Xixiaokou Road 66 Zhongguancun Dongsheng Science Park B-6 Building B 5 floors

Applicant before: Grass count language (Beijing) Technology Co., Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant