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

Question: best quality, regardless of merged or not? #21010

Closed
snigel opened this issue May 8, 2019 · 2 comments
Closed

Question: best quality, regardless of merged or not? #21010

snigel opened this issue May 8, 2019 · 2 comments
Labels

Comments

@snigel
Copy link

@snigel snigel commented May 8, 2019

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2019.04.30
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ
youtube-dl --list-formats --verbose 5p8wTOr8AbU
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--list-formats', u'--verbose', u'5p8wTOr8AbU']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.04.30
[debug] Python version 2.7.16 (CPython) - Linux-5.0.0-13-generic-x86_64-with-Ubuntu-19.04-disco
[debug] exe versions: ffmpeg 4.1.3, ffprobe 4.1.3
[debug] Proxy map: {}
[youtube] 5p8wTOr8AbU: Downloading webpage
[youtube] 5p8wTOr8AbU: Downloading video info webpage
[info] Available formats for 5p8wTOr8AbU:
format code  extension  resolution note
249          webm       audio only DASH audio   55k , opus @ 50k, 1.53MiB
250          webm       audio only DASH audio   69k , opus @ 70k, 1.91MiB
171          webm       audio only DASH audio   98k , vorbis@128k, 2.82MiB
140          m4a        audio only DASH audio  127k , m4a_dash container, mp4a.40.2@128k, 3.77MiB
251          webm       audio only DASH audio  130k , opus @160k, 3.60MiB
160          mp4        192x144    144p   53k , avc1.4d400b, 25fps, video only, 1.02MiB
278          webm       192x144    144p   74k , webm container, vp9, 25fps, video only, 2.00MiB
133          mp4        320x240    240p   90k , avc1.4d400d, 25fps, video only, 1.72MiB
242          webm       320x240    240p  129k , vp9, 25fps, video only, 2.88MiB
18           mp4        320x240    small , avc1.42001E, mp4a.40.2@ 96k, 10.04MiB
43           webm       640x360    medium , vp8.0, vorbis@128k, 10.36MiB (best)
youtube-dl -F Menq6J02XCU -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-F', u'Menq6J02XCU', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.04.30
[debug] Python version 2.7.16 (CPython) - Linux-5.0.0-13-generic-x86_64-with-Ubuntu-19.04-disco
[debug] exe versions: ffmpeg 4.1.3, ffprobe 4.1.3
[debug] Proxy map: {}
[youtube] Menq6J02XCU: Downloading webpage
[youtube] Menq6J02XCU: Downloading video info webpage
[info] Available formats for Menq6J02XCU:
format code  extension  resolution note
249          webm       audio only DASH audio   53k , opus @ 50k, 3.21MiB
250          webm       audio only DASH audio   70k , opus @ 70k, 4.25MiB
140          m4a        audio only DASH audio  130k , m4a_dash container, mp4a.40.2@128k, 9.57MiB
251          webm       audio only DASH audio  137k , opus @160k, 8.45MiB
171          webm       audio only DASH audio  140k , vorbis@128k, 8.08MiB
160          mp4        256x144    144p  111k , avc1.4d400c, 30fps, video only, 6.00MiB
278          webm       256x144    144p  138k , webm container, vp9, 30fps, video only, 7.00MiB
242          webm       426x240    240p  224k , vp9, 30fps, video only, 12.99MiB
133          mp4        426x240    240p  310k , avc1.4d4015, 30fps, video only, 11.68MiB
243          webm       640x360    360p  409k , vp9, 30fps, video only, 23.86MiB
134          mp4        640x360    360p  696k , avc1.4d401e, 30fps, video only, 24.52MiB
244          webm       854x480    480p  758k , vp9, 30fps, video only, 40.68MiB
135          mp4        854x480    480p 1128k , avc1.4d401f, 30fps, video only, 43.23MiB
247          webm       1280x720   720p 1547k , vp9, 30fps, video only, 76.60MiB
136          mp4        1280x720   720p 2240k , avc1.4d401f, 30fps, video only, 71.24MiB
248          webm       1920x1080  1080p 2667k , vp9, 30fps, video only, 168.73MiB
137          mp4        1920x1080  1080p 4333k , avc1.640028, 30fps, video only, 208.80MiB
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k, 48.17MiB
43           webm       640x360    medium , vp8.0, vorbis@128k, 58.28MiB
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

Above I have the format output for two different videos. I want to automatically download the best quality for both of them, without manually picking format.

For 5p8wTOr8AbU the best quality is a merged file, 43, 360p
For Menq6J02XCU the best quality is from two separate files, 137+171, 1080p.

Running youtube-dl without any options will download low quality separate files (240p) for 5p8wTOr8AbU but high quality separate files (1080p) for Menq6J02XCU.
Running youtube-dl -f bestvideo+bestaudio will do the same.

Running youtube-dl -f best will download high quality merged files (360p) for 5p8wTOr8AbU but low quality merged files for Menq6J02XCU (720p).

  1. Is there any combination of options that make sure that I get the best quality, regardless of whether the source is merged or not?

  2. If the best audio is in a merged file, but the best video is in a separate file, can that combination be merged for the best result?

For example, in Menq6J02XCU the merged file 22 contains 720p video and 192k mp4a audio.
Running bestvideo+bestaudio will download file 137 for 1080p video and file 171 for 128k vorbis.

Ideally I'd like to merge the 1080p video 137 with the 192k mp4 audio from 22, is that possible?

@snigel snigel added the question label May 8, 2019
@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 8, 2019

  1. No such combination.
  2. Only if you do that manually.
@dstftw dstftw closed this May 8, 2019
@snigel
Copy link
Author

@snigel snigel commented May 8, 2019

I created a script for selecting the highest resolution automatically. It solves my first problem.
Perhaps it can be useful for someone else as well.

#! /bin/bash

youtube-dl -F $1 > $1.txt

if (( $(cat $1.txt | grep ^[0-9] | grep -v best | grep -v audio | tr 'x' ' ' | awk '{print $4}' | sort -n | tail -1) <= \
 $(cat $1.txt | grep ^[0-9] | grep best | tr 'x' ' ' | awk '{print $4}') )); then
    echo -n "-f best $1"
else
    echo -n "-f bestvideo+bestaudio $1"
fi

rm $1.txt

I invoke it like this:
youtube-dl $(./myscript.sh 5p8wTOr8AbU)

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.