diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-01-24 01:15:44 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-01-24 01:15:54 +0530 |
commit | af6793f804140ddedb62227155aa457f16d1cd93 (patch) | |
tree | 7e35735ee33b4d3bdc2b164ef2aaa09e10b8b86b | |
parent | b695e3f9bdad79b118010592a78abf628a566bfd (diff) | |
download | hypervideo-pre-af6793f804140ddedb62227155aa457f16d1cd93.tar.lz hypervideo-pre-af6793f804140ddedb62227155aa457f16d1cd93.tar.xz hypervideo-pre-af6793f804140ddedb62227155aa457f16d1cd93.zip |
[downloader/ffmpeg] Handle unknown formats better
-rw-r--r-- | yt_dlp/downloader/external.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py index 15ac72464..f4fdcf120 100644 --- a/yt_dlp/downloader/external.py +++ b/yt_dlp/downloader/external.py @@ -17,11 +17,13 @@ from ..utils import ( cli_valueless_option, cli_bool_option, _configuration_args, + determine_ext, encodeFilename, encodeArgument, handle_youtubedl_headers, check_executable, Popen, + remove_end, ) @@ -463,6 +465,15 @@ class FFmpegFD(ExternalFD): args += ['-f', 'flv'] elif ext == 'mp4' and tmpfilename == '-': args += ['-f', 'mpegts'] + elif ext == 'unknown_video': + ext = determine_ext(remove_end(tmpfilename, '.part')) + if ext == 'unknown_video': + self.report_warning( + 'The video format is unknown and cannot be downloaded by ffmpeg. ' + 'Explicitly set the extension in the filename to attempt download in that format') + else: + self.report_warning(f'The video format is unknown. Trying to download as {ext} according to the filename') + args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)] else: args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)] |