[Libav-user] Problem with compressing AAC files with sampling rate 16000

adev dev androiddevmar11 at gmail.com
Sat Sep 20 11:33:08 CEST 2014


This is information about the file which cannot be compressed:












* Metadata:    major_brand     : isom    minor_version   : 0
compatible_brands: isom3gp4    creation_time   : 1948-08-31 11:42:22
Duration: 00:00:47.68, start: 0.000000, bitrate: 96 kb/s    Stream
#0:0(eng): Audio: aac (mp4a / 0x6134706D), 16000 Hz, mono, s16, 96 kb/s
Metadata:      creation_time   : 1948-08-31 11:42:22      handler_name    :
SoundHandle*
I managed to build FFMPEG 2.4 and it is working. I can compress sound with
parameters 96000 and sampling rate 16000. However there is problem with
applying patch aac-improvements-wip-v8g.It failes with info:  1 out of 3
hunks FAILED -- saving rejects to file libavcodec/psymodel.h.rej.  File
psymodel.h.rej looks following:

--- libavcodec/psymodel.h
+++ libavcodec/psymodel.h
@@ -27,9 +27,22 @@
 /** maximum possible number of bands */
 #define PSY_MAX_BANDS 128
 /** maximum number of channels */
-#define PSY_MAX_CHANS 20
+#define PSY_MAX_CHANS 24

-#define AAC_CUTOFF(s) (s->bit_rate ? FFMIN3(4000 + s->bit_rate/8, 12000 +
s->bit_rate/32, s->sample_rate / 2) : (s->sample_rate / 2))
+/* cutoff for VBR is purposedly increased, since LP filtering actually
+ * hinders VBR performance rather than the opposite
+ */
+#define _AAC_CUTOFF(bit_rate,channels,sample_rate) (bit_rate ?
FFMIN3(FFMIN3( \
+    bit_rate/channels/2, \
+    3000 + bit_rate/channels/4, \
+    12000 + bit_rate/channels/16), \
+    20000, \
+    sample_rate / 2): (sample_rate / 2))
+#define AAC_CUTOFF(s) ( \
+    (s->flags & CODEC_FLAG_QSCALE) \
+    ? /*_AAC_CUTOFF(((int)(480000.0f*(s->global_quality ?
s->global_quality/120.0f : 1.0f))), 1, s->sample_rate)*/s->sample_rate / 2 \
+    : _AAC_CUTOFF(s->bit_rate, s->channels, s->sample_rate) \
+)

 /**
  * single band psychoacoustic information


Build fails with:


<http://its.ffmpeg.org/attachment/ticket/2686/aac-improvements-wip-v8g.patch>libavcodec/aaccoder.c:910:13:
error: implicit declaration of function '_AAC_CUTOFF'
[-Werror=implicit-function-declaration]
libavcodec/aaccoder.c:814:44: warning: variable 'energies' set but not used
[-Wunused-but-set-variable]
libavcodec/aaccoder.c: At top level:
libavcodec/aaccoder.c:366:14: warning: 'find_max_absval' defined but not
used [-Wunused-function]
cc1: some warnings being treated as errors

make: *** [libavcodec/aaccoder.o] Error 1
make: *** Waiting for unfinished jobs....
CC    libavcodec/aacenc.o
libavcodec/aacdec.c: In function 'imdct_and_windowing_eld':
libavcodec/aacdec.c:2590:29: warning: array subscript is above array bounds
[-Warray-bounds]
libavcodec/aacdec.c:2596:29: warning: array subscript is above array bounds
[-Warray-bounds]
Native build complete, exiting...
marcin at marcin:~/android-dev/FFFMPEG_BUILDS/ffmpeg-2.4-build-scrypts$

Good info is that with 2.4 it is working but it would be very good to apply
this patch to improve quality of aac. Is there any fix for this patch
problem??


BR, Marcin

On 19 September 2014 18:51, Claudio Freire <klaussfreire at gmail.com> wrote:

> On Fri, Sep 19, 2014 at 5:28 AM, adev dev <androiddevmar11 at gmail.com>
> wrote:
> > I am not using command line. It is done in code in Android project. Some
> > devices cannot record sound with 192000 and 44100 probably due to some
> > hardware limitations. In such case Android dicreases params to 96000 and
> > 16000.
> >
> > I can reproduce the issue when I record sound with sampling rate 32000
> and
> > try to compress it with samling rate 44100 on FFMPEG side. Sound is very
> > fast and it ends before the movie is ended. I this specific case setting
> > sampling rate to 32000 on FFMPEG side fixes the problem and sound is
> > correctly compressed.
>
> Then it is quite possible that either during recording or during
> playback, the sample rate is specified as 44100 or 22050 when it
> really is lower.
>
> Can you inspect the generated files on a pc, on a console, with the
> command:
>
> ffmpeg -i <file>
>
> And paste the output?
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140920/cfa13c12/attachment.html>


More information about the Libav-user mailing list