Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download progress slows down with filter of audioonly #490

Closed
its-me-ilia opened this issue Sep 22, 2019 · 11 comments · Fixed by #664
Closed

download progress slows down with filter of audioonly #490

its-me-ilia opened this issue Sep 22, 2019 · 11 comments · Fixed by #664

Comments

@its-me-ilia
Copy link

I am converting youtube video to mp3 and then letting user download it but if

 ytdl(url,{
      filter: 'audioonly'
  })
  .pipe(res)

there is audioonly filter it downloading progress slows down. for example it video is length of 4:15, mp4 downloads size of 3x MB in five-six seconds and if it is audioonly size of 5MB, it takes 10-15sec or more. how can i fix this? here is full code:

ytdl.getInfo(url, (err,info)=>{
       res.header('Content-Disposition', 'attachment; filename="'+ transliterate(info.title) 
 +'.mp3"');
       ytdl(url,{
          filter: 'audioonly'
       })
       .pipe(res)
})
@RocoGreen
Copy link

RocoGreen commented Sep 22, 2019

Use quality instead

  ytdl.getInfo(url, (err,info)=>{
   res.header('Content-Disposition', 'attachment; filename="'+ transliterate(info.title) 
   +'.mp3"');
   ytdl(url,{
      quality: 'highestaudio'
   })
   .pipe(res)
   })

@its-me-ilia
Copy link
Author

@RocoGreen it still slows down progress

@RocoGreen
Copy link

@its-me-ilia Did you try a connexion test ?
And what is the video your trying to download ?

@its-me-ilia
Copy link
Author

its-me-ilia commented Sep 22, 2019

@RocoGreen
Copy link

@its-me-ilia Try with https://www.youtube.com/watch?v=SDTZ7iX4vTQ&list=RDSDTZ7iX4vTQ
Did you try a connection test ?

@its-me-ilia
Copy link
Author

@RocoGreen It still does the same with link you provided, no need for connection test because it works same way in other devices

@fent
Copy link
Owner

fent commented Sep 22, 2019

rate limiting is done by youtube

@fent fent closed this as completed Sep 22, 2019
@omarroth
Copy link

See @fent's comment in #294. Also related: pytube/pytube#247 and the linked issue ytdl-org/youtube-dl#15271.

It should be possible to bypass rate-limiting by downloading in chunks of <~10MB.

@fent
Copy link
Owner

fent commented Sep 22, 2019

It should be possible to bypass rate-limiting by downloading in chunks of <~10MB.

is this true? I may be able to split it up within ytdl-core

@omarroth
Copy link

omarroth commented Sep 22, 2019

There's some more details in the linked issues, but in most cases I have found that chunking helps with download speeds.

The relevant code in youtube-dl is here, or here for Invidious.

@its-me-ilia
Copy link
Author

@omarroth can you show me the snippet how can i donwload in chunks?

fent pushed a commit that referenced this issue Jul 25, 2020
)

* Fixed slow speed when downloading Dash format from YouTube

* Optimizations to chunked video download

* Fixed progress when using `range` with a chuncked download, handled `error` event of `heads` request, corrected the calculation of `end` when using `range`

* Optimized code, Added tests for the new code, Added new tests to cover some uncovered statements 🚀

* Fix typo

* LET'S GET THIS MERGED 🚀🚀

* More refactoring, Moved `dlChunkSize` under `highWaterMark` in `README`, Added another test and fixed a couple

* This took so long 😭

Fixes #660
Fixes #490
Fixes #294
Fixes #327
Fixes #473
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants