yt-dlp: Youtube get URL with slow speed download
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
- I understand that I will be blocked if I intentionally remove or skip any mandatory* field
Checklist
- I’m asking a question and not reporting a bug or requesting a feature
- I’ve looked through the README
- I’ve verified that I’m running yt-dlp version 2023.02.17 (update instructions) or later (specify commit)
- I’ve searched known issues and the bugtracker for similar questions including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
Please make sure the question is worded well enough to be understood
Hi, I’m wondering if anyone else is having the same problem as me in that the URL of the Youtube video occasionally has sluggish download speed (around 30KB/s), especially with video format id 137?
The download speed is too slow about 161KB/s but many videos have better speed:
[youtube] Extracting URL: yTCDVfMz15M
[youtube] yTCDVfMz15M: Downloading webpage
[youtube] yTCDVfMz15M: Downloading android player API JSON
[info] yTCDVfMz15M: Downloading 1 format(s): 22
[download] Destination: P!nk - Try (Official Video) [yTCDVfMz15M].mp4
[download] 100% of 19.67MiB in 00:00:00 at 51.88MiB/s
Do you think this is an issue? Thanks.
Provide verbose output that clearly demonstrates the problem
- Run your yt-dlp command with -vU flag added (
yt-dlp -vU <your command line>
) - Copy the WHOLE output (starting with
[debug] Command-line config
) and insert it below
Complete Verbose Output
# yt-dlp -vUf 135 https://www.youtube.com/watch?v=xspg7SNxTWA
[debug] Command-line config: ['-vUf', '135', 'https://www.youtube.com/watch?v=xspg7SNxTWA']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out UTF-8, error UTF-8, screen UTF-8
[debug] yt-dlp version 2023.02.17 [a0a7c01] (pip)
[debug] Python 3.7.16 (CPython x86_64 64bit) - Linux-4.18.0-408.el8.x86_64-x86_64-with-Ubuntu-18.04-bionic (OpenSSL 1.1.1 11 Sep 2018, glibc 2.26)
[debug] exe versions: ffmpeg information (setts), ffprobe information
[debug] Optional libraries: Cryptodome-3.17, certifi-2022.12.07, mutagen-1.45.1, sqlite3-2.6.0, websockets-9.1
[debug] Proxy map: {}
[debug] Loaded 1782 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.02.17, Current version: 2023.02.17
yt-dlp is up to date (2023.02.17)
[youtube] Extracting URL: https://www.youtube.com/watch?v=xspg7SNxTWA
[youtube] xspg7SNxTWA: Downloading webpage
[youtube] xspg7SNxTWA: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[info] xspg7SNxTWA: Downloading 1 format(s): 135
[debug] Invoking http downloader on "https://rr1---sn-4g5edndk.googlevideo.com/videoplayback?expire=1677515027&ei=s4T8Y8GHO5rUx_AP35WQqA4&ip=2a01%3A4f8%3Ac012%3Ab3a8%3A%3A1&id=o-AIxNKYAlgaop4aDLJjX4yRbnMKseszlaJ5r0ZJ0eVKrP&itag=135&source=youtube&requiressl=yes&mh=qW&mm=31%2C26&mn=sn-4g5edndk%2Csn-f5f7lnl7&ms=au%2Conr&mv=m&mvi=1&pl=55&initcwndbps=416250&spc=H3gIhs1kP_ug_Xp9ODDuze4ZxXFwTH4&vprv=1&svpuc=1&mime=video%2Fmp4&gir=yes&clen=36627864&dur=441.120&lmt=1651178714289365&mt=1677493029&fvip=5&keepalive=yes&fexp=24007246&c=ANDROID&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgPozUSci2egLWCG2vrCMVyejJl1j3bXxX1tG1_6tzEg4CIQDeE4-uoYSdwTlh-zYWPXfKFBh5FOVxp1Cr2q75kH34BA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAPUiwVIkp1MlH9CHSuExUXn2Wrd9OYwkVkuAVv7YY-uCAiAtQ8hRWW3eWF9ZzOJ2AG7S-2SXagZRzJZurS-GARquSw%3D%3D"
[download] Resuming download at byte 915795
[download] Destination: At the Cross - Hillsong Worship [xspg7SNxTWA].mp4
[download] 16.4% of 34.93MiB at 161.57KiB/s ETA 03:05
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 45
- Comments: 94 (17 by maintainers)
Commits related to this issue
- [YouTube] Support @owner format in uploader_id etc * implement https://github.com/ytdl-org/youtube-dl/issues/31530#issuecomment-1435734719 * update affected tests * misc clean-ups — committed to ytdl-org/youtube-dl by dirkf a year ago
- n-resp — committed to dirkf/youtube-dl by dirkf a year ago
- Revert yt-dlp manual installation yt-dlp/yt-dlp#6369 was fixed and released upstream. `youtube-dl-exec` always download the latest version, so it is already fixed here. Docker images just need to be... — committed to weltonrodrigo/youtube-to-anchorfm by weltonrodrigo a year ago
- [extractor/youtube] Construct dash formats with `range` query Closes #6369 — committed to HHeroin/yt-dlp by pukkandan a year ago
brief investigation for devs: It looks like using the
&range
param for videoplayback links instead of theRange
header gives full speed for YouTube (i.e. YouTube is throttling our use of theRange
header).very hacky diff for POC:
YouTube’s range doesn’t return a
Content-Range
header which is a pain, nor does it appear you use theRange
header alongside it. (edit: we’ll need to pull this data from the player response)We may need a youtube-specific downloader 🤔
cc @pukkandan
Everyone can reproduce it now and we are investigating. Pls don’t post more "me too"s unless you have some new information to add
Thanks for the fast fix! When may we have a release with this fix?
For anyone who uses the yt-dlp pre-compiled builds (such as myself), here is coletdev’s patch in binary form: https://github.com/gamer191/yt-dlp/releases/tag/2023.02.28.110119
DO NOT USE THESE BUILDS ON ANY WEBSITE OTHER THEN YOUTUBE.COM!!!
I will make release when I am able to, but not immediately. Maintaining this project is something I do in my free time, and not my whole life!
Until then, you have many options, including using Daily builds or PiP installing from master
I’m trying on many VPS, and the problem appears at random. (and I dont see the issue with profile 720p, 360p) Here’s some additional information: I have two VPSs, VPS A with regular download speeds and VPS B with sluggish download speeds. I attempt to download the URL ytdlp created on VPS A to VPS B => Download speed is normal. When I try to download on VPS A, the URL created on VPS B is sluggish.
So I think the issue may be come from URL generation function.
Here’s a link to daily yt-dlp builds of master. I’d highly recommend using them: https://github.com/ytdl-patched/yt-dlp/releases/tag/2023.03.01.19419
Hello admin please solve this issue yt_dlp used to download mp3 audio faster before but today i tried it’s too slow it problem from your side please fix yt_dlp as soon as possible
The method youtube uses is non-standard. So fixing this for external downloaders in general will be hard/impossible. We have an idea[^1] of how to fix this for just aria2c[^2], and is investigating it’s feasibility.
PS: This does mean all third party programs that use
--get-url
and download the file themselves will now need to write their own download logic 😢 - nothing we can do about it…[^1]: Building a list of pseudo (dash) fragments, passing it to
aria2c -i
and merging natively [^2]: but not the other external-downloaders since we don’t have dash support for themReproduced just now for the first time.
Just piling on to add that I’m also seeing this behavior as of today.
Edit: Watching the actual content via browser in HD/UHD is full speed with no slowdown. Something seems to suddenly be actively throttling yt-dlp.
audio of recorded streams (yt-dlp -f 599 https://www.youtube.com/watch?v=yLWXJ22LUEc) is throttled to 7-12 KB/s
I too am having the same problem with a certain video. https://www.youtube.com/watch?v=mrdR43-sqKs
Funnily enough, I can download the actual video in -f 22 just fine without throttling, but if I attempt to download the elemental streams (-f 139, -f 140, and -f 298), it’s throttled to 20-50KiB/s.
Here’s my verbose log from attempting to download the 140 (128kbps M4A) format:
Your log shows you are running the ytdl-patched/yt-dlp fork automated build, which does not have the fix, and editing PIP installs is not recommended. If you did install yt-dlp master with PIP, double-check your PATH, or uninstall all and install only yt-dlp master branch with PIP
Just chiming in to report I’m also having issues… “yt-dlp is up to date (2023.02.17)”
Audio downloading at only 30 KiB/s now.
Edit to add, this is happening with all videos, but here’s a sample…
yt-dlp.exe -f 251 https://youtu.be/LXb3EKWsInQ
This grabs audio… it took over two minutes to download just audio for a five-minute video
Edit 2… I just want to add, I’ve now also observed this happening in “4K Video Downloader”.
The behavior seems to be the same even with VPN and browser cookies.
Does
--extractor-args youtube:player-client=web
help?Edit: No, all clients seem affected
Here’s my build for anyone who can’t build it themselves.
Edit by pukkandan: Download at your own risk
🚨 NOTE: 🚨 If you are still experiencing throttling after installing from master branch, 🚨 SHOW VERBOSE OUTPUT🚨 Run your command with
-vU
added and paste the entire log in your comment. It’s the only way we’ll be able to diagnose and/or fix anything. And please verify that you are actually on masterHello, I also noticed that the download speeds have dropped to like 29.65KiB/s. It was fine till yesterday and I can see everyone here is facing this problem. Its not a code problem or a blocking problem.
I tested a number of cases and it seems like the throttled download rate is proportional to the bitrate of the video. Specifically, it is very close to twice the bitrate, meaning the download time will be about half the duration of the video. In particular, trying to get a faster download by switching formats (other than to 18/22) is generally futile as they all take about the same amount of time to download.
While this works for now, one caveat is, that it is ineffective in combination with the option
--external-downloader aria2c
😦Without
aria2c
:[download] 24.3% of 321.37MiB at 10.54MiB/s ETA 00:23^C
I’ve personally gotten it with format 251, the audio only webm, whereas something like 22 seems to download fine. Both from livestreams and standard vids. They’re probably noticing us requesting only the audio format and throttling the hell out of it. I’d really like my archives to be in opus though and 251 is the only decent opus format I know of, I don’t know of a combined audio/video that uses, say, opus+vp9 in one webm. Working cookies here, applies to all downloads as of today, was hit or miss the last few days. I get on the order of 20 KiB/s or less normally. Using
--throttled-rate 100k
causes it to attempt reextraction, which worked the day before yesterday, but now it doesn’t.I don’t know if I’m wrong but I think that when normal links are sent it downloads fine, but then when they are links https://youtu.be/IE7AykMD3uw | youtube.be has problems extracting… maybe I’m wrong.
Well, at least with
aria2c
it’s a little bit faster. 😀️Normal home connection, reconnection/new leased ip does not change anything.