Reputation: 11
I want to measure an audio file's duration.
I'm using two different tools and got different values.
ffprobe -i audio.m4a -show_entries format=duration -v quiet -of csv="p=0"
result :780.320000
seconds
2. Librosa (python library)
and using this line to get duartion using librosa
y1, sr1 = librosa.load(audio_path, sr=44100)
librosa.get_duration(y1, sr1) * 1000
result 780329.7959183673
milliseconds
Does anyone know what's causing the difference?
Upvotes: 1
Views: 454
Reputation: 31110
This is likely just normal floating point error. The two libraries probably make mathematically similar computations, but use different internal representation of the values which produce small rounding errors. This is normal and expected in floating point numbers.
Upvotes: 2