Opened 13 months ago

Last modified 13 months ago

#10276 new defect

Reversed channel order with showspectrumpic mode=separate

Reported by: SomeHumanPerson Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: showspectrumpic
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Multi-channel spectrogram images produced by "showspectrumpic" with "mode=separate" display the individual channels ordered from the bottom up instead of from the top down. This is the opposite of how "showwavespic" (and any other software I am familiar with) orders the channels.

With a common 5.1(side) channel layout, for example, "showwavespic" in "split" mode displays FL-FR-C-LFE-SL-SR in order from the top down.

But "showspectrumpic" in "separate" mode displays the channels in the reverse order, from the bottom up.

How to reproduce:

% ffmpeg -hide_banner -i "F:\Test.wav" -lavfi showspectrumpic=mode=separate:fscale=log:size=1200x1536 -frames:v 1 -update 1 Spectrogram.png
Input #0, wav, from 'F:\Test.wav':
  Metadata:
    encoder         : Lavf59.35.100
  Duration: 01:45:37.26, bitrate: 6912 kb/s
  Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1(side), s32 (24 bit), 6912 kb/s
Stream mapping:
  Stream #0:0 (pcm_s24le) -> showspectrumpic:default
  showspectrumpic:default -> Stream #0:0 (png)
Press [q] to stop, [?] for help

% ffmpeg -v 9 -loglevel 99 -i "F:\Test.wav"
ffmpeg version 2023-03-20-git-57afccc0ef-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58.  4.100 / 58.  4.100
  libavcodec     60.  6.101 / 60.  6.101
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument 'F:\Test.wav'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url F:\Test.wav.
Successfully parsed a group of options.
Opening an input file: F:\Test.wav.
[NULL @ 000002a10deb52c0] Opening 'F:\Test.wav' for reading
[file @ 000002a10deb5900] Setting default whitelist 'file,crypto,data'
Probing wav score:100 size:2048
[wav @ 000002a10deb52c0] Format wav probed with size=2048 and score=100
[wav @ 000002a10deb52c0] Before avformat_find_stream_info() pos: 138 bytes read:65674 seeks:1 nb_streams:1
[wav @ 000002a10deb52c0] parser not found for codec pcm_s24le, packets or times may be invalid.
    Last message repeated 1 times
[wav @ 000002a10deb52c0] All info found
[wav @ 000002a10deb52c0] stream 0: start_time: NOPTS duration: 6337.26
[wav @ 000002a10deb52c0] format: start_time: NOPTS duration: 6337.26 (estimate from stream) bitrate=6912 kb/s
[wav @ 000002a10deb52c0] After avformat_find_stream_info() pos: 204438 bytes read:295050 seeks:1 frames:50
Input #0, wav, from 'F:\Test.wav':
  Metadata:
    encoder         : Lavf59.35.100
  Duration: 01:45:37.26, bitrate: 6912 kb/s
  Stream #0:0, 50, 1/48000: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1(side), s32 (24 bit), 6912 kb/s
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 000002a10deb3400] Statistics: 295050 bytes read, 1 seeks

I have reproduced this with an assortment of 5.1 and 7.1 input files in various formats (ac3, dts, wav/w64). Any simple channel-mapping test file should work fine.

Change History (1)

comment:1 by SomeHumanPerson, 13 months ago

I'm using the temporary workaround of remapping the channels before passing to "showspectrumpic" (again using a 5.1 channel input for my example):

% ffmpeg -hide_banner -i "F:\Test.wav" -filter_complex "channelmap=map=5|4|3|2|1|0[rev];[rev]showspectrumpic=mode=separate:fscale=log:size=1200x1536" -frames:v 1 -update 1 Spectrogram.png
Note: See TracTickets for help on using tickets.