From 6c75cd3c68c08246d610146a1dbea3a0201a25ce Mon Sep 17 00:00:00 2001 From: Inias Peeters Date: Fri, 29 Oct 2021 14:44:59 +0200 Subject: [PATCH] Experimental override option for output args --- youtube_dl/__init__.py | 4 ++++ youtube_dl/downloader/external.py | 5 ++++- youtube_dl/options.py | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index e1bd67919..ac3b18978 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -310,6 +310,9 @@ def _real_main(argv=None): postprocessor_args = None if opts.postprocessor_args: postprocessor_args = compat_shlex_split(opts.postprocessor_args) + ffmpeg_out_override = None + if opts.ffmpeg_out_override: + ffmpeg_out_override = compat_shlex_split(opts.ffmpeg_out_override) match_filter = ( None if opts.match_filter is None else match_filter_func(opts.match_filter)) @@ -427,6 +430,7 @@ def _real_main(argv=None): 'hls_prefer_native': opts.hls_prefer_native, 'hls_use_mpegts': opts.hls_use_mpegts, 'external_downloader_args': external_downloader_args, + 'ffmpeg_out_override': ffmpeg_out_override, 'postprocessor_args': postprocessor_args, 'cn_verification_proxy': opts.cn_verification_proxy, 'geo_verification_proxy': opts.geo_verification_proxy, diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index c31f8910a..645a68e01 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -311,7 +311,10 @@ class FFmpegFD(ExternalFD): elif isinstance(conn, compat_str): args += ['-rtmp_conn', conn] - args += ['-i', url, '-c', 'copy'] + args += ['-i', url] + + ffmpeg_out_override = self.params.get('ffmpeg_out_override') + args += ffmpeg_out_override if ffmpeg_out_override else ['-c', 'copy'] if self.params.get('test', False): args += ['-fs', compat_str(self._TEST_FILE_SIZE)] diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 0a0641bd4..35aa2ba41 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -525,6 +525,10 @@ def parseOpts(overrideArguments=None): '--external-downloader-args', dest='external_downloader_args', metavar='ARGS', help='Give these arguments to the external downloader') + downloader.add_option( + '--ffmpeg-out-override', + dest='ffmpeg_out_override', metavar='ARGS', + help='Give these arguments to the ffmpeg instead of `-c copy`') workarounds = optparse.OptionGroup(parser, 'Workarounds') workarounds.add_option(