[FFmpeg-trac] #6638(avfilter:new): aresample does not work for unknown channel layouts

FFmpeg trac at avcodec.org
Tue Sep 5 19:19:55 EEST 2017


#6638: aresample does not work for unknown channel layouts
-------------------------------------+-------------------------------------
             Reporter:  CoRoNe       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:
             Keywords:  aresample    |  unspecified
  unknown channel layouts            |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 FFmpeg used:
 {{{
 ffmpeg version N-86763-g341f012-Reino Copyright (c) 2000-2017 the FFmpeg
 developers
   built with gcc 7.1.0 (GCC)
   configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/cygdrive/m
 /ffmpeg-windows-build-helpers-
 master/native_build/windows/ffmpeg_local_builds/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-
 --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=Reino
 --enable-gray --enable-version3 --disable-debug --disable-doc --disable-
 htmlpages --disable-manpages --disable-podpages --disable-txtpages
 --disable-w32threads --disable-schannel --enable-fontconfig --enable-gmp
 --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b
 --enable-libcaca --enable-libfdk-aac --enable-libflite --enable-
 libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-
 libilbc --enable-libmodplug --enable-libmp3lame --enable-libmysofa
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-libsnappy --enable-libsoxr
 --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-
 amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-
 libzimg --enable-libzvbi --enable-gpl --enable-avisynth --enable-frei0r
 --enable-filter=frei0r --enable-librubberband --enable-libvidstab
 --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
 --enable-avresample --extra-cflags='-march=pentium3' --extra-cflags=-O2
 --extra-cflags='-mfpmath=sse' --extra-cflags=-msse --enable-static
 --disable-shared --prefix=/cygdrive/m/ffmpeg-windows-build-helpers-
 master/native_build/windows/ffmpeg_local_builds/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32
   libavutil      55. 67.100 / 55. 67.100
   libavcodec     57.100.104 / 57.100.104
   libavformat    57. 75.100 / 57. 75.100
   libavdevice    57.  7.100 / 57.  7.100
   libavfilter     6. 95.100 /  6. 95.100
   libavresample   3.  6.  0 /  3.  6.  0
   libswscale      4.  7.101 /  4.  7.101
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 }}}
 ----
 The last couple of days I've been experimenting with the loudnorm-filter,
 but only to find out that something fishy is going on with the aresample-
 filter:
 {{{
 ffmpeg -v 40 -i input.wav -af "loudnorm,aresample=44100" -f null NUL
 [graph_0_in_0_0 @ 04bc07a0] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04b29540] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [Parsed_aresample_1 @ 04bc0360] Cannot select channel layout for the link
 between filters Parsed_aresample_1 and format_out_0_0.
 Error reinitializing filters!
 Failed to inject frame into filter network: Invalid argument
 Error while processing the decoded data for stream #0:0
 }}}
 You'd explicitly have to use "aformat=channel_layouts=stereo" or "-ac 2",
 or it will fail.
 {{{
 ffmpeg -v 40 -i input.wav -af
 "loudnorm,aresample=44100,aformat=channel_layouts=stereo" -f null NUL
 [graph_0_in_0_0 @ 04bc04a0] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04b29560] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [auto_resampler_0 @ 04bd2400] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2
 chl:stereo fmt:dbl r:192000Hz
 [Parsed_aresample_1 @ 04b754c0] ch:2 chl:stereo fmt:dbl r:192000Hz -> ch:2
 chl:stereo fmt:s16 r:44100Hz
 Output #0, null, to 'NUL':
     Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
 }}}
 For the video I'm trying to encode I use the adelay-filter next. Strange
 thing is that somehow in this case "aformat=channel_layouts=stereo" isn't
 needed:
 {{{
 ffmpeg -v 40 -i input.wav -af "loudnorm,aresample=44100,adelay=1000|1000"
 -f null NUL
 [graph_0_in_0_0 @ 04bb0b40] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04b29520] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [format_out_0_0 @ 04bd22c0] auto-inserting filter 'auto_resampler_1'
 between the filter 'Parsed_adelay_2' and the filter 'format_out_0_0'
 [auto_resampler_0 @ 04ba0a00] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2
 chl:stereo fmt:dbl r:192000Hz
 [Parsed_aresample_1 @ 04bc0320] ch:2 chl:stereo fmt:dbl r:192000Hz -> ch:2
 chl:stereo fmt:dblp r:44100Hz
 [auto_resampler_1 @ 04d39ee0] ch:2 chl:stereo fmt:dblp r:44100Hz -> ch:2
 chl:stereo fmt:s16 r:44100Hz
 Output #0, null, to 'NUL':
     Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
 }}}
 But it gets weirder. The following encoders (that I've tested) seem to
 accept the adelay-filter's output:
 {{{
 ffmpeg -v 40 -i input.wav -af "loudnorm,aresample=44100,adelay=1000|1000"
 -c:a {libfdk_aac,libmp3lame,libtwolame,ac3,flac,alac,tta} -f null NUL
 [graph_0_in_0_0 @ 04bc0220] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [graph_0_in_0_0 @ 04bc0520] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04baf760] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [format_out_0_0 @ 04ba0ba0] auto-inserting filter 'auto_resampler_1'
 between the filter 'Parsed_adelay_2' and the filter 'format_out_0_0'
 [auto_resampler_0 @ 04b91760] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2
 chl:stereo fmt:dbl r:192000Hz
 [Parsed_aresample_1 @ 04b29580] ch:2 chl:stereo fmt:dbl r:192000Hz -> ch:2
 chl:stereo fmt:dblp r:44100Hz
 [auto_resampler_1 @ 04d39e40] ch:2 chl:stereo fmt:dblp r:44100Hz -> ch:2
 chl:stereo fmt:s16 r:44100Hz
 Output #0, null, to 'NUL':
     Stream #0:0: Audio: aac (libfdk_aac), 44100 Hz, stereo, s16, delay
 2048, 128 kb/s
     Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp, delay
 1105
     Stream #0:0: Audio: mp2 (libtwolame), 44100 Hz, stereo, fltp, delay
 481, 384 kb/s
     Stream #0:0: Audio: ac3, 44100 Hz, stereo, fltp, delay 256, 192 kb/s
     Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit), 128 kb/s
     Stream #0:0: Audio: alac, 44100 Hz, stereo, s32p (24 bit), 128 kb/s
     Stream #0:0: Audio: tta, 44100 Hz, stereo, s32 (24 bit), 128 kb/s
 }}}
 But the following encoders (that I've tested) don't:
 {{{
 ffmpeg -v 40 -i input.wav -af "loudnorm,aresample=44100,adelay=1000|1000"
 -c:a {libopus,libvorbis,aac,wmav2,wavpack} -f null NUL
 [graph_0_in_0_0 @ 04bc0520] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04b29580] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [format_out_0_0 @ 04ba0ba0] auto-inserting filter 'auto_resampler_1'
 between the filter 'Parsed_adelay_2' and the filter 'format_out_0_0'
 [Parsed_aresample_1 @ 04cdb420] Cannot select channel layout for the link
 between filters Parsed_aresample_1 and Parsed_adelay_2.
 Error reinitializing filters!
 Failed to inject frame into filter network: Invalid argument
 Error while processing the decoded data for stream #0:0
 }}}
 They again need "aformat=channel_layouts=stereo" or "-ac 2".
 {{{
 ffmpeg -v 40 -i input.wav -af
 "loudnorm,aresample=44100,aformat=channel_layouts=stereo,adelay=1000|1000"
 -c:a {libopus,libvorbis,aac,wmav2,wavpack} -f null NUL
 [graph_0_in_0_0 @ 04baf7e0] tb:1/44100 samplefmt:s16 samplerate:44100
 chlayout:0x3
 [Parsed_loudnorm_0 @ 04b29620] auto-inserting filter 'auto_resampler_0'
 between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
 [format_out_0_0 @ 04b91f40] auto-inserting filter 'auto_resampler_1'
 between the filter 'Parsed_adelay_3' and the filter 'format_out_0_0'
 [auto_resampler_0 @ 04b83820] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2
 chl:stereo fmt:dbl r:192000Hz
 [Parsed_aresample_1 @ 04b906a0] ch:2 chl:stereo fmt:dbl r:192000Hz -> ch:2
 chl:stereo fmt:dblp r:44100Hz
 [auto_resampler_1 @ 04bc0040] ch:2 chl:stereo fmt:dblp r:44100Hz -> ch:2
 chl:stereo fmt:flt r:48000Hz
 Output #0, null, to 'NUL':
     Stream #0:0: Audio: opus (libopus), 48000 Hz, stereo, flt, delay 312,
 96 kb/s
     Stream #0:0: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp
     Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, delay 1024, 128
 kb/s
     Stream #0:0: Audio: wmav2, 44100 Hz, stereo, fltp, delay 2048, 128
 kb/s
     Stream #0:0: Audio: wavpack, 44100 Hz, stereo, fltp, 128 kb/s
 }}}
 So it seems (if my judgement is correct) that not only aresample, but also
 adelay doesn't work for unknown channel layouts.

 I guess this issue is quite similar to
 https://trac.ffmpeg.org/ticket/5218.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6638>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list