CN112437346A - Method for judging whether video file is complete or not - Google Patents
Method for judging whether video file is complete or not Download PDFInfo
- Publication number
- CN112437346A CN112437346A CN202011215433.0A CN202011215433A CN112437346A CN 112437346 A CN112437346 A CN 112437346A CN 202011215433 A CN202011215433 A CN 202011215433A CN 112437346 A CN112437346 A CN 112437346A
- Authority
- CN
- China
- Prior art keywords
- video
- file
- video file
- complete
- metadata
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 238000000605 extraction Methods 0.000 claims abstract description 7
- 230000010365 information processing Effects 0.000 abstract description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/854—Content authoring
- H04N21/8547—Content authoring involving timestamps for synchronizing content
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/854—Content authoring
- H04N21/85406—Content authoring involving a specific file format, e.g. MP4 format
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention relates to the technical field of computer multimedia (image and video) information processing, in particular to a method for judging whether a video file is complete, which aims to solve the problem of long time consumption when judging the integrity of a larger video file in the prior art and has the technical key points that: comprises the following steps: reading a file and extracting metadata of a video file; if the metadata extraction fails, the conclusion that the video file is incomplete is obtained, and the operation is quitted, and if the metadata extraction succeeds, the operation enters the next step; and decoding the metadata to the last frame according to the extracted metadata, comparing the timestamp of the last frame with the video duration T, and if the timestamp is less than the video duration T, obtaining the conclusion that the video file is incomplete, otherwise, indicating that the file is complete. According to the method for judging whether the video file is complete, the source file does not need to be accessed in the process of detecting the video file, and whether the video file is complete can be judged more quickly compared with a complete playing method.
Description
Technical Field
The invention relates to the technical field of computer multimedia (image and video) information processing, in particular to a method for judging whether a video file is complete or not.
Background
Video files acquired from a network or some channels sometimes need to be judged whether the files are complete, and in the case of being capable of accessing the source files, whether the source files are complete or not can be judged by comparing the values of the source files with the MD5 or whether the file sizes are matched, but in some cases, for example, in the case of being disconnected from the network or having no access to the source files for other reasons, whether the files are complete or not can be judged only by analyzing the attributes of the video files.
The traditional method for judging the integrity of a video file needs to compare the MD5 values of the video file and a source file or whether the video file is matched with the source file in order to judge whether the video file is complete or not, and the method is not suitable for the situation that the source file cannot be accessed.
The integrity of the video needs to be judged under the condition that the source file cannot be accessed, and the video is played completely, and if the playing time length does not match with the video time length, the description file is not complete. This method is time consuming in relation to the video duration, which is often time consuming for larger videos.
Disclosure of Invention
Therefore, the technical problem to be solved by the present invention is to overcome the defect of long time consumption in the prior art for judging the integrity of a large video, thereby providing a method for judging whether a video file is complete.
The technical purpose of the invention is realized by the following technical scheme:
a method for judging whether a video file is complete comprises the following steps:
s1: reading a video file and extracting metadata of the video file;
s2: if the metadata extraction fails, the conclusion that the video file is incomplete is obtained, and the operation is quitted, and if the metadata extraction succeeds, the operation enters the next step;
s3: and decoding the metadata to the last frame according to the extracted metadata, comparing the timestamp of the last frame with the video duration T, and if the timestamp is less than the video duration T, obtaining the conclusion that the video file is incomplete, otherwise, indicating that the file is complete.
Preferably, in S3, when the video duration T is less than 5 seconds, the video file is decoded from the beginning of the file until the last frame.
Preferably, in S3, when the duration T of the video file is greater than 5 seconds, the API interface seek of the multimedia processing tool is called to T-5 seconds, if seek fails, a conclusion that the video is incomplete is obtained, if seek succeeds, decoding is started from the current frame until the last frame, if the timestamp of the last frame is less than the duration T of the video, the file is incomplete, otherwise the file is complete.
According to the method for judging whether the video file is complete, whether the video is complete is confirmed by comparing the timestamp of the last frame with the duration in the video metadata. The method has the advantages that the source file does not need to be accessed in the process of detecting the video file, the file analysis time is shortened by rapidly jumping to the tail of the file through a seek method, and whether the video file is complete or not can be judged more rapidly compared with a complete playing method.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic step diagram of a method for determining whether a video file is complete according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, aspects and advantages of the present invention more apparent, it is to be understood that the specific embodiments described herein are for purposes of illustration only and are not to be construed as limiting the invention.
The English part of the text is explained as follows:
ffmpeg open source tool: open source computer program capable of recording, converting digital audio and video and converting them into stream
API interface: application program interface
seek: probing
The present invention will be described in further detail below with reference to the accompanying drawings and examples.
Referring to fig. 1, a method for determining whether a video file is complete includes the following steps:
s1: and reading the video file and extracting the metadata of the video file.
Specifically, the metadata includes information such as a video duration (T).
S2: if the metadata extraction fails, the conclusion that the video file is incomplete is obtained, and the operation is quitted; otherwise, the next step is carried out.
S3: and decoding the metadata to the last frame according to the extracted metadata, comparing the timestamp of the last frame with the video duration T, and if the timestamp is less than the video duration T, obtaining the conclusion that the video file is incomplete, otherwise, indicating that the file is complete.
Specifically, in one embodiment, when the video duration T is less than 5 seconds, the video file is decoded from the beginning of the file until the last frame.
In another embodiment, when the video file duration T is greater than 5 seconds, an API interface seek of the multimedia processing tool is called to T-5 seconds, if seek fails, a conclusion is made that the video is incomplete, if seek succeeds, decoding is started from the current frame until the last frame, if the last frame timestamp is less than the video duration T, the file is incomplete, otherwise the file is complete. Therefore, the file analysis time can be effectively reduced in the detection process, and the information whether the video is complete can be obtained without accessing the source file.
According to the method for judging whether the video file is complete, whether the video is complete or not is confirmed by comparing the timestamp of the last frame with the duration in the video metadata. Therefore, the source file does not need to be accessed in the process of detecting the video file, and whether the video file is complete or not can be judged more quickly compared with the method of complete playing.
It should be understood that the above examples are only for clarity of illustration and are not intended to limit the embodiments. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. And obvious variations or modifications therefrom are within the scope of the invention.
Claims (3)
1. A method for judging whether a video file is complete is characterized in that: comprises the following steps:
s1: reading a video file and extracting metadata of the video file;
s2: if the metadata extraction fails, the conclusion that the video file is incomplete is obtained, and the operation is quitted, and if the metadata extraction succeeds, the operation enters the next step;
s3: and decoding the metadata to the last frame according to the extracted metadata, comparing the timestamp of the last frame with the video duration T, and if the timestamp is less than the video duration T, obtaining the conclusion that the video file is incomplete, otherwise, indicating that the file is complete.
2. The method of claim 1, wherein the step of determining whether the video file is complete comprises: in S3, when the video duration T is less than 5 seconds, the video file is decoded from the beginning of the file until the last frame.
3. The method of claim 1, wherein the step of determining whether the video file is complete comprises: in S3, when the duration T of the video file is greater than 5 seconds, an API interface seek of the multimedia processing tool is called to T-5 seconds, if seek fails, a conclusion that the video is incomplete is obtained, if seek succeeds, decoding is started from the current frame until the last frame, if the timestamp of the last frame is less than the duration T of the video, the file is incomplete, otherwise the file is complete.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011215433.0A CN112437346A (en) | 2020-11-04 | 2020-11-04 | Method for judging whether video file is complete or not |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011215433.0A CN112437346A (en) | 2020-11-04 | 2020-11-04 | Method for judging whether video file is complete or not |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112437346A true CN112437346A (en) | 2021-03-02 |
Family
ID=74695258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011215433.0A Pending CN112437346A (en) | 2020-11-04 | 2020-11-04 | Method for judging whether video file is complete or not |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112437346A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103024437A (en) * | 2012-12-28 | 2013-04-03 | 河南辉煌科技股份有限公司 | Video data integrity detection method |
CN104301805A (en) * | 2014-09-26 | 2015-01-21 | 北京奇艺世纪科技有限公司 | Method and device for estimating time span of video |
CN105049915A (en) * | 2015-06-30 | 2015-11-11 | 株洲南车时代电气股份有限公司 | Locomotive video data integrity automatic detection method |
CN106101867A (en) * | 2016-07-20 | 2016-11-09 | 深圳芯智汇科技有限公司 | A kind of FLV of raising video jumps the method broadcasting speed and location accuracy |
WO2020192152A1 (en) * | 2019-03-26 | 2020-10-01 | 广州华多网络科技有限公司 | Video transmission method, root node, child node, p2p server, and system |
-
2020
- 2020-11-04 CN CN202011215433.0A patent/CN112437346A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103024437A (en) * | 2012-12-28 | 2013-04-03 | 河南辉煌科技股份有限公司 | Video data integrity detection method |
CN104301805A (en) * | 2014-09-26 | 2015-01-21 | 北京奇艺世纪科技有限公司 | Method and device for estimating time span of video |
CN105049915A (en) * | 2015-06-30 | 2015-11-11 | 株洲南车时代电气股份有限公司 | Locomotive video data integrity automatic detection method |
CN106101867A (en) * | 2016-07-20 | 2016-11-09 | 深圳芯智汇科技有限公司 | A kind of FLV of raising video jumps the method broadcasting speed and location accuracy |
WO2020192152A1 (en) * | 2019-03-26 | 2020-10-01 | 广州华多网络科技有限公司 | Video transmission method, root node, child node, p2p server, and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1635575A1 (en) | System and method for embedding scene change information in a video bitstream | |
US9961398B2 (en) | Method and device for switching video streams | |
US8295611B2 (en) | Robust video retrieval utilizing audio and video data | |
US8433108B2 (en) | Video fingerprinting | |
EP1610557A1 (en) | System and method for embedding multimedia processing information in a multimedia bitstream | |
US20110289099A1 (en) | Method and apparatus for identifying video program material via dvs or sap data | |
Herley | ARGOS: Automatically extracting repeating objects from multimedia streams | |
US20020048450A1 (en) | System and method of processing MPEG streams for file index insertion | |
US20160371545A1 (en) | Automatic extraction of closed caption data from frames of an audio video (av) stream using image clipping | |
US20060059509A1 (en) | System and method for embedding commercial information in a video bitstream | |
Dumont et al. | Automatic story segmentation for tv news video using multiple modalities | |
WO2013097101A1 (en) | Method and device for analysing video file | |
Park et al. | Exploiting script-subtitles alignment to scene boundary dectection in movie | |
KR20080014872A (en) | Method and apparatus for detecting content item boundaries | |
US20040098750A1 (en) | Method for fixing up last uniform resource locator representing path and file name of multiphoto/video asset | |
CN112437346A (en) | Method for judging whether video file is complete or not | |
CN113507625B (en) | Self-adaptive video restoration method | |
CN113660442B (en) | Video restoration method and device, electronic equipment and readable medium | |
CN113569086B (en) | Method, device, terminal equipment and readable storage medium for aggregating curved libraries | |
US10178415B2 (en) | Chapter detection in multimedia streams via alignment of multiple airings | |
US20060056506A1 (en) | System and method for embedding multimedia compression information in a multimedia bitstream | |
KR20090015266A (en) | System and method for inspection of noxious moving video by video identification | |
CN112218142A (en) | Method and device for separating voice from video with subtitles, storage medium and electronic equipment | |
CN113569719A (en) | Video infringement judgment method and device, storage medium and electronic equipment | |
Altinisik et al. | Automatic generation of H. 264 parameter sets to recover video file fragments |
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 |