Domanda

If I have an MP3 that has a duration of 3:02 with a bitrate of 192kbps is it possible to get an approximate, or exact, size of the file programatically?

So, taking the 192kbps and multiplying by 182 seconds (3:02) gives

192 x 182 = 34944

Convert that to megabytes and you get 4.26562

In PHP:

($this->duration * $this->bitrate) / 8192;

Is it safe to assume that the approximate filesize of the given MP3 would be 4.2 megabytes?

È stato utile?

Soluzione

Yes, you're absolutely right. I even found a forum with a similar discussion ending with the same conclusion. It contains interesting examples : http://www.wjunction.com/5-general-discussion/80348-calculate-mp3-time-length-bitrate-file-size.html

Altri suggerimenti

Yes, excluding the metadata. Unless it includes lyrics and a thumbnail, the base estimate should be accurate.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top