Error downloading videos in playlist #12044

Closed
opened 2026-02-21 05:11:37 -05:00 by deekerman · 1 comment
Owner

Originally created by @ghost on GitHub (Oct 24, 2017).

So im attempting to download a playlist and when i have download set to True it downloads a file with the name of the video's id but with 'webm' appended to it and with the file extension '.f248' ("6GJO_RpBnEgwebm.f248") another file with the same name is downloaded but with the extension '.f251' ("6GJO_RpBnEgwebm.f251") and finally before returning an error it merges the 2 files into "6GJO_RpBnEgwebm.webm"

I am using this code:

import youtube_dl

ytdl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s'})

ytdl.extract_info("https://www.youtube.com/watch?v=6GJO_RpBnEg&index=1&list=PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi", download=True)

And this is the full log from when i run it:

[youtube:playlist] Downloading playlist PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi - add --no-playlist to just download video 6GJO_RpBnEg
[youtube:playlist] PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi: Downloading webpage
[download] Downloading playlist: Life Is Strange
[youtube:playlist] playlist Life Is Strange: Downloading 15 videos
[download] Downloading video 1 of 15
[youtube] 6GJO_RpBnEg: Downloading webpage
[youtube] 6GJO_RpBnEg: Downloading video info webpage
[youtube] 6GJO_RpBnEg: Extracting video information
[youtube] 6GJO_RpBnEg: Downloading MPD manifest
[download] 6GJO_RpBnEgwebm.f248 has already been downloaded

[download] 100% of 11.43MiB
[download] 6GJO_RpBnEgwebm.f251 has already been downloaded

[download] 100% of 6.54MiB
[ffmpeg] Merging formats into "6GJO_RpBnEgwebm.webm"
ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred
Traceback (most recent call last):
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2031, in post_process
files_to_delete, info = pp.run(info)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 479, in run
self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 204, in run_ffmpeg_multiple_files
raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\adam\Desktop\Programs\YouTube_MusicDownloader\Main.py", line 5, in
ytdl.extract_info("https://www.youtube.com/watch?v=6GJO_RpBnEg&index=1&list=PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi", download=True)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 795, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 991, in process_ie_result
extra_info=extra)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 856, in process_ie_result
extra_info=extra_info)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 795, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 849, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1619, in process_video_result
self.process_info(new_info)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1966, in process_info
self.post_process(filename, info_dict)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2033, in post_process
self.report_error(e.msg)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 612, in report_error
self.trouble(error_message, tb)
File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 582, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred

Originally created by @ghost on GitHub (Oct 24, 2017). So im attempting to download a playlist and when i have download set to True it downloads a file with the name of the video's id but with 'webm' appended to it and with the file extension '.f248' ("6GJO_RpBnEgwebm.f248") another file with the same name is downloaded but with the extension '.f251' ("6GJO_RpBnEgwebm.f251") and finally before returning an error it merges the 2 files into "6GJO_RpBnEgwebm.webm" I am using this code: import youtube_dl ytdl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s'}) ytdl.extract_info("https://www.youtube.com/watch?v=6GJO_RpBnEg&index=1&list=PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi", download=True) And this is the full log from when i run it: [youtube:playlist] Downloading playlist PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi - add --no-playlist to just download video 6GJO_RpBnEg [youtube:playlist] PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi: Downloading webpage [download] Downloading playlist: Life Is Strange [youtube:playlist] playlist Life Is Strange: Downloading 15 videos [download] Downloading video 1 of 15 [youtube] 6GJO_RpBnEg: Downloading webpage [youtube] 6GJO_RpBnEg: Downloading video info webpage [youtube] 6GJO_RpBnEg: Extracting video information [youtube] 6GJO_RpBnEg: Downloading MPD manifest [download] 6GJO_RpBnEgwebm.f248 has already been downloaded [download] 100% of 11.43MiB [download] 6GJO_RpBnEgwebm.f251 has already been downloaded [download] 100% of 6.54MiB [ffmpeg] Merging formats into "6GJO_RpBnEgwebm.webm" ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred Traceback (most recent call last): File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2031, in post_process files_to_delete, info = pp.run(info) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 479, in run self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 204, in run_ffmpeg_multiple_files raise FFmpegPostProcessorError(msg) youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\adam\Desktop\Programs\YouTube_MusicDownloader\Main.py", line 5, in <module> ytdl.extract_info("https://www.youtube.com/watch?v=6GJO_RpBnEg&index=1&list=PLZlppmGv_GIKfcd4t6odoAB9a7aUBMBZi", download=True) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 795, in extract_info return self.process_ie_result(ie_result, download, extra_info) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 991, in process_ie_result extra_info=extra) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 856, in process_ie_result extra_info=extra_info) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 795, in extract_info return self.process_ie_result(ie_result, download, extra_info) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 849, in process_ie_result return self.process_video_result(ie_result, download=download) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1619, in process_video_result self.process_info(new_info) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 1966, in process_info self.post_process(filename, info_dict) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 2033, in post_process self.report_error(e.msg) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 612, in report_error self.trouble(error_message, tb) File "C:\Users\adam\AppData\Local\Programs\Python\Python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 582, in trouble raise DownloadError(message, exc_info) youtube_dl.utils.DownloadError: ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred >>>
deekerman 2026-02-21 05:11:37 -05:00
Author
Owner

@dstftw commented on GitHub (Oct 24, 2017):

Carefully read new issue template and provide all requested information.

@dstftw commented on GitHub (Oct 24, 2017): Carefully read [new issue template](https://github.com/rg3/youtube-dl/issues/new) and provide all requested information.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl#12044
No description provided.