* [FFmpeg-devel] libswresample/rematrix.c sane_layout
@ 2025-01-30 3:29 Pavel Koshevoy
2025-02-02 0:01 ` Pavel Koshevoy
2025-02-02 16:04 ` James Almer
0 siblings, 2 replies; 4+ messages in thread
From: Pavel Koshevoy @ 2025-01-30 3:29 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]
Hi,
I have a file which I can't down-mix to stereo due to
AV_CHANNEL_ORDER_NATIVE requirement in sane_layout.
```
$ 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.
In any case, I'm attaching the patch here, and hopefully someone more
knowledgeable can come up with a more appropriate fix.
[-- Attachment #2: 0001-libswr-rematrix-Do-no-require-AV_CHANNEL_ORDER_NATIV.patch --]
[-- Type: text/x-patch, Size: 951 bytes --]
From 8dfd5ac84171d591665f069ec935bdf7b8b69936 Mon Sep 17 00:00:00 2001
From: Pavel Koshevoy <pkoshevoy@gmail.com>
Date: Wed, 29 Jan 2025 20:24:42 -0700
Subject: [PATCH] libswr/rematrix: Do no require AV_CHANNEL_ORDER_NATIVE from
sane_layout
---
libswresample/rematrix.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index b9bf4dcac0..f8d77db21f 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -104,8 +104,6 @@ static int clean_layout(AVChannelLayout *out, const AVChannelLayout *in, void *s
}
static int sane_layout(AVChannelLayout *ch_layout) {
- if (ch_layout->order != AV_CHANNEL_ORDER_NATIVE)
- return 0;
if(!av_channel_layout_subset(ch_layout, AV_CH_LAYOUT_SURROUND)) // at least 1 front speaker
return 0;
if(!even(av_channel_layout_subset(ch_layout, (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)))) // no asymetric front
--
2.43.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] libswresample/rematrix.c sane_layout
2025-01-30 3:29 [FFmpeg-devel] libswresample/rematrix.c sane_layout Pavel Koshevoy
@ 2025-02-02 0:01 ` Pavel Koshevoy
2025-02-02 16:04 ` James Almer
1 sibling, 0 replies; 4+ messages in thread
From: Pavel Koshevoy @ 2025-02-02 0:01 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, Jan 29, 2025 at 8:29 PM Pavel Koshevoy <pkoshevoy@gmail.com> wrote:
> Hi,
>
> I have a file which I can't down-mix to stereo due to
> AV_CHANNEL_ORDER_NATIVE requirement in sane_layout.
>
> ```
> $ 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.
> In any case, I'm attaching the patch here, and hopefully someone more
> knowledgeable can come up with a more appropriate fix.
>
>
>
Just want to mention that this issue does not exist on release/6.1 branch,
so it's probably a regressions introduced in ffmpeg 7+
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] libswresample/rematrix.c sane_layout
2025-01-30 3:29 [FFmpeg-devel] libswresample/rematrix.c sane_layout Pavel Koshevoy
2025-02-02 0:01 ` Pavel Koshevoy
@ 2025-02-02 16:04 ` James Almer
2025-02-02 22:01 ` Pavel Koshevoy
1 sibling, 1 reply; 4+ messages in thread
From: James Almer @ 2025-02-02 16:04 UTC (permalink / raw)
To: ffmpeg-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 3732 bytes --]
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.
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] libswresample/rematrix.c sane_layout
2025-02-02 16:04 ` James Almer
@ 2025-02-02 22:01 ` Pavel Koshevoy
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Koshevoy @ 2025-02-02 22:01 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sun, Feb 2, 2025 at 9:04 AM James Almer <jamrial@gmail.com> wrote:
> 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?
>
>
I will send you a 5s clip of the audio, privately ... don't want to spam
the whole mailing list with it.
Thank you,
Pavel
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-02 22:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-30 3:29 [FFmpeg-devel] libswresample/rematrix.c sane_layout Pavel Koshevoy
2025-02-02 0:01 ` Pavel Koshevoy
2025-02-02 16:04 ` James Almer
2025-02-02 22:01 ` Pavel Koshevoy
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git