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

Introduce compatible-merge operators for format selection (was: Need a bestvideo+bestcompatibleaudio format selector) #10226

Open
ghost opened this issue Aug 4, 2016 · 15 comments
Labels

Comments

@ghost
Copy link

@ghost ghost commented Aug 4, 2016

I have

  • Verified and I assure that I'm running youtube-dl 2016.08.01
  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

The purpose of this 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

Description

This request follows this question.

I need something like -f bestvideo+bestcompatibleaudio, where 'bestcompatibleaudio' is the selector for the best audio file which is compatible with the desired video file (so that the files don't need to be muxed into an mkv.) Or, if you all find this cool, maybe even 'worstcompatibleaudio'

Until it is implemented, anyone who is in dire need of this feature can use this script.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 4, 2016

No, compatible-shortcuts is not a way to do. Compatibility is the characteristic of the merging operation not a particular format. Thus instead of introducing another n shortcuts an alternative compatible-merge-operator should be introduced.

@ghost
Copy link
Author

@ghost ghost commented Aug 4, 2016

Compatibility is the characteristic of the merging operation

I guess you're referring to the compatibility of codecs. Yes, that's not wrong. I already see a TODO here. Maybe a codec-compatible-formats-selection feature would be great to have. And that's essentially what I am referring to. Introducing more operators would only add to confusion. It'd be better instead if the checking is smartly taken care of keeping the user interface unchanged.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 4, 2016

I'm not referring to codecs. codec-compatible-formats-selection will make it impossible to mix standard-merge and compatible-merge in single format selection expression.

@ghost
Copy link
Author

@ghost ghost commented Aug 5, 2016

I'm too lazy to scour the source. Mind sharing a link to the code you're referring to?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 5, 2016

I'm not referring to any code. It's not implemented.

@ghost
Copy link
Author

@ghost ghost commented Aug 5, 2016

Oh, my bad. Anyway, the point is, I am not talking specifically about the implementation of such a format selector. Rather, I am suggesting that we need a feature (maybe a new interface option) that lets us make youtube-dl automatically choose (if possible) the audio and video formats, based on their codecs, such that they are compatible and don't need to be muxed into matroska.

@weedy
Copy link

@weedy weedy commented Aug 5, 2016

You can already "block" mkv. You're just not reading the docs.
From my mplayer config:

ytdl-format=298+bestaudio[ext=m4a]/137+bestaudio[ext=m4a]/bestvideo[ext=mp4][height<?1080]+bestaudio[ext=m4a]/best
@ghost
Copy link
Author

@ghost ghost commented Aug 6, 2016

Wow! Either I am horrible at explaining things or you are not that great at understanding things. I read the docs and I am aware of that "blocking" strategy. My focus is NOT on blocking mkv, rather, it is on ensuring that video and audio files of compatible extensions are downloaded - for example, an m4a DASH video along with an mp4 DASH audio or a WebM DASH video along with a WebM DASH audio, NOT an mp4 DASH video along with a WebM DASH audio along, even if it is the best available audio format (which is usually the case with YouTube videos.) Preventing the muxing of incompatible files into an mkv is just the side effect. Did you at least read the title of the issue before commenting?

This is what I am talking about, in pseudo-code:

bestvideo = getbestvideo()
bve = extension(bestvideo)
bestcompatibleaudio = Nothing
for a in sort_in_descending_order_of_quality(audiofiles):
    if iscompatible(extension(a), bve):
        bestcompatibleaudio = a
        break
selected_formats = (bestvideo, bestcompatibleaudio or getbestaudio())
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 6, 2016

@dstftw Did you mean something like this: bestvideo$bestaudio (forgive me for the naive selection of $)? How to know whether it's the best video with the best compatible one among audio formats, or best audio with the best compatible one among video formats?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 7, 2016

Did you mean something like this: bestvideo$bestaudio

Yes, that's the general idea.

How to know whether it's the best video with the best compatible one among audio formats, or best audio with the best compatible one among video formats?

For instance, by introducing another audio-plus-compatible-video-merge operator.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 7, 2016

Sounds good.

@yan12125 yan12125 added the request label Aug 7, 2016
@yan12125 yan12125 changed the title Need a bestvideo+bestcompatibleaudio format selector Introduce compatible-merge operators for format selection (was: Need a bestvideo+bestcompatibleaudio format selector) Aug 7, 2016
@ghost
Copy link
Author

@ghost ghost commented Aug 8, 2016

@dstftw,

For instance, by introducing another audio-plus-compatible-video-merge operator.

Actually, video-plus-compatible-audio-merge is what I had in mind when I opened this issue, rather than audio-plus-compatible-video-merge. (Or maybe we can have both ways?)
BTW, the introduction of an operator was a smart idea.

@yan12125,
May I suggest the usage of * rather than $?
And thanks for listening and adding the label!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 8, 2016

Obviously we should have both since both scenarios are viable.

@videonerd
Copy link

@videonerd videonerd commented Feb 1, 2017

Any plans to realize this awesome feature directly in the program?

@endquote
Copy link

@endquote endquote commented Feb 20, 2017

Also wishing for this. The merging of incompatible formats into mkv is great, but I'm finding that those files playback incorrectly in Chrome (but work fine in VLC).

Of course this is not ytdl's fault, but still.

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
5 participants
You can’t perform that action at this time.