Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Calculation for BitRate (Read 9946 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Calculation for BitRate

Hello All,

I am using FLAC 1.2.0 source code for encoder and decoder. FLAC header doesnt store bitrate for track(correct?), Can anyone help in calculating bitrate for flac track. I have downloaded mp3 plugin for FLAC and in winamp kbps speed varies lot from 100-1000kbps. so does it mean flac files is having Variable bit rate?

In Each frame header sample rate and bits per sample are same as stream info header so doesnt it mean flac file is CBR? sample in frame are differant though?

If FLAC files are default VBR, so how to calculate average bit rate for track ?


If this post is in wrong forum, please point me to correct forum please.


Thanks
jrc.src

Calculation for BitRate

Reply #1
Since FLAC is a lossless compression format, the current bitrate is as high as is necessary to maintain all the information present in the original uncompressed file, so yes, FLAC (like all other lossless formats) is VBR.

In Winamp file info shows you the average bitrate (and compression ratio) for the highlighted file.

Calculation for BitRate

Reply #2
If you open a FLAC-encoded file in VLC and check "Stream and Media Info" (under "View") you can see the bitrate fluctuate.

Calculation for BitRate

Reply #3
Thanks ...Yes, i m clear that FLAC is VBR.

but as seen in VLC bitrate fluctuate.....my question is now how to calculate bit rate for each encoded frame? or other was how decoder knows bitrate of currently decoding frame.

in streaminfo we can get sample rate and bits per sample ...by multiplying these values i can calculate bit rate ..is it correct?

in frame header also i m getting same values .....so how can i calculate bitrate for each frame and kind of average bitrate for whole flac track.

thanks in advance.

Jrc.src

Calculation for BitRate

Reply #4
Average bitrate is total filesize divided by total playtime. If you want to get the current bitrate, try to get the size of the current "frame" and its playtime.

The sampling rate and sample size you are seeing is probably the values for uncompressed input/decompressed output.

Calculation for BitRate

Reply #5
You are asking the obvious thing

bitrate , rate at which bits are processed. bitrate is expressed in kbps most of the time (kilobits per second), i.e. number of bits required for one second.

Generally speaking, bitrate  = filesize (converted to bits, not in bytes)/duration(in seconds).

Since you said you've seen the frames, that they have the same size (for seeking purposes), with a number of samples as indicator, and you can get the sample rate for it. Knowing the instantateous bitrate requirement for each frame is like above =  bit size of the frame/duration(number of samples/samplerate)


<comment>
Your question gives me a feeling of someone wanting to do something for which he doesn't have enough knowledge. *If* that's the case, take some time to familiarize with the subject, else you're probably doing it wrong.
</comment>

Calculation for BitRate

Reply #6
Thanks a lot for your great help. it really solved my question. Once again thanks a lot.


filesize or frame size in bits really didnt clicked at all. may be as per JAZ its due to first time putting foot in Audio thing. But good knowledge gained.

Thanks.

Jrc.src