[FFmpeg-devel] libswresample/rematrix.c sane_layout

James Almer jamrial at gmail.com
Sun Feb 2 18:04:29 EET 2025


On 1/30/2025 12:29 AM, Pavel Koshevoy wrote:
> Hi,
> 
> I have a file which I can't down-mix to stereo due to
> AV_CHANNEL_ORDER_NATIVE requirement in sane_layout.

Can you share that file? Or any other that reproduces this?

> 
> ```
> $ ffmpeg -i COMMUNITY_HERO_2.mov -vn -af
> 'aformat=sample_rates=48000:channel_layouts=stereo' -y /tmp/out.wav
> ffmpeg version N-118381-g4ba9ae7742 Copyright (c) 2000-2025 the FFmpeg
> developers
>    built with gcc 7 (SUSE Linux)
>    configuration: --prefix=/Developer/x86_64 --prefix=/Developer/x86_64
> --enable-runtime-cpudetect --enable-libzimg --enable-libx264
> --enable-libass --enable-libmodplug --enable-libxml2 --enable-libvmaf
> --enable-shared --enable-pthreads --enable-gpl --enable-version3
> --enable-gnutls --enable-libfreetype --enable-pic --disable-static
> --enable-shared --enable-rpath --enable-ffnvcodec --enable-debug
> --disable-stripping --disable-optimizations --disable-mmx
>    libavutil      59. 56.100 / 59. 56.100
>    libavcodec     61. 31.101 / 61. 31.101
>    libavformat    61.  9.106 / 61.  9.106
>    libavdevice    61.  4.100 / 61.  4.100
>    libavfilter    10.  9.100 / 10.  9.100
>    libswscale      8. 13.100 /  8. 13.100
>    libswresample   5.  4.100 /  5.  4.100
>    libpostproc    58.  4.100 / 58.  4.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'COMMUNITY_HERO_2.mov':
>    Metadata:
>      major_brand     : qt
>      minor_version   : 512
>      compatible_brands: qt
>      encoder         : Lavf58.29.100
>    Duration: 00:02:02.86, start: 0.000000, bitrate: 97805 kb/s
>    Stream #0:0[0x1]: Video: prores (LT) (apcs / 0x73637061), yuv422p10le(top
> first), 1920x1080, 88583 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k
> tbn (default)
>      Metadata:
>        handler_name    : VideoHandler
>        vendor_id       : FFMP
>        encoder         : Lavc58.54.100 prores
>        timecode        : 14:25:46;28
>    Stream #0:1[0x2]: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 8
> channels (FL+FR+FC+LFE+SL+SR+BL+BR), s32 (24 bit), 9216 kb/s (default)
>      Metadata:
>        handler_name    : SoundHandler
>        vendor_id       : [0][0][0][0]
>    Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
>      Metadata:
>        handler_name    : TimeCodeHandler
>        timecode        : 14:25:46;28
> Stream mapping:
>    Stream #0:1 -> #0:0 (pcm_s24le (native) -> pcm_s16le (native))
> Press [q] to stop, [?] for help
> [auto_aresample_0 @ 0x7ff5bc004900] [SWR @ 0x7ff5bc0049f0] Input channel
> layout '8 channels (FL+FR+FC+LFE+SL+SR+BL+BR)' is not supported
> [auto_aresample_0 @ 0x7ff5bc004900] Failed to configure output pad on
> auto_aresample_0
> [af#0:0 @ 0x21841830] Error reinitializing filters!
> [af#0:0 @ 0x21841830] Task finished with error code: -22 (Invalid argument)
> [af#0:0 @ 0x21841830] Terminating thread with return code -22 (Invalid
> argument)
> [aost#0:0/pcm_s16le @ 0x218412b0] [enc:pcm_s16le @ 0x21841770] Could not
> open encoder before EOF
> [aost#0:0/pcm_s16le @ 0x218412b0] Task finished with error code: -22
> (Invalid argument)
> [aost#0:0/pcm_s16le @ 0x218412b0] Terminating thread with return code -22
> (Invalid argument)
> [out#0/wav @ 0x21840b80] Nothing was written into output file, because at
> least one of its streams received no packets.
> size=       0KiB time=N/A bitrate=N/A speed=N/A
> Conversion failed!
> ```
> 
> If I remove 2 lines from sane_layout then I am able to process this file
> successfully.
> However IDK the implications of this change.

swr will attempt to handle things it doesn't understand, like ambisonics 
or channels in arbitrary positions, potentially crashing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250202/5fa6e1fb/attachment.sig>


More information about the ffmpeg-devel mailing list