0

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?

1 Answers1

2

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.

szatmary
  • 29,969
  • 8
  • 44
  • 57