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

'NOT' Operator (!) causes conflict with equality syntax such as !^= and !*=, must escape #24383

Closed
WoodpeckerBaby opened this issue Mar 17, 2020 · 1 comment
Labels

Comments

@WoodpeckerBaby
Copy link

@WoodpeckerBaby WoodpeckerBaby commented Mar 17, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.03.08
  • 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

Verbose log

bash-5.0$ ls -a
.	..
bash-5.0$ youtube-dl -F https://www.youtube.com/watch?v=1La4QzGeaaQ
[youtube] 1La4QzGeaaQ: Downloading webpage
[youtube] 1La4QzGeaaQ: Marking watched
[info] Available formats for 1La4QzGeaaQ:
format code  extension  resolution note
249          webm       audio only tiny   58k , opus @ 50k (48000Hz), 2.01MiB
250          webm       audio only tiny   78k , opus @ 70k (48000Hz), 2.68MiB
140          m4a        audio only tiny  130k , m4a_dash container, mp4a.40.2@128k (44100Hz), 5.21MiB
251          webm       audio only tiny  150k , opus @160k (48000Hz), 5.29MiB
394          mp4        256x144    144p   83k , av01.0.00M.10.0.110.09.16.09.0, 30fps, video only, 2.77MiB
278          webm       256x144    144p   98k , webm container, vp9, 30fps, video only, 3.65MiB
160          mp4        256x144    144p  111k , avc1.4d400c, 30fps, video only, 2.67MiB
395          mp4        426x240    240p  191k , av01.0.00M.10.0.110.09.16.09.0, 30fps, video only, 5.68MiB
242          webm       426x240    240p  228k , vp9, 30fps, video only, 7.59MiB
133          mp4        426x240    240p  245k , avc1.4d4015, 30fps, video only, 5.69MiB
330          webm       256x144    144p60 HDR  245k , vp9.2, 60fps, video only, 8.72MiB
396          mp4        640x360    360p  347k , av01.0.01M.10.0.110.09.16.09.0, 30fps, video only, 10.59MiB
243          webm       640x360    360p  422k , vp9, 30fps, video only, 14.19MiB
331          webm       426x240    240p60 HDR  517k , vp9.2, 60fps, video only, 18.91MiB
134          mp4        640x360    360p  633k , avc1.4d401e, 30fps, video only, 17.17MiB
397          mp4        854x480    480p  651k , av01.0.04M.10.0.110.09.16.09.0, 30fps, video only, 20.00MiB
244          webm       854x480    480p  785k , vp9, 30fps, video only, 26.42MiB
332          webm       640x360    360p60 HDR 1064k , vp9.2, 60fps, video only, 40.80MiB
398          mp4        1280x720   720p60 1295k , av01.0.08M.10.0.110.09.16.09.0, 60fps, video only, 41.41MiB
135          mp4        854x480    480p 1351k , avc1.4d401f, 30fps, video only, 35.59MiB
247          webm       1280x720   720p 1588k , vp9, 30fps, video only, 53.74MiB
333          webm       854x480    480p60 HDR 1988k , vp9.2, 60fps, video only, 77.26MiB
399          mp4        1920x1080  1080p60 2237k , av01.0.09M.10.0.110.09.16.09.0, 60fps, video only, 74.32MiB
302          webm       1280x720   720p60 2667k , vp9, 60fps, video only, 89.04MiB
136          mp4        1280x720   720p 2698k , avc1.4d401f, 30fps, video only, 70.39MiB
248          webm       1920x1080  1080p 2772k , vp9, 30fps, video only, 94.90MiB
298          mp4        1280x720   720p60 4201k , avc1.4d4020, 60fps, video only, 115.83MiB
303          webm       1920x1080  1080p60 4486k , vp9, 60fps, video only, 154.48MiB
334          webm       1280x720   720p60 HDR 4529k , vp9.2, 60fps, video only, 176.99MiB
137          mp4        1920x1080  1080p 5065k , avc1.640028, 30fps, video only, 130.39MiB
335          webm       1920x1080  1080p60 HDR 6923k , vp9.2, 60fps, video only, 271.72MiB
299          mp4        1920x1080  1080p60 7007k , avc1.64002a, 60fps, video only, 204.42MiB
400          mp4        2560x1440  1440p60 7651k , av01.0.12M.10.0.110.09.16.09.0, 60fps, video only, 249.32MiB
271          webm       2560x1440  1440p 8977k , vp9, 30fps, video only, 297.43MiB
308          webm       2560x1440  1440p60 13368k , vp9, 60fps, video only, 448.85MiB
401          mp4        3840x2160  2160p60 15790k , av01.0.13M.10.0.110.09.16.09.0, 60fps, video only, 501.33MiB
336          webm       2560x1440  1440p60 HDR 16746k , vp9.2, 60fps, video only, 651.85MiB
313          webm       3840x2160  2160p 17965k , vp9, 30fps, video only, 644.01MiB
402          mp4        7680x4320  4320p60 23104k , av01.0.17M.10.0.110.09.16.09.0, 60fps, video only, 599.29MiB
315          webm       3840x2160  2160p60 26684k , vp9, 60fps, video only, 988.10MiB
337          webm       3840x2160  2160p60 HDR 30553k , vp9.2, 60fps, video only, 1.13GiB
272          webm       7680x4320  4320p60 31980k , vp9, 60fps, video only, 830.57MiB
571          mp4        7680x4320  4320p60 34531k , av01.0.17M.10.0.110.09.16.09.0, 60fps, video only, 918.43MiB
18           mp4        640x360    360p  667k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 26.87MiB
22           mp4        1280x720   720p 1877k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec!^=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
youtube-dl -v --get-format -f bestvideo[vcodec-F=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec-F=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: Invalid filter specification u'vcodec-F=av01'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1605, in process_video_result
    format_selector = self.build_format_selector(req_format)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1387, in build_format_selector
    return _build_selector_function(parsed_selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1234, in _build_selector_function
    fs = [_build_selector_function(s) for s in selector]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1344, in _build_selector_function
    video_selector, audio_selector = map(_build_selector_function, selector.selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1351, in _build_selector_function
    filters = [self._build_format_filter(f) for f in selector.filters]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1091, in _build_format_filter
    raise ValueError('Invalid filter specification %r' % filter_spec)
ValueError: Invalid filter specification u'vcodec-F=av01'

bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec!*=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
youtube-dl -v --get-format -f bestvideo[vcodec-v --get-format -f bestvideo[vcodec-F=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec-v', u'--get-format', u'-f', u'bestvideo[vcodec-F=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: Invalid filter specification u'vcodec-F=av01'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1605, in process_video_result
    format_selector = self.build_format_selector(req_format)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1387, in build_format_selector
    return _build_selector_function(parsed_selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1234, in _build_selector_function
    fs = [_build_selector_function(s) for s in selector]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1344, in _build_selector_function
    video_selector, audio_selector = map(_build_selector_function, selector.selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1351, in _build_selector_function
    filters = [self._build_format_filter(f) for f in selector.filters]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1091, in _build_format_filter
    raise ValueError('Invalid filter specification %r' % filter_spec)
ValueError: Invalid filter specification u'vcodec-F=av01'

ERROR: Invalid filter specification u'vcodec-F=av01'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1605, in process_video_result
    format_selector = self.build_format_selector(req_format)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1387, in build_format_selector
    return _build_selector_function(parsed_selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1234, in _build_selector_function
    fs = [_build_selector_function(s) for s in selector]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1344, in _build_selector_function
    video_selector, audio_selector = map(_build_selector_function, selector.selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1351, in _build_selector_function
    filters = [self._build_format_filter(f) for f in selector.filters]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1091, in _build_format_filter
    raise ValueError('Invalid filter specification %r' % filter_spec)
ValueError: Invalid filter specification u'vcodec-F=av01'

bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec*=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec*=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
571 - 7680x4320 (4320p60)+251 - audio only (tiny)
bash-5.0$ ## --- ^ this one seems right
bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: requested format not available
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1636, in process_video_result
    expected=True)
ExtractorError: requested format not available

bash-5.0$ ## --- ^ this one is also right, expected output
bash-5.0$ youtube-dl -v --get-format -f bestvideo[!vcodec^=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[!vcodec^=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
571 - 7680x4320 (4320p60)+251 - audio only (tiny)
bash-5.0$ youtube-dl -v --get-format -f bestvideo[!(vcodec^=av01)]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
bash: syntax error near unexpected token `('
bash-5.0$ youtube-dl -v --get-format -f bestvideo[![vcodec^=av01]]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[![vcodec^=av01]]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: requested format not available
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1636, in process_video_result
    expected=True)
ExtractorError: requested format not available

bash-5.0$ youtube-dl -v --get-format -f bestvideo[![vcodec*=av01]]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[![vcodec*=av01]]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: requested format not available
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1636, in process_video_result
    expected=True)
ExtractorError: requested format not available

bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec^!=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec^!=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: Invalid filter specification u'vcodec^!=av01'
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1605, in process_video_result
    format_selector = self.build_format_selector(req_format)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1387, in build_format_selector
    return _build_selector_function(parsed_selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1234, in _build_selector_function
    fs = [_build_selector_function(s) for s in selector]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1344, in _build_selector_function
    video_selector, audio_selector = map(_build_selector_function, selector.selector)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1351, in _build_selector_function
    filters = [self._build_format_filter(f) for f in selector.filters]
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1091, in _build_format_filter
    raise ValueError('Invalid filter specification %r' % filter_spec)
ValueError: Invalid filter specification u'vcodec^!=av01'

bash-5.0$ youtube-dl -v --get-format -f bestvideo[vcodec\!^=av01]+bestaudio --merge-output-format mp4/mkv https://www.youtube.com/watch?v=1La4QzGeaaQ
[debug] System config: []
[debug] User config: [u'--cookies', u'/Users/redacted/movies/.youtube-dl_auth_cookies.txt', u'--mark-watched', u'--external-downloader', u'aria2c', u'--ffmpeg-location', u'/usr/local/bin/ffmpeg', u'--add-metadata', u'--embed-thumbnail', u'--xattrs', u'--prefer-ffmpeg', u'--embed-subs', u'--audio-quality', u'0', u'--console-title', u'--ignore-errors', u'--retries', u'infinite', u'--fragment-retries', u'25', u'--skip-unavailable-fragments']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--get-format', u'-f', u'bestvideo[vcodec!^=av01]+bestaudio', u'--merge-output-format', u'mp4/mkv', u'https://www.youtube.com/watch?v=1La4QzGeaaQ']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.03.08
[debug] Python version 2.7.16 (CPython) - Darwin-19.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
272 - 7680x4320 (4320p60)+251 - audio only (tiny)
bash-5.0$ ### --- ^  success 

Description

I have used a series of examples to demonstrates the bug. Before you start following, it is useful to know that my goal was to universally extract the best audio and video format that is not AV1, because it is difficult for playback and not a good source for transcoding (to HEVC for example).

So, I would need -f bestvideo[vcodec!^=AV01.]+bestaudio

Play attention to what I typed in bash, and what the program recognized in debug feedback. It changes the input in a way that is unexpected. (this is the same if I exit BASH and run directly as macOS Terminal command. There is no special bash profiles)

My bash version is below.

bash-5.0$ which bash
/usr/local/bin/bash
bash-5.0$ bash -version
GNU bash, version 5.0.16(1)-release (x86_64-apple-darwin19.3.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Read the FORMAT SELECTION section in the manual via man youtube-dl, then scroll down to find this block for reference or search by typing /By default and hit enter

filtering work for comparisons = (equals), ^= (starts with), $= (ends with), *= (contains) and following string meta fields:

       o ext: File extension

       o acodec: Name of the audio codec in use

       o vcodec: Name of the video codec in use

       o container: Name of the container format

       o protocol: The protocol that will be used for the actual download, lower-case (http, https, rtsp, rtmp, rtmpe, mms, f4m, ism, http_dash_segments, m3u8, or m3u8_native)

       o format_id: A short description of the format

       Any string comparison may be prefixed with negation ! in order to produce an opposite comparison, e.g.  !*= (does not contain).

Note that using brackets [], () , or placing the ! elsewhere did not solve the issue. The only way to do that is by escaping with a backslash \!^=, which can be seen in the demo log above.

Since this is a part of the syntax, it really doesn't make sense for it to behave this way. This is not in the manual and I just stumbled on this workaround.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 17, 2020

This has nothing to do with youtube-dl. Escaping special characters of your shell is your responsibility.

@dstftw dstftw closed this Mar 17, 2020
@dstftw dstftw added the invalid label Mar 17, 2020
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.