Opened 13 years ago
Last modified 13 years ago
#929 open enhancement
AAC decoder does not respect request_channels
Reported by: | kaijun | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avcodec |
Version: | git-master | Keywords: | AAC |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
I tested AAC 5.1 channel audio on stereo output on arm-based beagleboard. sometimes there is audio output on left channel, other times on right channel. This issue doesn't happen on AC3 5.1 channel.
Change History (14)
comment:1 by , 13 years ago
follow-up: 3 comment:2 by , 13 years ago
it sounds like 5 channels not downmixed when compared with a DSP aac codec.
ffmpeg -i test.mp4
ffmpeg version git-2012-01-20-003b81b Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 20 2012 21:40:59 with gcc 4.5.3 20110311 (prerelease)
configuration: --enable-shared --enable-pthreads --disable-stripping --disable-gpl --disable-postproc --disable-avfilter --enable-swscale --enable-swresample --enable-neon --enable-pic --enable-debug --enable-ffmpeg --enable-ffplay --disable-avprobe --disable-avserver --cross-prefix=arm-angstrom-linux-gnueabi- --prefix=/usr --disable-x11grab --disable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --disable-libvpx --arch=arm --target-os=linux --enable-cross-compile --disable-optimizations --extra-cflags=' -O0 -fno-omit-frame-pointer -ggdb3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu' --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi --enable-hardcoded-tables --cpu=cortex-a8
WARNING: library configuration mismatch
avutil configuration: --enable-shared --enable-pthreads --disable-stripping --disable-gpl --disable-postproc --disable-avfilter --disable-swscale --enable-neon --enable-pic --enable-debug --enable-ffmpeg --disable-avplay --disable-avprobe --disable-avserver --cross-prefix=arm-angstrom-linux-gnueabi- --prefix=/usr --disable-x11grab --disable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --disable-libvpx --arch=arm --target-os=linux --enable-cross-compile --disable-optimizations --extra-cflags=' -O0 -fno-omit-frame-pointer -ggdb3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu' --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi --enable-hardcoded-tables --cpu=cortex-a8
avcodec configuration: --enable-shared --enable-pthreads --disable-stripping --disable-gpl --disable-postproc --disable-avfilter --disable-swscale --enable-neon --enable-pic --enable-debug --enable-ffmpeg --disable-avplay --disable-avprobe --disable-avserver --cross-prefix=arm-angstrom-linux-gnueabi- --prefix=/usr --disable-x11grab --disable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --disable-libvpx --arch=arm --target-os=linux --enable-cross-compile --disable-optimizations --extra-cflags=' -O0 -fno-omit-frame-pointer -ggdb3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu' --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi --enable-hardcoded-tables --cpu=cortex-a8
avformat configuration: --enable-shared --enable-pthreads --disable-stripping --disable-gpl --disable-postproc --disable-avfilter --disable-swscale --enable-neon --enable-pic --enable-debug --enable-ffmpeg --disable-avplay --disable-avprobe --disable-avserver --cross-prefix=arm-angstrom-linux-gnueabi- --prefix=/usr --disable-x11grab --disable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --disable-libvpx --arch=arm --target-os=linux --enable-cross-compile --disable-optimizations --extra-cflags=' -O0 -fno-omit-frame-pointer -ggdb3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu' --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi --enable-hardcoded-tables --cpu=cortex-a8
libavutil 51. 34.101 / 51. 34.101
libavcodec 53. 57.105 / 53. 57.105
libavformat 53. 30.100 / 53. 30.100
libavdevice 53. 4.100 / 53. 4.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isom3gp63g2a3gp4
creation_time : 2005-03-06 11:05:59
Duration: 00:01:17.35, start: 0.000000, bitrate: 321 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 96000 Hz, 5.0, s16, 320 kb/s
Metadata:
creation_time : 2005-03-06 11:05:59
handler_name : soun
comment:3 by , 13 years ago
Version: | unspecified → git-master |
---|
Replying to kaijun61:
it sounds like 5 channels not downmixed when compared with a DSP aac codec.
ffmpeg -i test.mp4
Since the command line you provide does not downmix anything (it only prints information about a media file and you do not claim that anything about the printed information is wrong), I don't think anybody could reproduce your issue.
Please provide a ffmpeg command line that allows to reproduce the problem together with the complete, uncut console output.
ffmpeg version git-2012-01-20-003b81b Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 20 2012 21:40:59 with gcc 4.5.3 20110311 (prerelease)
configuration: --enable-shared --enable-pthreads --disable-stripping --disable-gpl --disable-postproc --disable-avfilter --enable-swscale --enable-swresample --enable-neon --enable-pic --enable-debug --enable-ffmpeg --enable-ffplay --disable-avprobe --disable-avserver --cross-prefix=arm-angstrom-linux-gnueabi- --prefix=/usr --disable-x11grab --disable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --disable-libvpx --arch=arm --target-os=linux --enable-cross-compile --disable-optimizations --extra-cflags=' -O0 -fno-omit-frame-pointer -ggdb3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu' --sysroot=/home/tang/Projects/OE/build/tmp/sysroots/armv7a-angstrom-linux-gnueabi --enable-hardcoded-tables --cpu=cortex-a8
WARNING: library configuration mismatch
While this is probably not related, you could make testing and reproducing the problem much easier if you you compiled without "--enable-shared"
Any reason why you compile with "--disable-optimizations"?
follow-up: 5 comment:4 by , 13 years ago
I use gstreamer-based player to test ffmpeg aac codec in ffmpeg shared library. This issue shouldn't do anything with "--enabled-shared". using "--disabled-optimization" is easy for debugging in our build environment. How to reproduce the problem with ffmpeg? I don't see downmixing option for AAC decoding.
comment:5 by , 13 years ago
Replying to kaijun61:
I use gstreamer-based player to test ffmpeg aac codec in ffmpeg shared library.
Generally, if you see a problem with a third-party application using FFmpeg, you should always try to reproduce the problem with ffmpeg (the application) itself, after all, it may be possible that the bug is in the third-party application and not in FFmpeg, don't you agree?
This issue shouldn't do anything with "--enabled-shared".
Probably not (and I said so), but something seems to be weird with your binary (note the warnings), and it is often simpler to reproduce issues with static linking.
using "--disabled-optimization" is easy for debugging in our build environment.
I understand, that is the same reason why I prefer static linking for testing problems.
How to reproduce the problem with ffmpeg? I don't see downmixing option for AAC decoding.
So you want to report a downmixing problem in FFmpeg while claiming downmixing is not supported?
;-)
Seriously: Please test ffmpeg -i test.mp4 -ac 2 out.wav (it works fine here for multichannel aac) to get an output file with downmixed audio and report back if it works.
follow-up: 7 comment:6 by , 13 years ago
Do you mean AAC multi-channel downmixing is not supported at the moment? Any schdule to implement it.
comment:7 by , 13 years ago
Replying to kaijun61:
Do you mean AAC multi-channel downmixing is not supported at the moment?
I mean that AAC multi-channel downmixing is supported at the moment (and works fine for me).
Please test ffmpeg -i test.mp4 -ac 2 out.wav and report back if it works for you.
follow-up: 9 comment:8 by , 13 years ago
I have tested it. it works for ffmpeg, but not on AAC decoder
comment:9 by , 13 years ago
Replying to kaijun61:
I have tested it. it works for ffmpeg, but not on AAC decoder
I am not sure if above sentence makes sense, but more importantly, why can't you use FFmpeg's down-mixing routines? Only three decoders (four codecs) support internal down-mixing and since this is supported fine with ffmpeg (as you tested) I suspect it is unlikely that anybody will work on it, but maybe you could explain why it is needed?
follow-up: 11 comment:10 by , 13 years ago
I assume ffmpeg application decodes aac, then downmixes it. If I just use aac codec as a plugin. it can't do downmixing. As you said, I need down-mixing routines to implement it externally. Any particular reason not to implement it internally unlike other codecs?
follow-up: 12 comment:11 by , 13 years ago
Replying to kaijun61:
I assume ffmpeg application decodes aac, then downmixes it. If I just use aac codec as a plugin. it can't do downmixing. As you said, I need down-mixing routines to implement it externally.
Don't you think that down-mixing will be generally needed, i.e. users might want a particular down-mixing that is not supported by any codec, how should this work without your application supporting FFmpeg's down-mixing routines?
Any particular reason not to implement it internally unlike other codecs?
Yes, many:
- This work has to be duplicated for every codec that supports multichannel encoding (and I suspect that for some lossless codecs, this will be difficult) and development time unfortunately is a limiting factor.
- The general down-mixing code can easily be optimized for different CPUs, optimizing it codec-wise is significantly more difficult.
- Assuming the down-mixing does not come for free, it means a performance penalty for users who do not want down-mixing.
I suspect that all three points may not be relevant for AAC, but I do not know, otoh, I cannot believe that AAC - and TrueHD, AC-3 and DTS - are the only codecs for which GStreamer-users expect down-mixing. (Does GStreamer really not support down-mixing?)
comment:12 by , 13 years ago
Replying to cehoyos:
Replying to kaijun61:
I assume ffmpeg application decodes aac, then downmixes it. If I just use aac codec as a plugin. it can't do downmixing. As you said, I need down-mixing routines to implement it externally.
Don't you think that down-mixing will be generally needed, i.e. users might want a particular down-mixing that is not supported by any codec, how should this work without your application supporting FFmpeg's down-mixing routines?
I think most of hand devices support stereo output only. If users play a 5-channel movie, they would feel poor quality sound.
Any particular reason not to implement it internally unlike other codecs?
Yes, many:
- This work has to be duplicated for every codec that supports multichannel encoding (and I suspect that for some lossless codecs, this will be difficult) and development time unfortunately is a limiting factor.
- The general down-mixing code can easily be optimized for different CPUs, optimizing it codec-wise is significantly more difficult.
- Assuming the down-mixing does not come for free, it means a performance penalty for users who do not want down-mixing.
I suspect that all three points may not be relevant for AAC, but I do not know, otoh, I cannot believe that AAC - and TrueHD, AC-3 and DTS - are the only codecs for which GStreamer-users expect down-mixing. (Does GStreamer really not support down-mixing?)
I need to investigate if GStreamer has downmixing plugin.
comment:14 by , 13 years ago
Priority: | normal → wish |
---|---|
Reproduced by developer: | set |
Status: | new → open |
Summary: | AAC 5.1 channel decoding issue → AAC decoder does not respect request_channels |
Type: | defect → enhancement |
This works at least for ac-3 and eac-3.
$ ffmpeg -request_channels 1 -i fate-suite/aac/al_sbr_cm_48_5.1.mp4 out.wav ffmpeg version N-37197-ga8ae00b Copyright (c) 2000-2012 the FFmpeg developers built on Jan 27 2012 00:29:41 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 34.101 / 51. 34.101 libavcodec 53. 60.100 / 53. 60.100 libavformat 53. 31.100 / 53. 31.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 60.100 / 2. 60.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al_sbr_cm_48_5.1.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2008-01-22 11:26:59 Duration: 00:00:32.17, start: 0.000000, bitrate: 129 kb/s Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 6 channels, s16, 128 kb/s Metadata: creation_time : 2008-01-22 11:26:59 handler_name : soun Output #0, wav, to 'out.wav': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2008-01-22 11:26:59 encoder : Lavf53.31.100 Stream #0:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 6 channels, s16, 4608 kb/s Metadata: creation_time : 2008-01-22 11:26:59 handler_name : soun Stream mapping: Stream #0:0 -> #0:0 (aac -> pcm_s16le) Press [q] to stop, [?] for help size= 18096kB time=00:00:32.17 bitrate=4608.0kbits/s video:0kB audio:18096kB global headers:0kB muxing overhead 0.000248%
To make this a valid ticket, please add: