diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 15eca7e56..8b4a2ff5f 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1031,6 +1031,9 @@ class YoutubeDL(object): for j, part in enumerate(format['parts']): if 'url' not in part: raise ExtractorError('Missing "url" key in result (index %d, part %d)' % (i, j)) + full_format_info = info_dict.copy() + full_format_info.update(part) + part['http_headers'] = self._calc_headers(full_format_info) else: if 'url' not in format: raise ExtractorError('Missing "url" key in result (index %d)' % i) @@ -1046,11 +1049,12 @@ class YoutubeDL(object): # Automatically determine file extension if missing if 'ext' not in format: format['ext'] = determine_ext(format['url']).lower() - # Add HTTP headers, so that external programs can use them from the - # json output - full_format_info = info_dict.copy() - full_format_info.update(format) - format['http_headers'] = self._calc_headers(full_format_info) + if 'parts' not in format: + # Add HTTP headers, so that external programs can use them from the + # json output + full_format_info = info_dict.copy() + full_format_info.update(format) + format['http_headers'] = self._calc_headers(full_format_info) format_limit = self.params.get('format_limit', None) if format_limit: diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 09de067e9..5182dac15 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -234,6 +234,8 @@ def _real_main(argv=None): if not opts.addmetadata: postprocessors.append({'key': 'FFmpegAudioFix'}) postprocessors.append({'key': 'AtomicParsley'}) + if opts.joinparts: + postprocessors.append({'key': 'FFmpegJoinVideos'}) # Please keep ExecAfterDownload towards the bottom as it allows the user to modify the final file in any way. # So if the user is able to remove the file before your postprocessor runs it might cause a few problems. if opts.exec_cmd: diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index e07f7cc97..0087786ff 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -134,7 +134,7 @@ class FFmpegPostProcessor(PostProcessor): files_cmd = [] for path in input_paths: files_cmd.extend([encodeArgument('-i'), encodeFilename(path, True)]) - cmd = ([encodeFilename(self._executable, True), encodeArgument('-y')] + + cmd = ([encodeFilename(self.executable, True), encodeArgument('-y')] + [encodeArgument(o) for o in input_opts] + files_cmd + [encodeArgument(o) for o in opts] + [encodeFilename(self._ffmpeg_filename_argument(out_path), True)])