Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:55:10+00:00 2026-06-03T17:55:10+00:00

I used to calculate the duration of MP3 files server-side using ffmpeg – which

  • 0

I used to calculate the duration of MP3 files server-side using ffmpeg – which seemed to work fine. Today i discovered that some of the calculations were wrong. Somehow, for some reason, ffmpeg will miscalculate the duration and it seems to happen with variable bit rate mp3 files only.

When testing this locally, i noticed that ffmpeg printed two extra lines in green.

Command used:

ffmpeg -i song_9747c077aef8.mp3

ffmpeg says:

[mp3 @ 0x102052600] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x102052600] Estimating duration from bitrate, this may be inaccurate

After a nice, warm google session, i discovered some posts on this, but no solution was found.

I then tried to increase the maximum duration:

ffmpeg -analyzeduration 999999999 -i song_9747c077aef8.mp3

After this, ffmpeg returned only the second line:

[mp3 @ 0x102052600] Estimating duration from bitrate, this may be inaccurate

But in either case, the calculated duration was just plain wrong. Comparing it to VLC i noticed that there the duration is correct.

After more research i stumbled over mp3info – which i installed and used.

mp3info -p "%S" song_9747c077aef8.mp3

mp3info then returned the CORRECT duration, but only as an integer, which i cannot use as i need a more accurate number here. The reason for this was explained in a comment below, by user blahdiblah – mp3info is simply pulling ID3 info from the file and not actually performing any calculations.

I also tried using mplayer to retrieve the duration, but just as ffmpeg, mplayer is returning the wrong value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:55:13+00:00Added an answer on June 3, 2026 at 5:55 pm

    I finally found a proper solution to this problem using sox – which returns the correct information.

    sox file.mp3 -n stat
    Samples read:          19321344
    Length (seconds):    219.062857
    Scaled by:         2147483647.0
    Maximum amplitude:     1.000000
    Minimum amplitude:    -1.000000
    Midline amplitude:    -0.000000
    Mean    norm:          0.141787
    Mean    amplitude:     0.000060
    RMS     amplitude:     0.191376
    Maximum delta:         0.947598
    Minimum delta:         0.000000
    Mean    delta:         0.086211
    RMS     delta:         0.115971
    Rough   frequency:         4253
    Volume adjustment:        1.000
    

    Length (seconds): 219.062857

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Windows Forms application which is used to calculate the solutions
how can i calculate the total disc space available + free space + used
Does anyone know how to calculate time difference in C++ in milliseconds? I used
I'd like to calculate a path in a MsBuild task, to be used by
How do i calculate Dip and Strike from iphone. They are used to measure
The code below is used to calculate the miles between two cities. In this
According to wiki shifts can be used to calculate powers of 2: A left
How does free calculate used memory and why does it differ from what /proc
So I have this function used to calculate statistics (min/max/std/mean). Now the thing is
I have 3 sliders that are used calculate a number of MB used online.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.