fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.47k stars 790 forks source link

best quality audio #20

Closed benkaiser closed 9 years ago

benkaiser commented 9 years ago

I am currently writing a music player written in nodejs that can pull down tracks from youtube. I use ytdl-core to fetch the highest quality video, however in a lot of cases the highest audio quality doesn't need the highest video resolution and as such a lot of data is wasted downloading the higher resolution video.

Could a highestaudio quality option be implemented like in another youtube downloading library pafy?

fent commented 9 years ago

Yeah a highestaudio and highestvideo options could be added.

In the mean time you can use the filter option to filter out formats that include video, something like

ytdl(url, { filter: function(format) { return format.resolution === null; } })
andrewrk commented 9 years ago

Here's how Groove Basin does it: https://github.com/andrewrk/groovebasin/blob/master/lib/import_url_filters.js#L29

BTW your project looks very similar to Groove Basin.

benkaiser commented 9 years ago

@fent thanks, seems to work fine for now. Is there always an audio only stream? And what happens if there isn't? is there a fallback?

@andrewrk yeah it does. I guess I just wanted to tackle the UI differently to how groove basin does, and it's been fun learning along the way making my own music player.

andrewrk commented 9 years ago

I guess I just wanted to tackle the UI differently to how groove basin does, and it's been fun learning along the way making my own music player.

Totally :-)

Your UI looks good.

fent commented 9 years ago

I don't know if there's always an audio stream.

And I think this is still a good idea, if there isn't an audio stream, it should fallback to video right?

benkaiser commented 9 years ago

I guess I'll see if I run into issues overtime. Feel free to test out my music player ;)