[MPlayer-users] flac files not showing bitrates, throwing off timing in statusline etc.

SciFi sci-fi at hush.ai
Sun Jul 22 17:18:52 CEST 2007


On 2007-07-22 05:36:54 -0500, Loren Merritt <lorenm at u.washington.edu> said:

> On Sat, 21 Jul 2007, SciFi wrote:
> 
>> I can barely remember this was working but it was quite some time
>> ago (weeks & months) i.e. recent changes probably have affected this
>> area of mplayer.  I believe most flac files were using a bitrate way
>> over 8000, but the 176400 value is probably not right either (IIUC
>> depending on final compression ratio of each track, flacs are
>> roughly half of the CD bitrate of 16*44100*2).
> 
> It never worked as far as determining the correct bitrate for a given
> flac file. But libavcodec's default bitrate for codecs that don't set one
> on their own used to be 800kbps, which just happened to be close to the
> average you get from flac on typical CD-ish music.

hmm that gives me a clue -- somewhere it is assuming the 8000 we see,
but it really needs to be assuming 800000 as you say to be closer ...
I see the computation of sh_audio->i_bps*8*0.001 that converts it to kbps
(around line 113 of libmpcodecs/dec_audio.c) ...
but we need to try looking for the i_bps=8000 assumption...

> Can you even store bitrate in a flac header? I thought it had to be
> derived from filesize and duration (if the source is a file).

I think flac has some official 'tags' where we can derive a computed
value -- see `man metaflac' for the various things we can get from a
file's STREAMINFO block.  Here's a sample of what metaflac (from svn)
can show us (using a little bash script I've hacked) using a real file
found in the a.b.sounds.lossless group:

$ metaflacshowall 01*.flac
md5sum=794f456e80d3decdfa92221c9e72b4ac
min-blocksize=4096
max-blocksize=4096
min-framesize=14
max-framesize=12907
sample-rate=44100
channels=2
bps=16
total-samples=14467152
vendor-tag=reference libFLAC 1.1.4 20070213
ARTIST=DJ Tiësto & DJ Montana
TITLE=Space Shuffle / Chaos
ALBUM=Space Age 2.0
DATE=1999
TRACKNUMBER=01
GENRE=Electronic
COMMENT=Track 1

(lower-case info come from all available official --show-* tags,
while upper-case info come from 'user' tags)

I'm thinking a bitrate _estimate_ could be determined from this
info in conjunction with the filesize somehow, but I'm not coming
up with any useful values (filesize for this particular sample
case is exactly 32976520 bytes) ... my brain hurts now.  ;)
But doing this might be more accurate than assuming 800000,
esp. for cases when bps=24 and other such hi-rez recordings.

btw flac needs to know or computes inputsize when encoding, and
this is required for proper --skip --until --cue-sheet values
(according to their current svn's `man flac').

I know we're stepping across mplayer<->ffmpeg but the display &
timing anomalies are in mplayer AFAIAC.  ;)

> --Loren Merritt

Thanks again for helping.  I hope to figure it out...






More information about the MPlayer-users mailing list