Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#683 closed defect (invalid)

Very wrong number of channels when using libaacplus and ffmpeg

Reported by: bradsoto Owned by:
Priority: normal Component: undetermined
Version: 0.7.7 Keywords: libaacplus freebsd
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm using a fresh install of FreeBSD 8.2. I installed ffmpeg with libaacplus but when I start to encode something, it gets the number of channels very wrong:


===> SECURITY REPORT: 
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libavformat.so.52.110.0

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage: 
http://ffmpeg.mplayerhq.hu/
freebsd# cd ~/
freebsd# ffmpeg -i http://stream-tx1.radioparadise.com:9000/rp_192.ogg -acodec libaacplus -ab 32000 test.mp4
ffmpeg: Command not found.
freebsd# rehash
freebsd# ffmpeg -i http://stream-tx1.radioparadise.com:9000/rp_192.ogg -acodec libaacplus -ab 32000 test.mp4
ffmpeg version 0.7.7, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 23 2011 20:00:19 with gcc 4.2.1 20070719  [FreeBSD]
  configuration: --prefix=/usr/local --mandir=/usr/local/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-memalign-hack --enable-runtime-cpudetect --cc=cc --extra-cflags='-msse -I/usr/local/include/vorbis -I/usr/local/include' --extra-ldflags='-L/usr/local/lib ' --extra-libs=-pthread --disable-debug --enable-libaacplus --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libcelt --disable-libdirac --enable-libfaac --disable-ffserver --disable-libfreetype --disable-frei0r --disable-libgsm --disable-libmp3lame --disable-libopencv --disable-libopenjpeg --disable-librtmp --disable-libschroedinger --disable-ffplay --disable-libspeex --enable-libtheora --disable-vaapi --disable-vdpau --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libvorbis --disable-libvpx --disable-libx264 --disable-libxvid --enable-nonfree --enable-version3
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.122. 0 / 52.122. 0
  libavformat  52.110. 0 / 52.110. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
[ogg @ 0x80381f020] Estimating duration from bitrate, this may be inaccurate
Input #0, ogg, from 'http://stream-tx1.radioparadise.com:9000/rp_192.ogg':
  Duration: N/A, start: 0.000000, bitrate: 192 kb/s
    Stream #0.0: Audio: vorbis, 44100 Hz, stereo, s16, 192 kb/s
libaacplus: bad aac setting: br:32000, AACch:65536, AACsr:22050
[libaacplus @ 0x80380d520] libaacplus doesn't support this output format!
Output #0, mp4, to 'test.mp4':
    Stream #0.0: Audio: libaacplus, 44100 Hz, stereo, s16, 32 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

Notice "AACch:65536". This is keeping from encoding using libaacplus.

Change History (10)

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: audio stream removed
Priority: importantnormal
Resolution: worksforme
Status: newclosed

I just tested your command line with both current git head and release/0.7 (both static and shared libaacplus 2.0.2) and it works fine.

libaacplus: bad aac setting: br:32000, AACch:65536, AACsr:22050

Given how libavcodec/libaacplus.c sets the channels, this is an unlikely problem:

    /* number of channels */
    if (avctx->channels < 1 || avctx->channels > 2) {
        av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
        return -1;
    }

    s->aacplus_handle = aacplusEncOpen(avctx->sample_rate,
                                 avctx->channels,
                                 &samples_input, &max_bytes_output);
    if(!s->aacplus_handle) {
            av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
            return -1;
    }

An unrelated problem that made encoding to ADTS impossible was just fixed in git head and all future releases.

comment:2 by bradsoto, 12 years ago

Resolution: worksforme
Status: closedreopened

Works fine for me as well. EXCEPT when I try to use the same setup and command on FreeBSD 8.2/9RC2. MacPorts and Ubuntu are fine. I'll test Head on both FreeBSDs and report back.

comment:3 by Michael Niedermayer, 12 years ago

Also try disabling libvo-aacenc
IIRC someone on IRC had problems if both libvo-aacenc and aac+ where enabled

in reply to:  3 comment:4 by Carl Eugen Hoyos, 12 years ago

Replying to michael:

Also try disabling libvo-aacenc
IIRC someone on IRC had problems if both libvo-aacenc and aac+ where enabled

It should not be possible to compile (link) when both are enabled (because both are based on the reference encoder and use identical functions).

comment:5 by bradsoto, 12 years ago

That was the problem! Thank you everyone. I'll let the FreeBSD port maintainer know. Please mark as closed.

comment:6 by Carl Eugen Hoyos, 12 years ago

Resolution: invalid
Status: reopenedclosed

comment:7 by Michael Niedermayer, 12 years ago

Note, ive here ffmpeg linked to libvo-aacenc.so.0 and libaacplus.so.2 and both seem to work.

comment:8 by bradsoto, 12 years ago

Yes, it was my initial thought that it should work fine since they were two separate libraries. I wanted to use libaacplus for 64k SBR and 32k SBR+PS; and use libvo_aacenc for 128 and 256 kbps. Instead of libvo I'm using faac (quality isn't noticeable issue). Also SBR and PS don't work at all for libvo... are they supposed to?

comment:9 by reimar, 12 years ago

That might easily depend on things like default visibility, whether -Bsymbols was used in linking etc.
If those are distribution builds they may just have done a better job of packaging them, or they are later versions that fixed the issue.

comment:10 by Michael Niedermayer, 12 years ago

my libaacplus was a debian package from marilat installed on ubuntu, i dunno where my libvo-aacenc came from

Note: See TracTickets for help on using tickets.