DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.64k stars 178 forks source link

Feature: certain combinations of receivers/wiring/speakers require custom channel remap #978

Open Oleksiy-Yakovenko opened 9 years ago

Oleksiy-Yakovenko commented 9 years ago

Original issue 1076 created by Alexey-Yakovenko on 2014-03-09T14:22:46.000Z:

The Ogg Vorbis mapping for 4 channel sound is: Front left, Front right, Rear left, Rear right

Deadbeef plays these as: Front left, Front right, Front center, Subwoofer

Oleksiy-Yakovenko commented 9 years ago

Comment #1 originally posted by Alexey-Yakovenko on 2014-03-09T14:24:24.000Z:

Ogg channel maps for vorbis and opus codecs: http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9

Oleksiy-Yakovenko commented 9 years ago

Comment #2 originally posted by Alexey-Yakovenko on 2014-03-09T14:27:45.000Z:

could you provide information how you test that? which sound output plugin you're using, etc?

Oleksiy-Yakovenko commented 9 years ago

Comment #3 originally posted by Alexey-Yakovenko on 2014-03-09T15:18:52.000Z:

Sample attached.

Oleksiy-Yakovenko commented 9 years ago

Comment #4 originally posted by Alexey-Yakovenko on 2014-03-12T20:40:48.000Z:

This may be OK. I tested with Alsa because Pulse maps too many things that I can't always follow. Rear speakers work now.

I have doubts about the center speaker with 3 channels though. Seems to be subwoofer only instead of center. Seemed OK with Pulse.

Oleksiy-Yakovenko commented 9 years ago

Comment #5 originally posted by Alexey-Yakovenko on 2014-03-13T09:23:43.000Z:

This issue is a peculiar case of the multichannel layout problem described in issue 1065 (in Russian).

A short explanation: There are 2 incompatible "families" of channel layouts. One (L-R-C-LFE-RL-RR...) uses channel 3 for center and 4 for LFE (compatible with old 3.0 classical records), the other (L-R-RL-RR-C-LFE...) uses channels 3 and 4 for rear left and right (4.0 compatible).

As far as I know Windows, DVDA, SACD and Nvidia use L-R-C-LFE-RL-RR... as standard, but Linux, ATI (radeon -free) and some FLAC files prefer L-R-RL-RR-C-LFE. Everything is even worse with modern multichannel records that contain upper channels to simulate cathedral organs and unusual speaker placements promoted by some audiophile music labels.

There are files with different channel order and intended speaker placements. Some older-format wav files lack any information about the channels and flacs produced from them may order the channels wrongly. In order to become a universal player deadbeef has to be able to remap channels not only to specific formats but even for specific files! An alternative would be to remix all records following a different standard yourself before playing them. Currently I have to add bogus mute channels to every 4.0 record to hear the rear channels using Nvidia ION.

It is possible to remap the channels using a virtual alsa device with ttable plugin, but you will have to manually rewrite the deadbeef config file to make the palyer use it. Besides, at least some video card-receiver combinations with HDMI interface will lose audio connection and in order to hear the sound you will have to switch back to the real (non-remapped) alsa device first and than repeat manual config editing to hear your channels properly.

Oleksiy-Yakovenko commented 9 years ago

Comment #6 originally posted by Alexey-Yakovenko on 2014-04-29T22:58:17.000Z:

Should this be duped to issue 1065?

Oleksiy-Yakovenko commented 9 years ago

Comment #7 originally posted by Alexey-Yakovenko on 2014-04-30T07:26:41.000Z:

doesn't look the same to me.

Oleksiy-Yakovenko commented 9 years ago

Comment #8 originally posted by Alexey-Yakovenko on 2014-05-26T14:15:17.000Z:

<empty>

Oleksiy-Yakovenko commented 9 years ago

Comment #9 originally posted by Alexey-Yakovenko on 2014-07-11T18:07:14.000Z:

@Ian Is this bug fixed now? You've changed how the whole channel map works, didn't you?

Oleksiy-Yakovenko commented 9 years ago

Comment #10 originally posted by Alexey-Yakovenko on 2014-07-11T20:11:00.000Z:

The new channel mapping code is functionally identical, just in a liboggedit function. So this isn't fixed. I don't fully understand this, but I think it would require configurable channel maps for different devices or output streams to be correct in all cases.

Oleksiy-Yakovenko commented 9 years ago

Comment #11 originally posted by Alexey-Yakovenko on 2014-07-11T20:19:50.000Z:

Anyone knows how other players handle that, if any?

I mean, it's fine to have custom channel maps and switch between them, even have profiles for quick switching.. but per-file?

yeah, and regarding how to remix this..

the only way i know is to have dummy channels filled with zeroes.

dikonov commented 5 years ago

This is indeed the same bug again. There are: A) hardware devices that have their hard-coded and wired channel layouts. B) files that are coded using one of the two layout families There is no function to tag files with their real channel layout. There is no function to remap channels automatically if the file layout does not match the layout expected by your device.

WAV, FLAC, APE, WV etc. (except native "cinema" formats DTS, AC3) need the remap function.

A possible fix might be to add a channel remap plugin (just like the eq and resampler) and support for a (custom) tag (+ an optional filename suffix), that would activate different remapping presets in the plugin.

Oleksiy-Yakovenko commented 5 years ago

Thanks for the additional explanation.

So the task breakdown would be like this:

  1. Identify and fix the issues with files which are expected to play correctly without using custom channel mapping
  2. Research about how other mainstream audio players store the custom per-file channel map, if they do it. I don't like the idea of introducing custom incompatible tags and so on.
  3. Find a way to implement and test all that stuff without access to the equipment - possibly using nullout plugin and waveform visualization.
dikonov commented 5 years ago

Some information for a start

WAVE-FORMAT-EXTENSIBLE (WAVE-EX) chMask WAVEFORMATEXTENSIBLE_CHANNEL_MASK

http://dream.cs.bath.ac.uk/researchdev/wave-ex/wave_ex.html http://forum.doom9.org/archive/index.php/t-170512.html

Some WAV and even FLAC files may use it. I am not aware of any user's tools to check, read and edit a chMask (in case the tags are wrong). It is hidden information, which is rarely used. Ideally there should be GUI support to

and DSP support to remap channels, especially 4.0 <-> 5.1 and 4.0/5.1 -> 2.0 for a stereo setup.


Similar bug in VLC has some information https://trac.videolan.org/vlc/ticket/15005


channel layout manipulation supported by ffmpeg: https://trac.ffmpeg.org/wiki/AudioChannelManipulation https://ffmpeg.org/ffmpeg-filters.html#pan-1


Receivers automatically detect multichannel PCM, DTS, Dolby formats streamed from the PC or a media palyer. However AFAIK common PCM streams do not carry any indication of the channel layout and the receiver has to use its default, which may be differently wired.


The KODI approach to a similar problem (3D formats) is to use any of the follwing ways to tag 3D

https://kodi.wiki/view/3D

The video decoder also reads frame-packing metadata contained in the video stream and switches the TV to 3D (This is similar to the WAVEFORMATEXTENSIBLE_CHANNEL_MASK). Frame packing metadata is impossible to change when present and it is a real PITA if it has wrong value.

Multichannel audio can work in the same way, excepts deadbeef does not need to modify its GUI.

Oleksiy-Yakovenko commented 4 years ago

Converted into feature, since this doesn't seem to be something that is obviously wrong per se, but there are certain cases where additional configurability may be needed.