Opened 2 years ago

Closed 2 years ago

#9619 closed defect (fixed)

convolution using wrong channnels

Reported by: Glenn C Newell Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: convolution
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

"%parent%\ffmpeg.exe" -hide_banner -y -i "%%~nx_48KHz.wv" -i "%parent%\My-IR.wav" -filter_complex "[1:0]pan=stereo|c0=c0|c1=c1[fl];[1:0]pan=stereo|c0=c2|c1=c3[fr];[1:0]pan=stereo|c0=c4|c1=c5[fc];[1:0]pan=stereo|c0=c6|c1=c7[lfe];[1:0]pan=stereo|c0=c8|c1=c9[bl];[1:0]pan=stereo|c0=c10|c1=c11[br];[1:0]pan=stereo|c0=c12|c1=c13[sl];[1:0]pan=stereo|c0=c14|c1=c15[sr];[1:0]pan=stereo|c0=c16|c1=c17[flc];[1:0]pan=stereo|c0=c18|c1=c19[frc];[1:0]pan=stereo|c0=c20|c1=c21[tfl];[1:0]pan=stereo|c0=c22|c1=c23[tfr];[1:0]pan=stereo|c0=c24|c1=c25[bc];[1:0]pan=stereo|c0=c26|c1=c27[tc];[1:0]pan=stereo|c0=c28|c1=c29[tbl];[1:0]pan=stereo|c0=c30|c1=c31[tbr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr][flc][frc][tfl][tfr][bc][tc][tbl][tbr]headphone=gain=!gain!:map=FL|FR|FC|LFE|BL|BR|SL|SR|FLC|FRC|TFL|TFR|BC|TC|TBL|TBR[fh]" -map [fh]:a  "%%~nx_binaural_1.flac"

ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev5, 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-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --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      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100

The last 8 channels come out as if they used the wrong IR channels. This code works correctly (same input files) with ffmpeg git-2019-10-19 however that version has a 16th missing channel bug for audio file format .wv, which is fixed in later ffmpeg versions. So I can't use the older ffmpeg with audio files larger than 4gb (unless you can point me to another audio output file format that supports >4GB files and 16 channels).

Attachments (3)

My-IR.zip (1.7 MB ) - added by Glenn C Newell 2 years ago.
The IR file used for convolution to create binaural audio from 16ch audio.
Convert_to_binaural.zip (1.2 KB ) - added by Glenn C Newell 2 years ago.
The complete windows batch script that calls ffmpeg
ChannelIDs7.1.4 12ch.new.wv (2.4 MB ) - added by Glenn C Newell 2 years ago.
dropping this file on the script, you should get a biannual file with the height speakers in their proper locations (headphones). Again this works in older versions of ffmpeg but not current versions.

Change History (8)

by Glenn C Newell, 2 years ago

Attachment: My-IR.zip added

The IR file used for convolution to create binaural audio from 16ch audio.

by Glenn C Newell, 2 years ago

Attachment: Convert_to_binaural.zip added

The complete windows batch script that calls ffmpeg

by Glenn C Newell, 2 years ago

Attachment: ChannelIDs7.1.4 12ch.new.wv added

dropping this file on the script, you should get a biannual file with the height speakers in their proper locations (headphones). Again this works in older versions of ffmpeg but not current versions.

comment:1 by Balling, 2 years ago

format that supports >4GB files and 16 channels

w64, which is just wav.

comment:2 by Glenn C Newell, 2 years ago

Yeah my first try at w64 didn't work, as I also need sox to support it, or learn how to have ffmpeg do the resample and remix as well as the convolution (see attached batch script). But ideally whatever changed in ffmpeg would be "fixed" so the right IR pairs are used in the convolution.

comment:3 by Balling, 2 years ago

Why do you need sox? Also what is a problem? In any normal ffmpeg sox is COMPILED in. Also, clarify what is your problem with w64. I am not so sure whether using packed wv is such a good idea.

Last edited 2 years ago by Balling (previous) (diff)

comment:4 by Glenn C Newell, 2 years ago

If by sox compiled in you mean the resample lib that's good to know and I can work on learning the ffmpeg syntax for that, but I am also using sox to "remix" lessor number of channels input files to be 16 16 channels, with silence in the missing input channel parts. That makes a match with my IR file for convolution.

Anyway, the "problem" with my first go at w64 was in the version of sox I found that purported to support it. Horrible clipping on every sample. I found another sox build that works so I am good to go as far as achiving my goal of getting 16ch files, larger than 4GB, convolved.

However the reason for this ticket still exists, because ffmpeg is only working if I use an old version. Newer versions still place the top channels in the wrong place, spatially, indicating that the wrong pairs of channels are getting used for the convolution.

comment:5 by Elon Musk, 2 years ago

Resolution: fixed
Status: newclosed

Fixed in c439c6b191f731e28e5374ecc720a86af1e14308

Note that you no longer need to use this multiple pan stereo filters, just use input IR with, hrir=multich, and set proper mapping as usual for given IR file.

Note: See TracTickets for help on using tickets.