Mpv: how to limit youtube-dl quality

Created on 16 Mar 2017  路  13Comments  路  Source: mpv-player/mpv

my screen and my cpu only supports only 720p, so its a pain in the ass if mpv is trying to scale down a video with higher resolution. Unfortunately you also have removed the frame drop setting (capital D).

So:

How can i limit mpv to use youtube-dl formats with a maximum of 720p?

How can i get back the frame drop setting?

thanks in advance

System information:
Package: mpv
Version: 1:0.22.0-dmo1~bpo8+1
more: http://paste.debian.net/hidden/681f0bd8/

question

Most helpful comment

This is a slightly more advanced way: It picks the best format it can find (up to but not above 1080p), chooses 30fps or lower (since 60fps just leads to dropped frames and stutter on my computer), and lastly it also ignores the stupid VP9 codec.

ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9]+bestaudio/best

If you want to limit it to 720p30 or lower, use this instead:

ytdl-format=bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best

No matter what you do, I highly recommend using one of these lines in your mpv.conf. Otherwise it always picks the highest-quality version, which may mean 4K @ 60 fps = hell for your CPU to decode, and a total waste of bandwidth!

All 13 comments

Put this in your mpv.conf:

ytdl-format=bestvideo[height<=?720]+bestaudio/best

Version: 1:0.22.0-dmo1~bpo8+1

Please update.

mpv will drop frames by default in order to keep in sync with the audio.

This is a slightly more advanced way: It picks the best format it can find (up to but not above 1080p), chooses 30fps or lower (since 60fps just leads to dropped frames and stutter on my computer), and lastly it also ignores the stupid VP9 codec.

ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9]+bestaudio/best

If you want to limit it to 720p30 or lower, use this instead:

ytdl-format=bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best

No matter what you do, I highly recommend using one of these lines in your mpv.conf. Otherwise it always picks the highest-quality version, which may mean 4K @ 60 fps = hell for your CPU to decode, and a total waste of bandwidth!

@wiiaboo --ytdl-format="format-string"

now the EXACT option of youtube-dl formats are numbers, like

249          webm       audio only DASH audio   60k , opus @ 50k, 43.25MiB
250          webm       audio only DASH audio   76k , opus @ 70k, 57.71MiB
171          webm       audio only DASH audio   93k , vorbis@128k, 69.77MiB
140          m4a        audio only DASH audio  134k , m4a_dash container, mp4a.40.2@128k, 107.52MiB
251          webm       audio only DASH audio  160k , opus @160k, 121.60MiB
160          mp4        256x144    144p   74k , avc1.4d400c, 30fps, video only, 23.26MiB
278          webm       256x144    144p  128k , webm container, vp9, 30fps, video only, 77.67MiB
133          mp4        426x240    240p  131k , avc1.4d4015, 30fps, video only, 38.89MiB
242          webm       426x240    240p  224k , vp9, 30fps, video only, 95.82MiB

how to drive mpv to play with the number option? for instance, if I want to download 171 audio and 133 video, I could run
youtube-dl -f 171+133 URL
but I tried a few ways in mpv, do not know how to set the right options. and the help page does not give extra info.

resolved, run like:
mpv --ytdl-format=171+133 URL
https://github.com/mpv-player/mpv/issues/2619#issuecomment-166166164

How can I get Youtube-dl to default to 144p? So far when I've tried this line:

ytdl-format=bestvideo[height>=?144p][fps<=?30][vcodec!=?vp9]+bestaudio/best

it defaults to 360p which wasnt what i wanted. I am on data and i rather use 144p when playing youtube videos. I know the videos I've been trying have an 144p option because it works in the browser and also can be seen when i go through youtube-dl with the -F option.

@adrien2030 open a new issue with the "question template" and follow the template with logs sample, etc. We need all that info in order to help you.

@adrien2030 Your parameter is incorrect (you can try it with youtube-dl - it won't download 144p). You are asking to get the best video with height greater or equal to 144p, which, of course, isn't 144p. Also, you shouldn't include the "p" when defining the height.
Use something like this instead:
--ytdl-format="bestvideo[height=?144][fps<=?30][vcodec!=?vp9]+bestaudio/best"

what am I doing wrong?

running on Windows 10 2004

mpv 0.32.0-563-gdc24a437fb Copyright 漏 2000-2020 mpv/MPlayer/mplayer2 projects
 built on Sun Jun 21 22:18:57 +08 2020
FFmpeg library versions:
   libavutil       56.55.100
   libavcodec      58.93.100
   libavformat     58.47.100
   libswscale      5.8.100
   libavfilter     7.86.100
   libswresample   3.8.100
FFmpeg version: git-2020-06-21-842bc312a
C:\Users\balex> mpv --ytdl-format="bestvideo[height<=720]+bestaudio/best" "https://f1vod.formula1.com/f1vodprod/562/784/1586723709448/Stirling_Moss_Quotes_F1TV-478404165169-master.m3u8?e=1593811098&a=DK&h=f55ac8a21ff5e635b54ae232ea474c05"
     Video --vid=1 (h264 768x432 25.000fps) (1541 kbps)
     Video --vid=2 (h264 512x288 25.000fps) (374 kbps)
     Video --vid=3 (h264 512x288 25.000fps) (715 kbps)
     Video --vid=4 (h264 768x432 25.000fps) (1084 kbps)
     Video --vid=5 (h264 1024x576 25.000fps) (2468 kbps)
     Video --vid=6 (h264 1280x720 25.000fps) (4401 kbps)
 (+) Video --vid=7 (h264 1920x1080 25.000fps) (7681 kbps)
     Audio --aid=1 (aac 2ch 44100Hz) (1541 kbps)
     Audio --aid=2 (aac 2ch 44100Hz) (374 kbps)
     Audio --aid=3 (aac 2ch 44100Hz) (715 kbps)
     Audio --aid=4 (aac 2ch 44100Hz) (1084 kbps)
     Audio --aid=5 (aac 2ch 44100Hz) (2468 kbps)
     Audio --aid=6 (aac 2ch 44100Hz) (4401 kbps)
 (+) Audio --aid=7 (aac 2ch 44100Hz) (7681 kbps)
AO: [wasapi] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:05 / 00:02:26 (4%) A-V: -0.007 Cache: 52s/45MB

Exiting... (Quit)

it selected 1080p when I just want max of 720p 馃槖

@balexandre playing back a M3U8 stream does not at all involve youtube-dl. You can switch video tracks by cycling them with the appropriate hotkey.

@CounterPillow my bad then ... I thought it was simple, but I wasn't getting what I wanted ... would be convenient to also have an option for this kind'a files 馃槉 maybe in the future...

--hls-bitrate=<no|min|max|<rate>>

Additionally, if the option is a number, the stream with the highest rate equal or below the option value
is selected.

Instead of bestvideo[height<=720]+bestaudio/best, try bestvideo[height<=720]+bestaudio/best[height<=720].

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ww7 picture ww7  路  3Comments

SPDurkee picture SPDurkee  路  3Comments

thebunnyrules picture thebunnyrules  路  3Comments

ghost picture ghost  路  3Comments

szg0000 picture szg0000  路  3Comments