No sound, --aid=auto picks track that cannot be decoded

Open
#18,581 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c

Research direction

The bug is in automatic audio track selection: --aid=auto picks an APAC track that no decoder can open, so playback goes silent. Start from the log lines [ad] Failed to initialize a decoder for codec 'apple_apac' and Audio: no audio to find where the default track is chosen and where decoder setup fails. Reproduce with the attached apple_apac.mov, where --aid=2 plays correctly. Done means the default selection falls back to a decodable track, or the failure is reported, and the iPhone sample plays with sound. The issue also asks a design question about the expected fallback behaviour, so confirm the approach with maintainers first.

Written by the indexing model from the issue text.

Description

os:mac
mpv Information
mpv v0.41.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.360.1
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 15.7.9 (24G830)
- Source of mpv: brew installed
- Latest known working version: Unknown
- Issue started after the following happened: Movies taken on iPhone changed
Reproduction Steps

This issue asks two questions:

  • Should the automatic behavior of the aid option be to try another audio stream if the one it picks cannot be decoded?
  • How can mpv be configured to not have this problem with iPhone videos?

Newer iPhones will generate movies that have two audio streams. One of the audio streams is encoded using the Apple Positional Audio Codec which FFmpeg 9.0.2 does not support (FFmpeg is adding support). If by default the APAC encoded audio stream is selected then the video plays without sound:

low-batt@gag audio$ mpv --no-config --gpu-debug --log-file=output.txt apple_apac.mov
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: overread end of atom 'stsd' by 184 bytes
● Video  --vid=1  (hevc 3840x2160 30 fps) [default]
● Audio  --aid=1  (apple_apac 4ch 48000 Hz 413 kbps) [default]
○ Audio  --aid=2  (aac 2ch 48000 Hz 195 kbps)
Failed to initialize a decoder for codec 'apple_apac'.
Audio: no audio
VO: [gpu-next] 3840x2160 yuv420p10
V: 00:00:01 / 00:00:01 (97%) 
Exiting... (End of file)
low-batt@gag audio$ 

From the log file:

[   0.057][v][ad] Codec list:
[   0.057][v][ad]     (no decoders)
[   0.057][e][ad] Failed to initialize a decoder for codec 'apple_apac'.
[   0.057][v][lavf] deselect track 1
[   0.058][i][cplayer] Audio: no audio

The attached file plays fine when --aid=2 is specified. But that cannot be used when playing a playlist with different kinds of files.

Can some sort of conditional auto profile be used as a workaround until FFmpeg supports Apple APAC?

To add to the confusion, I had a friend generate a test video and in that video file the audio stream using APAC is the 2nd audio stream and by default mpv plays it with sound.

This problem was reported against IINA in issue https://github.com/iina/iina/issues/6378.

Expected Behavior

The movie plays with sound.

Actual Behavior

By default the movie plays without any sound.

Log File

output.txt

Sample Files

apple_apac.mov.zip

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mpv-player/mpv

All issues in mpv-player/mpv

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.