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

Option to --prefer-new-formats #15427

Closed
pickae opened this issue Jan 25, 2018 · 1 comment
Closed

Option to --prefer-new-formats #15427

pickae opened this issue Jan 25, 2018 · 1 comment

Comments

@pickae
Copy link

@pickae pickae commented Jan 25, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.01.21. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.01.21

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue

My examples will be from youtube, but this option should be applicable everywhere. Consider a video that has been encoded in different resolutions and in different codecs:

 youtube-dl -v -F https://www.youtube.com/watch?v=uGSfliYZO-Q
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'https://www.youtube.com/watch?v=uGSfliYZO-Q']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.01.21
[debug] Python version 2.7.14 (CPython) - Linux-4.13.0-12-generic-x86_64-with-Ubuntu-17.10-artful
[debug] exe versions: ffmpeg 3.3.4-2, ffprobe 3.3.4-2
[debug] Proxy map: {}
[youtube] uGSfliYZO-Q: Downloading webpage
[youtube] uGSfliYZO-Q: Downloading video info webpage
[youtube] uGSfliYZO-Q: Extracting video information
[info] Available formats for uGSfliYZO-Q:
format code  extension  resolution note
249          webm       audio only DASH audio   51k , opus @ 50k, 2.49MiB
250          webm       audio only DASH audio   66k , opus @ 70k, 3.16MiB
171          webm       audio only DASH audio  117k , vorbis@128k, 5.79MiB
251          webm       audio only DASH audio  128k , opus @160k, 6.03MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, mp4a.40.2@128k, 6.81MiB
278          webm       256x144    144p  101k , webm container, vp9, 30fps, video only, 4.96MiB
160          mp4        256x144    144p  111k , avc1.4d400c, 30fps, video only, 3.31MiB
133          mp4        426x240    240p  216k , avc1.4d4015, 30fps, video only, 7.27MiB
242          webm       426x240    240p  223k , vp9, 30fps, video only, 8.40MiB
243          webm       640x360    360p  415k , vp9, 30fps, video only, 18.07MiB
134          mp4        640x360    360p  464k , avc1.4d401e, 30fps, video only, 15.63MiB
244          webm       854x480    480p  756k , vp9, 30fps, video only, 31.90MiB
135          mp4        854x480    480p  944k , avc1.4d401f, 30fps, video only, 31.11MiB
247          webm       1280x720   720p 1498k , vp9, 30fps, video only, 48.73MiB
136          mp4        1280x720   720p 1951k , avc1.4d401f, 30fps, video only, 50.94MiB
248          webm       1920x1080  1080p 2646k , vp9, 30fps, video only, 77.47MiB
137          mp4        1920x1080  1080p 2991k , avc1.640028, 30fps, video only, 80.66MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

Now these versions contain video files with old generation codecs like avc1 or vp8 and new generation codecs like vp9 in the case of youtube (other sites might provide hevc). There are also audio files in old generation codecs like vorbis and m4a and the new opus codec generation.

I would want the following behaviour:

  • download a video file of a new generation codec if available (at the highest resolution among the files of that codec)
  • fallback to the highest resolution of old generation codecs if necessary
  • do the same for audio generation codecs and bitrates
  • mux if necessary

The default options don't do that because the avc1 files will typically be 5-10% larger than the vp9 files. The assumption right now is that more bitrate equals more quality. But that's not the case across codec generations. A vp9 file with 90% of the bitrate of an avc1 file will be slightly smaller AND of much better quality. The same is true for opus compared to vorbis for example.

As the new codec generations happen to be free formats, I thought --prefer-free-formats would do the trick. But it doesn't prefer free formats unless they also have the highest bitrate. As this free-format debate is quite contentious as it is, I don't want to hijack it but find another solution:

-f bestvideo[ext=webm]+bestaudio[ext=webm]/best 

solves the problem in most cases on youtube. But wouldn't it be much more convenient if youtube-dl would recognize that some codecs perform better than others at equal bitrates and could conveniently select codecs from the newest generation. As it is, the user has to find out manually which site provides which codecs and then select them via the proxy of the container format if possible.

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.