Audio channels (L-R) swapped

オープン
#18,802 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, macos

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
C
スター
38.2k
フォーク
3.7k
平均マージ
1日 13時間
マージ済み PR(30日)
76

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mpv-player/mpv のほかの issue

mpv-player/mpv の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。