Audio channels (L-R) swapped

Aperta
#18,802 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c, macos

Direzione di ricerca

Start by reading the CoreAudio output code and the history of PR #15622 and PR #18679, which changed handling of kAudioOutputUnitProperty_ChannelMap. Compare the current behavior with the attached log and reproduce using the stated stereo test and Audio MIDI Setup channel swap on macOS. Done means mpv's CoreAudio output reflects that channel map without breaking initialization.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

os:mac
mpv Information
mpv v0.42.0 Copyright © 2000-2026 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.387.0
FFmpeg version: 9.0.2
FFmpeg library versions:
   libavcodec      63.1.102
   libavdevice     63.1.102
   libavfilter     12.1.102
   libavformat     63.1.102
   libavutil       61.1.102
   libswresample   7.1.102
   libswscale      10.1.102
Other Information
- macOS version: macOS 27.2 (26B123)
- Source of mpv: Homebrew
- Latest known working version: 0.41.0, sort of, further discussion below
- Issue started after the following happened: Audio MIDI Setup used to reverse channels
Reproduction Steps
Image
  • Play the video with mpv and note that the left and right channels are not swapped

When reproducing the problem I ran mpv with these options:

low-batt@gag ~$ mpv --no-config --gpu-debug --log-file=output.txt ~/Movies/Stereo\ Test\ -\ Left⧸Right\ Audio\ Test\ for\ Headphones⧸Speakers\ \[YwNs1Z0qRY0\].mp4 
● Video  --vid=1  --vlang=eng  (h264 1920x1080 30 fps 384 kbps) [default]
● Audio  --aid=1  --alang=eng  (aac 2ch 48000 Hz 128 kbps) [default]
AO: [coreaudio] 48000Hz fr-fl (stereo) 2ch floatp
VO: [gpu-next] 1920x1080 yuv420p
Audio device underrun detected.          
AV: 00:00:20 / 00:00:20 (100%) A-V:  0.000 Dropped: 4
Exiting... (End of file)
low-batt@gag ~$ 
Expected Behavior

The mpv audio channel layout reflects the changes made using the Audio MIDI Setup app.

Actual Behavior

The channel layout does not reflect the configuration applied by Audio MIDI Setup.

This is sort of a reopening of closed issue #15584. I say "sort of" because the situation is now different.

The title of #15584 indicates the problem is with the coreaudio driver:

Audio channels (L-R) swapped using coreaudio, avfoundation correct

Also in #15584 I reported this:

Play the above video with QuickTime Player and VLC and note the left and right channels are reversed as expected

And this:

Running mpv with --ao=avfoundation the behavior is as expected and matches QuickTime Player and VLC.

That was under macOS 15. Much of this behavior has changed. This is the behavior I'm now experiencing under macOS 27 with the speakers swapped:

App Left Speaker Right Speaker
ffplay 9.0.2 Left Channel Right Channel
QuickTime 10.5 (1278.2) Left Channel Right Channel
mpv 0.39.0 avfoundation Left Channel Right Channel
mpv 0.42.0 coreaudio Left Channel Right Channel
mpv 0.42.0 avfoundation Left Channel Right Channel
VLC 3.0.24 Right Channel Left Channel

Now only VLC properly reflects the configuration applied in Audio MIDI Setup.

Issue #15584 was "fixed" by PR #15622. With the changes in that PR, mpv exhibited the correct behavior and reflected the configuration applied in Audio MIDI Setup. However the wrong type of value was being assigned to the kAudioOutputUnitProperty_ChannelMap property. Apparently the incorrect value just happened to provide the correct behavior. That was up until macOS 27 where Apple added validation that detected the wrong type of value was being assigned and rejected it causing coreaudio initialization to fail (issue #18384). Setting the wrong type of value has been fixed by PR #18679, without addressing the problem described in this issue.

Log File

output.txt

Sample Files

I downloaded the YouTube video Left/Right Audio Test for Headphones/Speakers like so:

yt-dlp -f 137+140 https://www.youtube.com/watch?v=YwNs1Z0qRY0
I carefully read all instruction and confirm that I did the following:
  • I tested and confirmed that the issue exists with the latest release version or newer.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.
Lingua principale
C
Stelle
38.2k
Fork
3.7k
Merge medio
1g 13h
PR unite (30g)
76

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mpv-player/mpv

Tutte le issue di mpv-player/mpv

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.