Skip to content

Commit

Permalink
Fix -f mp4 behaving differently from youtube-dl
Browse files Browse the repository at this point in the history
  • Loading branch information
pukkandan committed Oct 3, 2021
1 parent 5d535b4 commit b11c04a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions yt_dlp/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1944,9 +1944,14 @@ def selector_function(ctx):
filter_f = lambda f: _filter_f(f) and (
f.get('vcodec') != 'none' or f.get('acodec') != 'none')
else:
filter_f = ((lambda f: f.get('ext') == format_spec)
if format_spec in ['mp4', 'flv', 'webm', '3gp', 'm4a', 'mp3', 'ogg', 'aac', 'wav'] # extension
else (lambda f: f.get('format_id') == format_spec)) # id
if format_spec in ('m4a', 'mp3', 'ogg', 'aac'): # audio extension
filter_f = lambda f: f.get('ext') == format_spec and f.get('acodec') != 'none'
elif format_spec in ('mp4', 'flv', 'webm', '3gp'): # video extension
filter_f = lambda f: f.get('ext') == format_spec and f.get('acodec') != 'none' and f.get('vcodec') != 'none'
elif format_spec in ('mhtml', ): # storyboards extension
filter_f = lambda f: f.get('ext') == format_spec and f.get('acodec') == 'none' and f.get('vcodec') == 'none'
else:
filter_f = (lambda f: f.get('format_id') == format_spec) # id

def selector_function(ctx):
formats = list(ctx['formats'])
Expand Down

0 comments on commit b11c04a

Please sign in to comment.