spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17.81k stars 1.62k forks source link

Download Bitrate? #52

Closed cgulmatico3 closed 7 years ago

cgulmatico3 commented 7 years ago

Hi!

Just wondering, but how do we enable to highest possible quality downloading output? (eg 320kbps/320000 vs 1411kbps/1411000. Please let me know, as all these MP3's that are outputted wind up being 192kbps in quality.

Thanks,

-Constantine

ritiek commented 7 years ago

I haven't confirmed it myself but searching on the internet says that YouTube downscales any audio better than 192kbps to 192kbps. This is for HD quality (720p or 1080p) videos. It might be even lower for lower quality video uploads..

cyberboysumanjay commented 5 years ago

@ritiek By changing 192K to 320K here, FFmpeg will convert the downloaded audio in 320kb/s Bitrate!
https://github.com/ritiek/spotify-downloader/blob/e2a136d8854d341720fc3365de72d14f2bef9688/spotdl/convert.py#L125

I know the maximum Bitrate that YouTube provides is limited to 192kb/s but is upscaling audio to 320kb/s is a bad idea?

ritiek commented 5 years ago

@cyberboysumanjay No, setting it to 320kbps won't increase the audio quality. It will only result in an increased container size capable of handling 320kbps bitrate. This is similar to saying stretching an image upscales its resolution.

TerminalMan commented 4 years ago

Is it proven that youtube compresses audio to 192kbit/s? I am asking because when using:

youtube-dl --extract-audio --audio-quality 0 --audio-format "mp3" "--extract-audio" 'link-to-youtube-video"

You will end up getting audio files with varying bit-rates, usually somewhere between 200kbit/s and 300kbit/s

mrkumar009 commented 4 years ago

yes, youtube re-encode everything uploaded to particular bitrate and codecs. when youtube used to doesn't encode separate video audio, then highest audio bitrate was 192k aac with a 720p video. now youtube encodes video and audio separately. highest bitrate for aac stream is 128K. youtube also encodes audio in opus-ogg at 160k.(this is highest audio quality you can get from youtube. opus is a new audio codec that provides much better quality at same or even lower bitrate than compared to aac or mp3, you can see some comparison on website I personally prefer to download only 160k opus ogg with spotify metadata. currently I am maintaining a fork this repo offline for ogg thumbnail-metadata support. there's already a PR open for ogg support more than one and half year.

ritiek commented 4 years ago

@TerminalMan Check out this code:

import pafy

v = pafy.new("https://www.youtube.com/watch?v=BlcUfK4deG8")
print(v.audiostreams)

or using youtube-dl:

$ youtube-dl -F "https://www.youtube.com/watch?v=BlcUfK4deG8"

It offers no audiostream with bitrate greater than 160kbps.