mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 07:12:41 +00:00
[downloader/ffmpeg] Handle unknown formats better
This commit is contained in:
parent
b695e3f9bd
commit
af6793f804
1 changed files with 11 additions and 0 deletions
|
@ -17,11 +17,13 @@ from ..utils import (
|
||||||
cli_valueless_option,
|
cli_valueless_option,
|
||||||
cli_bool_option,
|
cli_bool_option,
|
||||||
_configuration_args,
|
_configuration_args,
|
||||||
|
determine_ext,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
encodeArgument,
|
encodeArgument,
|
||||||
handle_youtubedl_headers,
|
handle_youtubedl_headers,
|
||||||
check_executable,
|
check_executable,
|
||||||
Popen,
|
Popen,
|
||||||
|
remove_end,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,6 +465,15 @@ class FFmpegFD(ExternalFD):
|
||||||
args += ['-f', 'flv']
|
args += ['-f', 'flv']
|
||||||
elif ext == 'mp4' and tmpfilename == '-':
|
elif ext == 'mp4' and tmpfilename == '-':
|
||||||
args += ['-f', 'mpegts']
|
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:
|
else:
|
||||||
args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
|
args += ['-f', EXT_TO_OUT_FORMATS.get(ext, ext)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue