aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElyse <kevincristian@outlook.com>2022-04-26 04:54:56 -0500
committerGitHub <noreply@github.com>2022-04-26 02:54:56 -0700
commit00828e2c9311b90d317fa054883dd63e21fffa78 (patch)
tree999bd716f86b43e4d58a02de058639e0bca23526
parent7ab56be2c7309a2d11d4ee28c71f8fb29da21ef7 (diff)
downloadhypervideo-pre-00828e2c9311b90d317fa054883dd63e21fffa78.tar.lz
hypervideo-pre-00828e2c9311b90d317fa054883dd63e21fffa78.tar.xz
hypervideo-pre-00828e2c9311b90d317fa054883dd63e21fffa78.zip
[downloader/ffmpeg] Specify headers for each URL (#3553)
Closes #2696 Authored by: elyse0
-rw-r--r--yt_dlp/downloader/external.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 6c5616c60..da38e502d 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -382,13 +382,15 @@ class FFmpegFD(ExternalFD):
# if end_time:
# args += ['-t', compat_str(end_time - start_time)]
- if info_dict.get('http_headers') is not None and re.match(r'^https?://', urls[0]):
- # Trailing \r\n after each HTTP header is important to prevent warning from ffmpeg/avconv:
- # [http @ 00000000003d2fa0] No trailing CRLF found in HTTP header.
- headers = handle_youtubedl_headers(info_dict['http_headers'])
- args += [
+ http_headers = None
+ if info_dict.get('http_headers'):
+ youtubedl_headers = handle_youtubedl_headers(info_dict['http_headers'])
+ http_headers = [
+ # Trailing \r\n after each HTTP header is important to prevent warning from ffmpeg/avconv:
+ # [http @ 00000000003d2fa0] No trailing CRLF found in HTTP header.
'-headers',
- ''.join(f'{key}: {val}\r\n' for key, val in headers.items())]
+ ''.join(f'{key}: {val}\r\n' for key, val in youtubedl_headers.items())
+ ]
env = None
proxy = self.params.get('proxy')
@@ -441,6 +443,11 @@ class FFmpegFD(ExternalFD):
args += ['-rtmp_conn', conn]
for i, url in enumerate(urls):
+ # We need to specify headers for each http input stream
+ # otherwise, it will only be applied to the first.
+ # https://github.com/yt-dlp/yt-dlp/issues/2696
+ if http_headers is not None and re.match(r'^https?://', url):
+ args += http_headers
args += self._configuration_args((f'_i{i + 1}', '_i')) + ['-i', url]
args += ['-c', 'copy']