diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 5b98c7d976..42e9d12a75 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -1149,20 +1149,19 @@ def concat_files(self, in_files, out_file): @PostProcessor._restrict_to(images=False) def run(self, info): - if not info.get('entries') or self._only_multi_video and info['_type'] != 'multi_video': + entries = info.get('entries') or [] + if (self.get_param('skip_download') or not any(entries) + or self._only_multi_video and info['_type'] != 'multi_video'): return [], info - elif None in info['entries']: - raise PostProcessingError('Aborting concatenation because some downloads failed') - elif any(len(entry) > 1 for entry in traverse_obj(info, ('entries', ..., 'requested_downloads')) or []): + elif any(len(entry) > 1 for entry in traverse_obj(entries, (..., 'requested_downloads')) or []): raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats') - in_files = traverse_obj(info, ('entries', ..., 'requested_downloads', 0, 'filepath')) - if not in_files: - self.to_screen('There are no files to concatenate') - return [], info + in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath')) + if len(in_files) < len(entries): + raise PostProcessingError('Aborting concatenation because some downloads failed') ie_copy = self._downloader._playlist_infodict(info) - exts = [traverse_obj(entry, ('requested_downloads', 0, 'ext'), 'ext') for entry in info['entries']] + exts = traverse_obj(entries, (..., 'requested_downloads', 0, 'ext'), (..., 'ext')) ie_copy['ext'] = exts[0] if len(set(exts)) == 1 else 'mkv' out_file = self._downloader.prepare_filename(ie_copy, 'pl_video')