mpv-player / mpv-player/mpv

[Feature] Add CLI/config option to autoselect audio track based on channel count/layout

Open
#8,625 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:option-param-conf meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

It's common for a file to have multiple audio tracks with different channel layouts, e.g. stereo and surround.

The desired behaviour is an option such as alayout, similar to and likely taking precedence behind the existing alang option, which when set would autoselect the audio track within the available options based on channel count/layout.

Here is an example of the terminal output from an mkv file with two audio tracks, one surround and one stereo:

(+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
(+) Audio --aid=1 --alang=jpn (*) '5.1' (aac 6ch 48000Hz)
    Audio --aid=2 --alang=jpn '2.0' (aac 2ch 48000Hz)

When run with the CLI option alayout=2.0/alayout=2ch or with this specified in mpv.conf, mpv would automatically select a matching audio track layout if available and in this case play the example file with the second audio track selected. With alang=eng set and an additional English surround track in the file, the language setting should take precedence over the channel layout preference, and the English track should be selected instead of the Japanese stereo track.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by tracing how the existing alang CLI option and mpv.conf setting select audio tracks, using the example terminal output as the expected behavior. Define how alayout=2.0 and alayout=2ch match available layouts and confirm that language selection takes precedence; done means the preferred matching track is selected when available without changing the language precedence.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.