Score:1

How to manually select the playback resolution for mpd files on mpv

ru flag

Sometimes I use mpv to play .mpd files. These are either local or streamed files. When the playback starts, mpv detects the highest video resolution and audio quality and starts using them.

For example, this is what appears in the terminal window when connecting to a streamed .mpd file:

     Video --vid=1 'bitrate 499950' (h264 640x360 600.000fps)
     Video --vid=2 'bitrate 999965' (h264 768x432 600.000fps)
     Video --vid=3 'bitrate 1999931' (h264 1280x720 600.000fps)
     Video --vid=4 'bitrate 2999896' (h264 1920x1080 600.000fps)
 (+) Video --vid=5 'bitrate 3999862' (h264 1920x1080 600.000fps)
     Audio --aid=1 'bitrate 96000' (aac 2ch 48000Hz)
     Audio --aid=2 'bitrate 128000' (aac 2ch 48000Hz)
     Audio --aid=3 'bitrate 192000' (aac 2ch 48000Hz)
     Audio --aid=4 'bitrate 256000' (aac 2ch 48000Hz)
 (+) Audio --aid=5 'bitrate 320000' (aac 2ch 48000Hz)
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 vaapi[nv12]
AV: 00:00:13 / 01:36:50 (0%) A-V:  0.000 Dropped: 1 Cache: 61s/33MB

The plus sign shows the automatically selected video and audio.

Is there any way or command to tell mpv to use specific video resolutions and audio qualities instead of the automatically detected ones?

Thank you.

vanadium avatar
cn flag
Question is unclear. A video file has only one specific resolution. Anything else requires reprocessing it. Are you referring to streaming to video services, which indeed can offer different qualities? Please edit your question and clarify more specifically what this question relates to. Anyway, scaling is possible. The man page is long, but your information is there.
ru flag
@vanadium, I've added some information to the question. I hope they help.
andrew.46 avatar
in flag
@Stormlord Well, you can select audio and video tracks by stream number but you want more than this?
ru flag
@andrew.46, it seems that **--vid=x** and **--aid=x** do the trick. The answer was in the list all the time but it didn't cross my mind. Thank you. Maybe you'd like to post your comment as an answer so that I can accept it.
andrew.46 avatar
in flag
@Stormlord Excellent! As you have suggested I have created a formal answer...
Score:0
in flag

In your case it looks like the best options is to select the video and audio stream that you desire from the command line.

Video stream:

The relevant video options can be seen here... The default of the options is 'auto', where as you have noted mpv selects a stream automagically:

--vid=<ID|auto|no>

But in your case you will need to select the stream of your choice from ID: for example mpv --vid=3.

Audio stream:

The relevant audio options can be seen here... The default of the options is 'auto' where again as you have noted mpv selects a stream automagically:

--aid=<ID|auto|no>

But in your case you will need to select the stream of your choice from ID: for example mpv --aid=4.

References

  • mpv manual: The manual for the current stable release of mpv.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.