[FFmpeg-devel] hashing audio streams beyond pcm_s16le
Peter B.
pb at das-werkstatt.com
Fri Nov 18 21:21:49 EET 2022
Hello everyone :)
I was wondering about the behavior of FFmpeg's hashing muxer for audio
streams:
For example:
With a 32bit float (f32le) source, FFmpeg seems to be able to generate a
hash for the f32le source - but only if I explicitly know (and then
tell) FFmpeg to do so.
By default, I get the hash of a pcm_s16le version (see examples below).
I remember it defaults to "pcm_s16le" (also mentioned in
https://trac.ffmpeg.org/wiki/framemd5%20Intro%20and%20HowTo), but why is
that so?
And would it be possible to generate the hash of the source audio,
without having to know what raw/uncompressed type it is?
I would like to be able to use the hash to compare lossless conversion
of the content between different audio formats (eg vs FLAC and PCM).
Thank you very much in advance :)
Peter B.
------------------------
Example:
# pcm_f32le defaults to pcm_s16le hash:
$ ffmpeg-git -loglevel quiet -i drums3.wav -f streamhash -hash md5 -
0,a,MD5=08170d6e02fbccc07b61fbf1d7476057
# ...as shown here:
$ ffmpeg-git -loglevel quiet -i drums3.wav -c:a pcm_s16le -f streamhash
-hash md5 -
0,a,MD5=08170d6e02fbccc07b61fbf1d7476057
#
$ ffmpeg-git -loglevel quiet -i drums3.wav -c:a pcm_f32le -f streamhash
-hash md5 -
0,a,MD5=1444cdc20cb8ea30874114cb53729797
$ ffmpeg-git -loglevel quiet -i drums3.wav -c:a copy -f streamhash -hash
md5 -
0,a,MD5=1444cdc20cb8ea30874114cb53729797
$ ffmpeg-git -i drums3.wav -hash md5 -
ffmpeg version N-109029-g1800a0da09 Copyright (c) 2000-2022 the FFmpeg
developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-version3 --enable-postproc --enable-ffplay --enable-swscale
--enable-avfilter --enable-pthreads --enable-bzlib --enable-zlib
--enable-decoder=png --enable-encoder=png --enable-openssl
--samples=../fate-suite --enable-libfreetype --enable-libopenjpeg
--disable-decoder=jpeg2000 --enable-libvpx --enable-libvorbis
--enable-libx264 --enable-libx265
libavutil 57. 42.100 / 57. 42.100
libavcodec 59. 52.100 / 59. 52.100
libavformat 59. 34.101 / 59. 34.101
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 50.100 / 8. 50.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
libpostproc 56. 7.100 / 56. 7.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'drums3.wav':
Duration: 00:00:54.25, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 48000 Hz, 1
channels, flt, 1536 kb/s
More information about the ffmpeg-devel
mailing list