I have a .mov
file with a video and several audio tracks. To md5 the entire file I can do:
[pdev@d ~]$ md5sum 1_TRAILER_HD_2CH_ES419_ENSUB_16X9_178_2398_DIGITAL_FINAL.mov
042f0e177fe25f562079cc07208ec446
Though when I try doing the same thing in ffmpeg
, I get a different value:
$ ffmpeg -i 1_TRAILER_HD_2CH_ES419_ENSUB_16X9_178_2398_DIGITAL_FINAL.mov -f md5 -
MD5=74bd904f1edb4eb1368040e2792d7497 0kB time=00:01:59.11 bitrate= 0.0kbits/s speed=2.36x
frame= 2867 fps= 56 q=-0.0 Lsize= 0kB time=00:01:59.57 bitrate= 0.0kbits/s speed=2.35x
video:23222700kB audio:22421kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Why is the value different? Additionally, how can I checksum only the video track? I have various files that have different audio tracks and want to see if I have the same video track on those files.
Update: I believe this answer shows how to compute an audio-only checksum, but not sure about video-only: https://superuser.com/a/1044419/118248.
md5sum
includes the complete file.ffmpeg
is only computing the MD5 for the video and/or audio streams. Useful if you don't want metadata or other non-media stream data to affect the MD5. It will also allow you to get the checksum for particular streams (video or audio only, or both at the same time, or separate hash for each). You also have the choice of many algorithms (MD5, SHA256, CRC32, adler32, etc).Add the -map
option to only choose the video stream(s). Using -map
disables the default stream selection behavior and allows you to manually choose the streams you want.
The video and/or audio will be fully decoded. This can be slow.
ffmpeg -i input.mp4 -map 0:v -f md5 -
This just gets the MD5 using stream copy mode. There is no decoding.
ffmpeg -i input.mp4 -map 0:v -c copy -f md5 -
Using the streamhash muxer:
ffmpeg -i input.mp4 -map 0 -c copy -f streamhash -hash md5 -
...
0,v,MD5=50224fec84bc6dfde90d742bcf1d2e01
1,a,MD5=1d2a32ed72798d66e0110bd02df2be65
Using the framehash muxer:
ffmpeg -i input.mp4 -map 0 -f framehash -