How can I validate a video file from a script?

后端 未结 5 1272
一个人的身影
一个人的身影 2021-02-09 03:17

I have a server with lots of video files. After a restore, I noticed that the checksum of a couple of files changed. Since I don\'t have checksums for all files, I wanted write

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-09 03:46

    If you are working with MP4 files you may want to have a look at the mpeg4ip project, specifically the tools like mp4videoinfo or mp4info. This may be enough to meet your needs, and is very quick.

    From the front page:

    • mp4dump Utility to dump MP4 file meta-information in text form
    • mp4trackdump Utility to dump MP4 file track information in text form
    • mp4info Utility to display MP4 file summary
    • mp4videoinfo Utility to dump information about MP4 file video tracks
    • avidump Utility to display AVI file summary
    • yuvdump Utility to display a raw video file on the screen
    • mpeg_ps_info Utility to display streams in an mpeg program stream or vob file
    • mpeg_ps_extract Utility to extract elementary streams in an mpeg program stream or vob file

    Here is some sample output of a MP4 taken on my Nokia N95:

    manoa:Movies stu$ mp4info 20081017001.mp4 
    mp4info version 1.5.0.1
    20081017001.mp4:
    Track   Type    Info
    1   video   MPEG-4 Unknown Profile(4), 3.620 secs, 2700 kbps, 640x480 @ 23.480663 fps
    2   audio   MPEG-4 AAC LC, 3.797 secs, 97 kbps, 48000 Hz
    manoa:Movies stu$ 
    manoa:Movies stu$ 
    manoa:Movies stu$ mp4videoinfo 20081017001.mp4
    mp4videoinfo version 1.5.0.1
    tracks 1
    mp4file 20081017001.mp4, track 1, samples 85, timescale 30000
    sampleId      1, size 24110 time 0(0) VOP-I
    sampleId      2, size  9306 time 4076(135) VOP-P
    sampleId      3, size 13071 time 5104(170) VOP-P
    ... (a bunch more frames and a bit of info)  ...
    sampleId     59, size  8702 time 64975(2165) VOP-P
    sampleId     60, size  8826 time 65980(2199) VOP-P
    sampleId     61, size  9819 time 66966(2232) GOV VOP-I
    sampleId     62, size  5591 time 67986(2266) VOP-P
    ... (a bunch more frames and a bit of info)  ...
    sampleId     83, size 10188 time 105546(3518) VOP-P
    sampleId     84, size  6533 time 106585(3552) VOP-P
    sampleId     85, size  6032 time 107601(3586) VOP-P
    manoa:Movies stu$
    

提交回复
热议问题