Opened 8 years ago

Last modified 13 months ago

#3361 new defect

aac_he mono not recogized (reported as stereo)

Reported by: Christian Ebert Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: aac regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Channel count and channel layout for aac_he mono is always reported (decoded?) as stereo.

How to reproduce:

ffmpeg -i in.aiff -c:a libfdk_aac -profile:a aac_he -b:a 32k -ac 1 fdk-he-mono.m4a
ffmpeg version N-60230-gcfe282e Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 29 2014 14:17:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-network --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.101 / 55. 49.101
  libavformat    55. 28.101 / 55. 28.101
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, aiff, from 'in.aiff':
  Duration: 00:00:30.43, start: 0.000000, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le (sowt / 0x74776F73), 44100 Hz, stereo, s16, 1411 kb/s
Output #0, ipod, to 'fdk-he-mono.m4a':
  Metadata:
    encoder         : Lavf55.28.101
    Stream #0:0: Audio: aac (libfdk_aac) (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, mono, s16, 32 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libfdk_aac)
Press [q] to stop, [?] for help
size=     123kB time=00:00:30.44 bitrate=  33.0kbits/s
video:0kB audio:119kB subtitle:0 global headers:0kB muxing overhead 2.760628%
~/Music/Blacktrash$ ffprobe -show_streams fdk-he-mono.m4a 2>/dev/null | fgrep chan
channels=2
channel_layout=stereo

Mono in normal profile is recognized correctly:

ffmpeg -i in.aiff -c:a libfdk_aac -b:a 32k -ac 1 fdk-mono.m4a
ffmpeg version N-60230-gcfe282e Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 29 2014 14:17:03 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-network --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.101 / 55. 49.101
  libavformat    55. 28.101 / 55. 28.101
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, aiff, from 'in.aiff':
  Duration: 00:00:30.43, start: 0.000000, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le (sowt / 0x74776F73), 44100 Hz, stereo, s16, 1411 kb/s
Output #0, ipod, to 'fdk-mono.m4a':
  Metadata:
    encoder         : Lavf55.28.101
    Stream #0:0: Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 44100 Hz, mono, s16, 32 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libfdk_aac)
Press [q] to stop, [?] for help
size=     125kB time=00:00:30.44 bitrate=  33.7kbits/s
video:0kB audio:119kB subtitle:0 global headers:0kB muxing overhead 4.902738%
ffprobe -show_streams fdk-mono.m4a 2>/dev/null | fgrep chan
channels=1
channel_layout=mono

I first believed this was a problem with fdk-aac, but a HE-AAC by iTunes yields the same:

$ ffprobe -show_streams itunes-he-mono.m4a 2>/dev/null | fgrep chan
channels=2
channel_layout=stereo

See also:
http://sourceforge.net/p/opencore-amr/mailman/message/31874638/
ff.
and:
https://lists.ffmpeg.org/pipermail/ffmpeg-user/2014-January/019559.html

Note that profile is always diagnosed as unknown:

ffprobe -show_streams fdk-he-mono.m4a 2>/dev/null | fgrep profile
profile=unknown
ffprobe -show_streams fdk-mono.m4a 2>/dev/null | fgrep profile
profile=unknown
ffprobe -show_streams itunes-he-mono.m4a 2>/dev/null | fgrep profile
profile=unknown

Attachments (3)

fdk-he-mono.m4a (122.7 KB ) - added by Christian Ebert 8 years ago.
aac_he mono created by ffmpeg + fdk-aac
test.ts (761.2 KB ) - added by Christian Ebert 8 years ago.
aac_he mono
mono.aac (192.2 KB ) - added by John Warburton 2 years ago.
Mono HE-AAC reported as stereo

Download all attachments as: .zip

Change History (25)

comment:1 by Carl Eugen Hoyos, 8 years ago

Keywords: aac added

Please provide a short sample.

comment:2 by Christian Ebert, 8 years ago

Of the source or of the result? If the result, only the one created by ffmpeg/fdk-aac or also iTunes?

comment:3 by Carl Eugen Hoyos, 8 years ago

A sample that is shown as "mono" in iTunes / QuickTime but "stereo" by FFmpeg seems needed to me.

Of course it is *very* useful that you explained how the file was created that FFmpeg has a problem with (and it could be argued that we should do the work) but imo, a sample is generally needed for bug reports.

by Christian Ebert, 8 years ago

Attachment: fdk-he-mono.m4a added

aac_he mono created by ffmpeg + fdk-aac

comment:4 by Christian Ebert, 8 years ago

Attached file is reported as mono by QuickTime. You cannot import it into iTunes because for simplicity's sake it was not created with -signaling implicit which would open another can of worms, see: http://sourceforge.net/p/opencore-amr/mailman/message/31876971/ et al

comment:5 by Carl Eugen Hoyos, 8 years ago

Component: undeterminedavcodec
Keywords: regression added
Priority: normalimportant

Martin claims this is a libavcodec regression.

comment:6 by Michael Niedermayer, 8 years ago

This fixes it but breaks some reference aac bitstreams we have in fate

diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 68448e6..e9b908d 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -142,6 +142,9 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
     //PS requires SBR
     if (!c->sbr)
         c->ps = 0;
+    if (c->sbr == 1 && c->ps == -1)
+        c->ps = 0;
+
     //Limit implicit PS to the HE-AACv2 Profile
     if ((c->ps == -1 && c->object_type != AOT_AAC_LC) || c->channels & ~0x01)
         c->ps = 0;

in reply to:  6 comment:7 by Christian Ebert, 8 years ago

Replying to michael:

This fixes it but breaks some reference aac bitstreams we have in fate

Are the streams in question aac_he_v2? If yes, the fix should probably contain an excluding conditional, as v2 cannot be mono, see: http://sourceforge.net/p/opencore-amr/mailman/message/31877351/

comment:8 by Michael Niedermayer, 8 years ago

how do you detect v2 ?
if it requires decoding the whole stream that would be unpractical (for realtime streams for example)

See: fate-suite/aac/CT_DecoderCheck/sbr_bic-ps_i.3gp
for the file that does contain PS with similar header

comment:9 by Michael Niedermayer, 8 years ago

is there any software that can detect that this is mono without (potentially) reading the whole file ?
also if this is a regression, with which version did it work ?

comment:10 by Carl Eugen Hoyos, 8 years ago

If there is an issue, it is a regression since a2063901

comment:11 by Michael Niedermayer, 8 years ago

if theres no way to solve this except scanning the whole file then this is not really fixable and thus also not a bug and should be closed

in reply to:  11 comment:12 by Christian Ebert, 8 years ago

Replying to michael:

if theres no way to solve this except scanning the whole file then this is not really fixable and thus also not a bug and should be closed

Before closing it should be documented though, shouldn't it?

And: the original report is not about aac_he_v2, but aac_he.

comment:13 by Christian Ebert, 8 years ago

With the fdk git HEAD and ffmpeg 7656c4c aac_he mono results

  1. are reported as profile=HE-AACv2
  2. ffplay'ing mpegts streams report [aac @ 0x7fab9a035800] ChannelElement 1.0 missing

where I guess 2. is a consequence of 1. because aac_he_v2 is indeed stereo only.

in reply to:  13 ; comment:14 by Carl Eugen Hoyos, 8 years ago

Replying to blacktrash:

  1. ffplay'ing mpegts streams report [aac @ 0x7fab9a035800] ChannelElement 1.0 missing

Please provide command line and console output and a sample.

in reply to:  14 comment:15 by Christian Ebert, 8 years ago

Replying to cehoyos:

Replying to blacktrash:

  1. ffplay'ing mpegts streams report [aac @ 0x7fab9a035800] ChannelElement 1.0 missing

Please provide command line and console output and a sample.

Does not happen with mp4, but with mpegts:

$ ffmpeg -i BigBuckBunny_640x360.m4v -c:v copy -c:a libfdk_aac -profile:a aac_he -b:a 64k -ac 1 test.mp4
ffmpeg version N-67514-g7656c4c Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BigBuckBunny_640x360.m4v':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    creation_time   : 2008-06-03 05:23:28
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    date            : 2008
  Duration: 00:09:56.46, start: 0.000000, bitrate: 1626 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 1495 kb/s, 24 fps, 24 tbr, 2400 tbn, 4800 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    date            : 2008
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    encoder         : Lavf56.12.103
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=2-31, 1495 kb/s, 24 fps, 19200 tbn, 2400 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (libfdk_aac) (HE-AAC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 64 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
      encoder         : Lavc56.12.100 libfdk_aac
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame=14316 fps=1979 q=-1.0 Lsize=  113804kB time=00:09:56.49 bitrate=1562.9kbits/s
video:108900kB audio:4661kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214162%
$ ffprobe -v quiet -select_streams a -show_entries stream=profile test.mp4
[STREAM]
profile=HE-AAC
[/STREAM]
$ ffmpeg -i test.mp4 -c copy -bsf:v h264_mp4toannexb -map 0 test.ts
ffmpeg version N-67514-g7656c4c Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    date            : 2008
    encoder         : Lavf56.12.103
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
  Duration: 00:09:56.59, start: 0.114694, bitrate: 1562 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 1495 kb/s, 24 fps, 24 tbr, 19200 tbn, 38400 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, mpegts, to 'test.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    date            : 2008
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    encoder         : Lavf56.12.103
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 640x360, q=2-31, 1495 kb/s, 24 fps, 90k tbn, 19200 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=14316 fps=0.0 q=-1.0 Lsize=  124413kB time=00:09:56.61 bitrate=1708.3kbits/s
video:108879kB audio:4661kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.576361%
$ ffprobe -v quiet -select_streams a -show_entries stream=profile test.ts
[PROGRAM]
[STREAM]
profile=HE-AACv2
[/STREAM]
[/PROGRAM]
[STREAM]
profile=HE-AACv2
[/STREAM]
$ ffplay test.ts
ffplay version N-67514-g7656c4c Copyright (c) 2003-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0x7fd56a008800] non-existing SPS 0 referenced in buffering period
    Last message repeated 1 times
Input #0, mpegts, from 'test.ts':
  Duration: 00:09:56.61, start: 1.400000, bitrate: 1708 kb/s
  Program 1
    Metadata:
      service_name    : Big Buck Bunny
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 24 fps, 24 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101](eng): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 67 kb/s
[h264 @ 0x7fd56a80f200] non-existing SPS 0 referenced in buffering period
[h264 @ 0x7fd56a008800] non-existing SPS 0 referenced in buffering period
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing
    Last message repeated 9 times
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing sq=    0B f=0/0
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing sq=    0B f=0/0
    Last message repeated 1 times
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing sq=    0B f=0/0
    Last message repeated 1 times
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing sq=    0B f=0/0
[aac @ 0x7fd56a01ba00] ChannelElement 1.0 missing sq=    0B f=0/0
# [... and so on ...]

in reply to:  14 comment:16 by Christian Ebert, 8 years ago

Replying to cehoyos:

Replying to blacktrash:

  1. ffplay'ing mpegts streams report [aac @ 0x7fab9a035800] ChannelElement 1.0 missing

Please provide command line and console output and a sample.

Or, without intermediate bsf step:

$ ffmpeg -i BigBuckBunny_640x360.m4v -c:v libx264 -c:a libfdk_aac -profile:a aac_he -b:a 64k -ac 1 test.ts
ffmpeg version N-67514-g7656c4c Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BigBuckBunny_640x360.m4v':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    creation_time   : 2008-06-03 05:23:28
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    date            : 2008
  Duration: 00:09:56.46, start: 0.000000, bitrate: 1626 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 1495 kb/s, 24 fps, 24 tbr, 2400 tbn, 4800 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
[libx264 @ 0x7fe66b800c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fe66b800c00] profile High, level 3.0
Output #0, mpegts, to 'test.ts':
  Metadata:
    major_brand     : M4V
    minor_version   : 1
    compatible_brands: M4V M4A mp42isom
    date            : 2008
    copyright       : © 2008 Blender Foundation | www.bigbuckbunny.org
    title           : Big Buck Bunny
    artist          : Peach Open Movie Team
    composer        : Sacha Goedegebure / Ton Roosendaal
    encoder         : Lavf56.12.103
    Stream #0:0(eng): Video: h264 (libx264), yuv420p, 640x360, q=-1--1, 24 fps, 90k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Video Media Handler
      encoder         : Lavc56.12.100 libx264
    Stream #0:1(eng): Audio: aac (libfdk_aac) (HE-AAC), 44100 Hz, mono, s16, 64 kb/s (default)
    Metadata:
      creation_time   : 2008-06-03 05:23:28
      handler_name    : Apple Sound Media Handler
      encoder         : Lavc56.12.100 libfdk_aac
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame=14316 fps=305 q=-1.0 Lsize=   48501kB time=00:09:56.49 bitrate= 666.1kbits/s
video:38402kB audio:4661kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 12.626186%
[libx264 @ 0x7fe66b800c00] frame I:154   Avg QP:17.40  size: 37747
[libx264 @ 0x7fe66b800c00] frame P:5550  Avg QP:22.44  size:  4792
[libx264 @ 0x7fe66b800c00] frame B:8612  Avg QP:27.20  size:   803
[libx264 @ 0x7fe66b800c00] consecutive B-frames: 12.4% 17.7% 13.4% 56.4%
[libx264 @ 0x7fe66b800c00] mb I  I16..4: 35.4% 26.7% 37.9%
[libx264 @ 0x7fe66b800c00] mb P  I16..4:  3.2%  4.2%  1.7%  P16..4: 33.3%  7.3%  4.9%  0.0%  0.0%    skip:45.3%
[libx264 @ 0x7fe66b800c00] mb B  I16..4:  0.2%  0.5%  0.2%  B16..8: 24.6%  1.7%  0.5%  direct: 0.8%  skip:71.6%  L0:49.5% L1:44.9% BI: 5.6%
[libx264 @ 0x7fe66b800c00] 8x8 transform intra:42.7% inter:49.6%
[libx264 @ 0x7fe66b800c00] coded y,uvDC,uvAC intra: 61.4% 65.7% 32.2% inter: 9.7% 10.2% 2.1%
[libx264 @ 0x7fe66b800c00] i16 v,h,dc,p: 22% 27% 23% 28%
[libx264 @ 0x7fe66b800c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 26%  4%  5%  7%  5%  6%  6%
[libx264 @ 0x7fe66b800c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 23% 19%  4%  6%  6%  6%  5%  5%
[libx264 @ 0x7fe66b800c00] i8c dc,h,v,p: 48% 23% 18% 11%
[libx264 @ 0x7fe66b800c00] Weighted P-Frames: Y:3.7% UV:2.4%
[libx264 @ 0x7fe66b800c00] ref P L0: 70.7% 13.5% 11.6%  4.2%  0.1%
[libx264 @ 0x7fe66b800c00] ref B L0: 91.2%  7.6%  1.2%
[libx264 @ 0x7fe66b800c00] ref B L1: 94.8%  5.2%
[libx264 @ 0x7fe66b800c00] kb/s:527.39
$ ffprobe -v quiet -select_streams a -show_entries stream=profile test.ts
[PROGRAM]
[STREAM]
profile=HE-AACv2
[/STREAM]
[/PROGRAM]
[STREAM]
profile=HE-AACv2
[/STREAM]
$ ffplay test.ts
ffplay version N-67514-g7656c4c Copyright (c) 2003-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from 'test.ts':  0KB vq=    0KB sq=    0B f=0/0
  Duration: 00:09:56.61, start: 1.400000, bitrate: 665 kb/s
  Program 1
    Metadata:
      service_name    : Big Buck Bunny
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 24 fps, 24 tbr, 90k tbn, 48 tbc
    Stream #0:1[0x101](eng): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 64 kb/s
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing
    Last message repeated 9 times
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
    Last message repeated 1 times
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
    Last message repeated 1 times
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
[aac @ 0x7fcfaa836800] ChannelElement 1.0 missing sq=    0B f=0/0
# [... etc ...]

comment:17 by Carl Eugen Hoyos, 8 years ago

Did you upload a (audio-only) sample?

by Christian Ebert, 8 years ago

Attachment: test.ts added

aac_he mono

comment:18 by Christian Ebert, 8 years ago

Attached test.ts created with:

$ ffmpeg -i 03-ThreeJollyHuntsmen.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k -ac 1 test.ts
ffmpeg version N-67514-g7656c4c Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 10 2014 20:00:06 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-ffserver --enable-shared --enable-libfdk-aac --enable-libx265 --enable-libx264 --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libvidstab --extra-cflags=-I/sw/include --extra-libs=-L/sw/lib
  libavutil      54. 11.100 / 54. 11.100
  libavcodec     56. 12.100 / 56. 12.100
  libavformat    56. 12.103 / 56. 12.103
  libavdevice    56.  2.100 / 56.  2.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from '03-ThreeJollyHuntsmen.wav':
  Duration: 00:01:25.52, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf56.12.103
    Stream #0:0: Audio: aac (libfdk_aac) (HE-AAC), 44100 Hz, mono, s16, 64 kb/s
    Metadata:
      encoder         : Lavc56.12.100 libfdk_aac
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
size=     761kB time=00:01:25.52 bitrate=  72.9kbits/s
video:0kB audio:669kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 13.774409%

comment:19 by Carl Eugen Hoyos, 8 years ago

I created ticket #4106, thank you for the sample.

by John Warburton, 2 years ago

Attachment: mono.aac added

Mono HE-AAC reported as stereo

comment:20 by John Warburton, 2 years ago

Replying to blacktrash:

Summary of the bug:

Channel count and channel layout for aac_he mono is always reported (decoded?) as stereo.

Same observed 26 May 2020.

FFmpeg, using libfdk_aac and "profile:a he_aac", believes it is encoding mono, but on inputting the encoded file, FFmpeg reports stereo and he_aac_v2.

ffmpeg -i .\h.mp3 -af dynaudnorm=g=5:r=1:m=20.0:b=1,alimiter=limit=-10dB -ac 1 -ar 32000 -profile:a aac_he -c:a libfdk_aac mono.aac
ffmpeg version N-97952-g2502e13b07-COMPILED_BY_JohnWarburton Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.1.1 (GCC) 20200522
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-libjack --disable-doc --enable-libxml2 --enable-opencl --enable-gpl --enable-libtesseract --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-libmysofa --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-libcodec2 --enable-frei0r --enable-filter=frei0r --enable-bzlib --enable-libxavs --enable-libxavs2 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-libbs2b --enable-libmfx --enable-librubberband --enable-dxva2 --enable-d3d11va --enable-nvenc --enable-nonfree --enable-libfdk-aac --enable-libflite --enable-decoder=aac --enable-libaom --enable-runtime-cpudetect --enable-libpulse --enable-cuda-nvcc --prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/x86_64-w64-mingw32 --enable-shared --disable-static --disable-debug --disable-stripping --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpsapi --enable-opengl --extra-libs=-lz --extra-libs=-lpng --enable-libvidstab --enable-decklink --extra-libs=-loleaut32 --enable-libcdio --enable-libzimg --enable-chromaprint --enable-libsnappy --enable-libx265 --enable-lv2 --enable-libklvanc --logfile=/dev/tty --extra-cflags= --extra-version=COMPILED_BY_JohnWarburton --extra-cxxflags=-Wno-narrowing
  libavutil      56. 49.100 / 56. 49.100
  libavcodec     58. 87.101 / 58. 87.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 83.100 /  7. 83.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mp3, from '.\h.mp3':
  Duration: 00:00:44.93, start: 0.025057, bitrate: 103 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 103 kb/s
    Metadata:
      encoder         : LAME3.99r
File 'mono.aac' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
Output #0, adts, to 'mono.aac':
  Metadata:
    encoder         : Lavf58.43.100
    Stream #0:0: Audio: aac (libfdk_aac) (HE-AAC), 32000 Hz, mono, s16, 34 kb/s
    Metadata:
      encoder         : Lavc58.87.101 libfdk_aac
size=     192kB time=00:00:44.89 bitrate=  35.1kbits/s speed=26.3x
video:0kB audio:192kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

And mediainfo -f reports it's mono:

$ mediainfo -f mono.aac
General
Count                                    : 308
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Count of audio streams                   : 1
Audio_Format_List                        : AAC
Audio_Format_WithHint_List               : AAC
Audio codecs                             : AAC LC-SBR
Complete name                            : mono.aac
File name                                : mono
File extension                           : aac
Format                                   : ADTS
Format                                   : ADTS
Format/Info                              : Audio Data Transport Stream
Format/Extensions usually used           : aac
Commercial name                          : ADTS
Codec                                    : ADTS
Codec                                    : ADTS
Codec/Info                               : Audio Data Transport Stream
Codec/Extensions usually used            : aac
File size                                : 196779
File size                                : 192 KiB
File size                                : 192 KiB
File size                                : 192 KiB
File size                                : 192 KiB
File size                                : 192.2 KiB
Overall bit rate mode                    : VBR
Overall bit rate mode                    : Variable
Stream size                              : 0
Stream size                              : 0.00 Byte (0%)
Stream size                              :  Byte0
Stream size                              : 0.0 Byte
Stream size                              : 0.00 Byte
Stream size                              : 0.000 Byte
Stream size                              : 0.00 Byte (0%)
Proportion of this stream                : 0.00000
File creation date                       : UTC 2020-05-26 15:01:25.297
File creation date (local)               : 2020-05-26 16:01:25.297
File last modification date              : UTC 2020-05-26 15:06:00.284
File last modification date (local)      : 2020-05-26 16:06:00.284

Audio
Count                                    : 254
Count of stream of this kind             : 1
Kind of stream                           : Audio
Kind of stream                           : Audio
Stream identifier                        : 0
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Commercial name                          : AAC
Format version                           : Version 4
Format profile                           : HE-AAC / LC
Format settings, SBR                     : Yes (Implicit)
Format settings, SBR                     : Yes (Implicit)
Codec                                    : AAC LC-SBR
Codec                                    : AAC LC-SBR
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Channel(s)                               : 1
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Channel positions                        : 1/0/0
ChannelLayout                            : C
Sampling rate                            : 32000 / 16000
Sampling rate                            : 32.0 KHz / 16.0 KHz
Compression mode                         : Lossy
Compression mode                         : Lossy
Stream size                              : 196779
Stream size                              : 192 KiB (100%)
Stream size                              : 192 KiB
Stream size                              : 192 KiB
Stream size                              : 192 KiB
Stream size                              : 192.2 KiB
Stream size                              : 192 KiB (100%)
Proportion of this stream                : 1.00000

But ffmpeg and ffprobe report the file is stereo:

ffprobe .\mono.aac
ffprobe version N-97952-g2502e13b07-COMPILED_BY_JohnWarburton Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 10.1.1 (GCC) 20200522
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-libjack --disable-doc --enable-libxml2 --enable-opencl --enable-gpl --enable-libtesseract --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-libmysofa --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-libcodec2 --enable-frei0r --enable-filter=frei0r --enable-bzlib --enable-libxavs --enable-libxavs2 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-libbs2b --enable-libmfx --enable-librubberband --enable-dxva2 --enable-d3d11va --enable-nvenc --enable-nonfree --enable-libfdk-aac --enable-libflite --enable-decoder=aac --enable-libaom --enable-runtime-cpudetect --enable-libpulse --enable-cuda-nvcc --prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/x86_64-w64-mingw32 --enable-shared --disable-static --disable-debug --disable-stripping --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpsapi --enable-opengl --extra-libs=-lz --extra-libs=-lpng --enable-libvidstab --enable-decklink --extra-libs=-loleaut32 --enable-libcdio --enable-libzimg --enable-chromaprint --enable-libsnappy --enable-libx265 --enable-lv2 --enable-libklvanc --logfile=/dev/tty --extra-cflags= --extra-version=COMPILED_BY_JohnWarburton --extra-cxxflags=-Wno-narrowing
  libavutil      56. 49.100 / 56. 49.100
  libavcodec     58. 87.101 / 58. 87.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 83.100 /  7. 83.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[aac @ 0000024422d46a00] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from '.\mono.aac':
  Duration: 00:00:38.05, bitrate: 41 kb/s
    Stream #0:0: Audio: aac (HE-AACv2), 32000 Hz, stereo, fltp, 41 kb/s

And FFmpeg's stream analysis reports stereo, and HE-AACv2:

ffprobe -show_streams mono.aac
ffprobe version N-97952-g2502e13b07-COMPILED_BY_JohnWarburton Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 10.1.1 (GCC) 20200522
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-libjack --disable-doc --enable-libxml2 --enable-opencl --enable-gpl --enable-libtesseract --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-libmysofa --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-libcodec2 --enable-frei0r --enable-filter=frei0r --enable-bzlib --enable-libxavs --enable-libxavs2 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-libbs2b --enable-libmfx --enable-librubberband --enable-dxva2 --enable-d3d11va --enable-nvenc --enable-nonfree --enable-libfdk-aac --enable-libflite --enable-decoder=aac --enable-libaom --enable-runtime-cpudetect --enable-libpulse --enable-cuda-nvcc --prefix=/home/john/MultimediaTools-mingw-w64/sandbox/x86_64-w64-mingw32/x86_64-w64-mingw32 --enable-shared --disable-static --disable-debug --disable-stripping --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpsapi --enable-opengl --extra-libs=-lz --extra-libs=-lpng --enable-libvidstab --enable-decklink --extra-libs=-loleaut32 --enable-libcdio --enable-libzimg --enable-chromaprint --enable-libsnappy --enable-libx265 --enable-lv2 --enable-libklvanc --logfile=/dev/tty --extra-cflags= --extra-version=COMPILED_BY_JohnWarburton --extra-cxxflags=-Wno-narrowing
  libavutil      56. 49.100 / 56. 49.100
  libavcodec     58. 87.101 / 58. 87.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 83.100 /  7. 83.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[aac @ 0000021fda366b00] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'mono.aac':
  Duration: 00:00:38.05, bitrate: 41 kb/s
    Stream #0:0: Audio: aac (HE-AACv2), 32000 Hz, stereo, fltp, 41 kb/s
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=HE-AACv2
codec_type=audio
codec_time_base=1/32000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=32000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/28224000
start_pts=N/A
start_time=N/A
duration_ts=1073864023
duration=38.047903
bit_rate=41375
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

comment:21 by gordon, 2 years ago

I am observing this bug as well attempting to downmix mono he-aac. using aac-lc instead of he-aac reports audio channel count correctly

comment:22 by cauchyschwarz, 13 months ago

It seems to be related to this piece of code:

else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
            ac->oc[1].m4ac.sbr = 1;
            ac->oc[1].m4ac.ps = 1;
            ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
            output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
                             ac->oc[1].status, 1);
        }

introduced by commit a20639017bfca0490bb1799575714f22bf470b4f. I can't understand why ps == -1 and channels == 1 implies HE-AACv2. Before detecting the presence of PS data, we should not update the audio profile as HE-AACv2?

Last edited 13 months ago by cauchyschwarz (previous) (diff)
Note: See TracTickets for help on using tickets.