Audio channels (L-R) swapped
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, macos
- Domain
- audio-video-rtc, backend
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Download the YouTube video Stereo Test - Left/Right Audio Test for Headphones/Speakers using yt-dlp with the option -f 137+140 to obtain a format compatible with QuickTime Player
- Attach an Apple/LG UltraFine™ 27MD5KL-B monitor to a compatible Mac
- Open the Audio MIDI Setup app found in
/Applications/Utilities - Select
LG UltraFind Display Audio 2(the speakers) and click onConfigure Speakers… - Swap the left and right channels as shown here:
- 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
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.
- Dominant language
- C
- Stars
- 38.2k
- Forks
- 3.7k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 76
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mpv-player/mpv
-
meta:feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
mpv-player/mpv#18855 · 2 comments ·
Maintainers usually reply within 1 day
-
meta:feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
mpv-player/mpv#18683 · 4 comments ·
Maintainers usually reply within 1 day
-
Subtitle delay value displays "-0ms"May be free again A pull request for this issue was closed without being merged. Openos:linux
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
mpv-player/mpv#18649 · 1 comment ·
Maintainers usually reply within 1 day
-
meta:feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mpv-player/mpv#18464 ·
Maintainers usually reply within 1 day
-
Keyboard shortcut next and previous secondary subtitle filePossibly taken @ravarnax claimed this 225 days ago. Openmeta:feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mpv-player/mpv#17693 · 5 comments · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
`sha256()` returns a wrong hash when libsql-ffi is built with gcc 11 or laterPossibly taken @colinhacks claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tursodatabase/libsql#2333 ·
Maintainers usually reply within 11 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenPrinting/cups#1826 ·
Maintainers usually reply within 1 day
-
Backport to 3.0 advertises a suffix that does not existPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
389ds/389-ds-base#8152 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RetroAchievements/rcheevos#580 · 1 comment ·
Maintainers usually reply within 5 days