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

downloading low quality from youtube? something changed in API? #6847

Closed
gaming-hacker opened this issue Sep 12, 2015 · 11 comments
Closed

downloading low quality from youtube? something changed in API? #6847

gaming-hacker opened this issue Sep 12, 2015 · 11 comments

Comments

@gaming-hacker
Copy link

@gaming-hacker gaming-hacker commented Sep 12, 2015

i use this to download from youtube and extract audio

ywta="youtube-dl --buffer-size 16k --restrict-filenames --continue --audio-format=best --no-part --extract-audio --output=%(title)s.%(ext)s"

program downloads crappy webm and outputs opus as audio file, which is a low bitrate and crap, when 1080P is available.

ywta https://www.youtube.com/watch?v=LIPc1cfS-oQ

results
[download] Destination: Rammstein_-Ohne_Dich_Official_Video.webm
[download] 100% of 5.25MiB in 00:45
[ffmpeg] Destination: Rammstein
-_Ohne_Dich_Official_Video.opus

youtube-dl https://www.youtube.com/watch?v=LIPc1cfS-oQ
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: Rammstein - Ohne Dich (Official Video)-LIPc1cfS-oQ.f137.mp4

this is the high quality

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 12, 2015

Post the full output of youtube-dl when run with --verbose option.

@gaming-hacker
Copy link
Author

@gaming-hacker gaming-hacker commented Sep 12, 2015

ywta="youtube-dl --buffer-size 16k --restrict-filenames --continue --audio-format=best --no-part --extract-audio --verbose --output=%(title)s.%(ext)s"

ywta https://www.youtube.com/watch?v=LIPc1cfS-oQ
downloading https://www.youtube.com/watch?v=LIPc1cfS-oQ
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--buffer-size', u'16k', u'--restrict-filenames', u'--continue', u'--audio-format=best', u'--no-part', u'--extract-audio', u'--verbose', u'--output=%(title)s.%(ext)s', u'https://www.youtube.com/watch?v=LIPc1cfS-oQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.09.09
[debug] Python version 2.7.10 - Darwin-14.5.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 2.7.2, ffprobe 2.7.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] LIPc1cfS-oQ: Downloading webpage
[youtube] LIPc1cfS-oQ: Downloading video info webpage
[youtube] LIPc1cfS-oQ: Extracting video information
[youtube] LIPc1cfS-oQ: Downloading DASH manifest
[youtube] LIPc1cfS-oQ: Downloading DASH manifest
[debug] Invoking downloader on u'https://r13---sn-vgqs7n7e.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&ipbits=0&requiressl=yes&keepalive=yes&nh=IgpwZjAxLm9yZDM1Kgw3Mi4xNC4yMDUuNjE&mn=sn-vgqs7n7e&mm=31&dur=341.221&id=o-AHpUQ7uRfCQIyEvE9Zb3A6b90s5H3KkhnOCwNNaJrTWf&lmt=1438420212727630&key=yt5&ip=64.72.39.43&fexp=9408710%2C9409069%2C9412773%2C9412839%2C9413311%2C9415365%2C9415485%2C9416023%2C9416126%2C9417368%2C9417707%2C9418007%2C9418153%2C9418448%2C9418455%2C9418703%2C9419445%2C9420152%2C9420348%2C9420795&mv=m&source=youtube&ms=au&pl=24&mt=1442099148&sver=3&clen=5507551&itag=251&gir=yes&upn=uVcIt1kwhT0&signature=22317ACD79D0E28FD01C776217B4D4D010983ED4.975005384A3DCFB973D70C1C1F62F4C860B43AD6&mime=audio%2Fwebm&initcwndbps=660000&expire=1442120840&ratebypass=yes'
[download] Destination: Rammstein_-_Ohne_Dich_Official_Video.webm

@gaming-hacker
Copy link
Author

@gaming-hacker gaming-hacker commented Sep 12, 2015

final file is
Rammstein_-_Ohne_Dich_Official_Video.opus

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 12, 2015

bestaudio according to bitrate provided by YouTube in metadata is format code 251 that is downloaded and extracted as opus. So that's just as expected.

@dstftw dstftw closed this Sep 12, 2015
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 12, 2015

If you don't want webm then don't download it at all: -f bestaudio[ext!=webm].

@gaming-hacker
Copy link
Author

@gaming-hacker gaming-hacker commented Sep 12, 2015

that opus file is low bitrate, so perhaps youtube is intentionally mislabeling audio

when downloading with youtube-dl at default settings, the correct audio is downloaded so something in the script is wrong, although is used to work fine.

@gaming-hacker
Copy link
Author

@gaming-hacker gaming-hacker commented Sep 12, 2015

where is this documented? -f bestaudio[ext!=webm]

this doesn't work?
--audio-format=best[ext!=webm]

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 12, 2015

bitrate is not a robust measure of quality.

@gaming-hacker
Copy link
Author

@gaming-hacker gaming-hacker commented Sep 12, 2015

cool, thanks.

@ghost
Copy link

@ghost ghost commented Apr 29, 2018

This might not be relevant anymore but I had the same problem and I fixed it. It seems that if youtube-dl can't find audio stream with your specified format it uses ffmpeg to encode to your desired format. I don't know if this is the same for other formats as well but default quality settings seem to encode opus files with around 6-7 kbps. Imagine how bad the quality is... You fix it by adding --audio-quality 0 (Best Quality) right after you specify what format audio you want to get.

This will download song in bad quality:

youtube-dl DLzxrzFCyOs -x --audio-format opus

This will download song in good quality:

youtube-dl DLzxrzFCyOs -x --audio-format opus --audio-quality 0

See for yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.