Gunjan Patel
Gunjan Patel

Reputation: 2372

Can we get relation between time in second and bytes of audio file?

I want relation between time and bytes in ogg file. If I have 5 second ogg and it's length 68*1024 bytes. If I chunk from that ogg file and save it can I knew that size from before chunk? Like I knew it I want to chunk from 2.4 to 3.2. And give some mathematical calculation and get accurate answer of bytes I can get. Can anyone tell me please if this is possible?

Bit rate 128kbps, 16 bit , sample rate - 44.1Khz, stereo

I used below logic but can't get accurate answer.

Click here

Upvotes: 1

Views: 183

Answers (1)

Scott Stensland
Scott Stensland

Reputation: 28285

Any such direct mapping between file size and play time will work, but not if the codec uses variable bit rate (vbr) encoding ... meaning the compression algorithm is vbr if its success in compressing is dependent on the informational density of the source media ... repetitive audio is more efficiently compressed than say random noise ... vbr algorithms are typically more efficient since to maintain a constant bit rate the algo pads the buffer with filler data just so its throughput is in constant bytes per second

Upvotes: 1

Related Questions