Fathy Eltanany
Fathy Eltanany

Reputation: 11

the same audio have different length using different tools (librosa,ffprobe)

I want to measure an audio file's duration.
I'm using two different tools and got different values.

  1. ffprobe:
    I'm using this line to get duration using ffprobe
 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

Answers (1)

szatmary
szatmary

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

Related Questions