Skip to content

Commit af6793f

Browse files
committed
[downloader/ffmpeg] Handle unknown formats better
1 parent b695e3f commit af6793f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

yt_dlp/downloader/external.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
cli_valueless_option,
1818
cli_bool_option,
1919
_configuration_args,
20+
determine_ext,
2021
encodeFilename,
2122
encodeArgument,
2223
handle_youtubedl_headers,
2324
check_executable,
2425
Popen,
26+
remove_end,
2527
)
2628

2729

@@ -463,6 +465,15 @@ def _call_downloader(self, tmpfilename, info_dict):
463465
args += ['-f', 'flv']
464466
elif ext == 'mp4' and tmpfilename == '-':
465467
args += ['-f', 'mpegts']
468+
elif ext == 'unknown_video':
469+
ext = determine_ext(remove_end(tmpfilename, '.part'))
470+
if ext == 'unknown_video':
471+
self.report_warning(
472+
'The video format is unknown and cannot be downloaded by ffmpeg. '
473+
'Explicitly set the extension in the filename to attempt download in that format')
474+
else:
475+
self.report_warning(f'The video format is unknown. Trying to download as {ext} according to the filename')
476+
args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
466477
else:
467478
args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
468479

0 commit comments

Comments
 (0)