Repository: yt-dlp/yt-dlp
File: yt_dlp/YoutubeDL.py (Python)

Code before:
                self.to_screen('[info] Unable to download format %s. Skipping...' % f['format_id'])

    def _select_formats(self, formats, selector):
        return list(selector({
            'formats': formats,
            'has_merged_format': any('none' not in (f.get('acodec'), f.get('vcodec')) for f in formats),
            'incomplete_formats': (all(f.get('vcodec') == 'none' for f in formats)  # No formats with video
                                   or all(f.get('acodec') == 'none' for f in formats)),  # OR, No formats with audio
        }))

    def _default_format_spec(self, info_dict, download=True):

        def can_merge():
            merger = FFmpegMergerPP(self)
            return merger.available and merger.can_merge()

        def evaluate_formats(format_spec):
            formats = self._get_formats(info_dict)
            return self._select_formats(formats, self.build_format_selector(format_spec))
        if not can_merge() and evaluate_formats('best/bestvideo+bestaudio') != evaluate_formats('bestvideo*+bestaudio/best'):
            self.report_warning('ffmpeg not found. The downloaded format is not the highest available quality. '
                                'Installing ffmpeg is strongly recommended: https://github.com/yt-dlp/yt-dlp#dependencies')

        prefer_best = (
            not self.params.get('simulate')
            and download
            and (
                not can_merge()
                or info_dict.get('is_live') and not self.params.get('live_from_start')
                or self.params['outtmpl']['default'] == '-'))
        compat = (
            prefer_best
            or self.params.get('allow_multiple_audio_streams', False)
            or 'format-spec' in self.params['compat_opts'])

        return (
            'best/bestvideo+bestaudio' if prefer_best
            else 'bestvideo*+bestaudio/best' if not compat
            else 'bestvideo+bestaudio/best')

    def build_format_selector(self, format_spec):
        def syntax_error(note, start):
            message = (
                'Invalid format specification: '
                '{}\n\t{}\n\t{}^'.format(note, format_spec, ' ' * start[1]))
            return SyntaxError(message)

        PICKFIRST = 'PICKFIRST'
        MERGE = 'MERGE'
        SINGLE = 'SINGLE'
        GROUP = 'GROUP'

Review comment (bug):
This could trigger an unnecessary and misleading warning if the user is passing `-o -` and doesn't have ffmpeg installed. Since the default format selection becomes `best/bestvideo+bestaudio` when piping to stdout, the warning would be incorrect: installing ffmpeg will not change the quality of what's piped. And I think it's fair to assume that a user who is piping to stdout knows what they're doing and does not need any warning here.

Maybe we could do this?
```py
	to_stdout = self.params['outtmpl']['default'] == '-'

        def evaluate_formats(format_spec):
            formats = self._get_formats(info_dict)
            return self._select_formats(formats, self.build_format_selector(format_spec))
        if not can_merge() and not to_stdout and evaluate_formats('b/bv+ba') != evaluate_formats('bv*+ba/b'):
            self.report_warning('ffmpeg not found. The downloaded format is not the highest available quality. '
                                'Installing ffmpeg is strongly recommended: https://github.com/yt-dlp/yt-dlp#dependencies')

        prefer_best = (
            not self.params.get('simulate')
            and download
            and (
                not can_merge()
                or info_dict.get('is_live') and not self.params.get('live_from_start')
                or to_stdout)))
```

Code after:
            if success:
                yield f
            else:
                self.to_screen('[info] Unable to download format %s. Skipping...' % f['format_id'])

    def _select_formats(self, formats, selector):
        return list(selector({
            'formats': formats,
            'has_merged_format': any('none' not in (f.get('acodec'), f.get('vcodec')) for f in formats),
            'incomplete_formats': (all(f.get('vcodec') == 'none' for f in formats)  # No formats with video
                                   or all(f.get('acodec') == 'none' for f in formats)),  # OR, No formats with audio
        }))

    def _default_format_spec(self, info_dict, download=True):
        download = download and not self.params.get('simulate')
        prefer_best = download and (
            self.params['outtmpl']['default'] == '-'
            or info_dict.get('is_live') and not self.params.get('live_from_start'))

        def can_merge():
            merger = FFmpegMergerPP(self)
            return merger.available and merger.can_merge()

        if not prefer_best and download and not can_merge():
            prefer_best = True
            formats = self._get_formats(info_dict)
            evaluate_formats = lambda spec: self._select_formats(formats, self.build_format_selector(spec))
            if evaluate_formats('b/bv+ba') != evaluate_formats('bv*+ba/b'):
                self.report_warning('ffmpeg not found. The downloaded format may not be the best available. '
                                    'Installing ffmpeg is strongly recommended: https://github.com/yt-dlp/yt-dlp#dependencies')

        compat = (self.params.get('allow_multiple_audio_streams')
                  or 'format-spec' in self.params['compat_opts'])

        return ('best/bestvideo+bestaudio' if prefer_best
                else 'bestvideo+bestaudio/best' if compat
                else 'bestvideo*+bestaudio/best')

    def build_format_selector(self, format_spec):
        def syntax_error(note, start):
            message = (
                'Invalid format specification: '
                '{}\n\t{}\n\t{}^'.format(note, format_spec, ' ' * start[1]))
            return SyntaxError(message)

        PICKFIRST = 'PICKFIRST'
        MERGE = 'MERGE'
        SINGLE = 'SINGLE'
        GROUP = 'GROUP'
        FormatSelector = collections.namedtuple('FormatSelector', ['type', 'selector', 'filters'])