[MPlayer-dev-eng] [PATCH] Proper flac bitrate

Andrew Savchenko Bircoph at list.ru
Sat Aug 25 15:01:21 CEST 2007


Hello, all!

Currently MPlayer svn head misidentifies length and bitrate for any 
FLAC audio tracks. Just look at this output (essential part of 
mplayer -identify 01\ -\ Hotaru.flac output):

ID_FILENAME=01 - Hotaru.flac
ID_DEMUXER=audio
ID_AUDIO_FORMAT=fLaC
ID_AUDIO_BITRATE=654368
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_LENGTH=363.00
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 64.0 kbit/4.54% (ratio: 8000->176400)
ID_AUDIO_BITRATE=64000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio 
decoder)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=ffflac
Video: no video
Starting playback...
A:   1.5 (01.5) of 3720.0 ( 1:02:00.0)  1.0%

Note that originally bitrate and track length are identified 
correctly (654368 bps and 363 sec). But final results are 
obviously wrong and time in status line changes faster than 
realtime during playback, this track is really 6:03 length.

Original parameters are obtained at libmpdemux/demux_audio.c, but 
samplerate and bitrate are incorrectly redefined later at 
libmpcodecs/ad_ffmpeg.c:115; or to be more exact they are changed 
to lavc fallback defaults, because of (WAVEFORMATEX*)wf structure 
is undefined for FLAC streams.

So I defined wf data required for proper bitrate and track length 
calculation at demux_audio.c, please review an attached patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flac_demuxer.patch
Type: text/x-diff
Size: 676 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070825/db5cde46/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070825/db5cde46/attachment.pgp>


More information about the MPlayer-dev-eng mailing list