[MPlayer-users] FAAD bitrate never gets set, and channels always fall back to 2 (stereo)

Justin Randall jrrandall at gmail.com
Thu May 8 14:06:12 CEST 2008


Hi everyone,

I don't know If I should be posting this here or not, but basically
this is a bug where the input bitrate never gets set by the decoder.
The workaround is to hard code it to 128kbps.  This might be a good
short term solution, but ultimately I think you would want to actually
have a good method of reliably calculating the audio bitrate.  Another
unrelated problem with AAC decoding is that the number of channels are
correctly determined (if you're running with -v output you can see
that it does get set correctly); However, after detecting all 6
channels, it falls back to stereo (2 channels) unless you explicitly
override it with -channels 6.  Here is the output from a sample file.

>>mplayer -v test.mp4
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
dec_audio: Allocating 4608 bytes for input buffer.
dec_audio: Allocating 49152 + 65536 = 114688 bytes for output buffer.
FAAD: Decoder init done (0Bytes)!
FAAD: Negotiated samplerate: 48000Hz  channels: 6
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio) decoder)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...


The suspect code is on line 161 of mplayer/libmpcodecs/ad_faad.c

    if(!sh->i_bps) {
      mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: compressed input bitrate
missing, assuming 128kbit/s!\n");
      sh->i_bps = 128*1000/8; // XXX: HACK!!! ::atmos
    }

So in the sh_audio_t structure, int i_bps; // == bitrate  (compressed
bytes/sec)  never gets set automatically.  It hits this hack case
every time for me where it falls back to 128kbps.

The other problem I was talking about where the channels fall back to
stereo happens on line 155 of ad_faad.c

if (audio_output_channels <= 2) sh->channels = faac_channels > 1 ? 2 : 1;

This actually might not be a problem, as 5.1 AC3 audio gets handled in
the same way on my system.  I guess mplayer is just smart enough to
detect my speaker setup and automatically downsamples it to 2
channels.  Although this might not be a desired feature... the audio
actually sounds better when I manually override this with -channels 6.

Could a developer in the know or someone with knowledge of the mp4
container please shed some light on the first issue?  Is this a
limitation with FAAD, or does mplayer just not support detecting the
bitrate from the AAC track?

Thanks,
Justin



More information about the MPlayer-users mailing list