Error number -22 occurred ( -f bestvideo+bestaudio ) #3451

Open
opened 2026-02-21 01:21:42 -05:00 by deekerman · 7 comments
Owner

Originally created by @ericzutter on GitHub (Nov 21, 2014).

Highest resolution for video in example is "-f 18". Instead of downloading highest resolution, youtube-dl.exe with parameter "-f bestvideo+bestaudio" downloads a lower resolution and gives an error. How download highest resolution from all DASH formats and all NON DASH formats ?

C:>youtube-dl.exe -v -f bestvideo+bestaudio https://www.youtube.com/watch?v=25gWNvrRDPU
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '-f', 'bestvideo+bestaudio', 'https://www.youtube.com/watch?v=25gWNvrRDPU']
[debug] Encodings: locale cp1252, fs mbcs, out cp65001, pref cp1252
[debug] youtube-dl version 2014.11.21
[debug] Python version 2.7.8 - Windows-7-6.1.7600
[debug] exe versions: ffmpeg N-62912-
[debug] Proxy map: {}
[youtube] Confirming age
[youtube] 25gWNvrRDPU: Downloading webpage
[youtube] 25gWNvrRDPU: Downloading video info webpage
[youtube] 25gWNvrRDPU: Extracting video information
[youtube] 25gWNvrRDPU: Downloading DASH manifest
[debug] Invoking downloader on 'https://r4---sn-oxv-25ge.googlevideo.com/videoplayback?id=db981636fad10cf5&itag=243&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=video/webm&gir=yes&clen=11409245&lmt=1396846363846848&dur=309.709&sver=3&upn=ki5BIfeiROY&mt=1416569196&signature=8477E8EF370B5A718C66EC5227DB079E37A8A237.02B745A5B571E9F32B7E423529CB69DB2FD2C088&key=dg_yt0&fexp=907259,916641,917000,927622,932404,943909,945066,947209,947215,948124,951923,952302,952605,952901,953912,957103,957105,957201,958100&ip=46.253.172.132&ipbits=0&expire=1416590877&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f243.webm
[download] 100% of 10.88MiB in 00:01
[debug] Invoking downloader on 'https://r4---sn-oxv-25ge.googlevideo.com/videoplayback?id=db981636fad10cf5&itag=141&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=audio/mp4&gir=yes&clen=9894083&lmt=1389424415540199&dur=310.311&sver=3&upn=ki5BIfeiROY&mt=1416569196&signature=12D9281BBE5C450336E787EC9F20B3CBAC7AE2F4.4CA428F4A9ED30F8ADEC3EB6560E799E234B2921&key=dg_yt0&fexp=907259,916641,917000,927622,932404,943909,945066,947209,947215,948124,951923,952302,952605,952901,953912,957103,957105,957201,958100&ip=46.253.172.132&ipbits=0&expire=1416590877&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f141.m4a
[download] 100% of 9.44MiB in 00:00
[ffmpeg] Merging formats into "Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.webm"
[debug] ffmpeg command line: ffmpeg -y -i 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f243.webm' -i 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f141.m4a' -c copy -map 0✌️0 -map 1🅰️0 -shortest 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.webm'
ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred
Traceback (most recent call last):
File "youtube_dl\YoutubeDL.pyo", line 1134, in post_process
File "youtube_dl\postprocessor\ffmpeg.pyo", line 523, in run
File "youtube_dl\postprocessor\ffmpeg.pyo", line 93, in run_ffmpeg_multiple_files
FFmpegPostProcessorError

Originally created by @ericzutter on GitHub (Nov 21, 2014). Highest resolution for video in example is "-f 18". Instead of downloading highest resolution, youtube-dl.exe with parameter "-f bestvideo+bestaudio" downloads a lower resolution and gives an error. How download highest resolution from all DASH formats and all NON DASH formats ? C:>youtube-dl.exe -v -f bestvideo+bestaudio https://www.youtube.com/watch?v=25gWNvrRDPU [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['-v', '-f', 'bestvideo+bestaudio', 'https://www.youtube.com/watch?v=25gWNvrRDPU'] [debug] Encodings: locale cp1252, fs mbcs, out cp65001, pref cp1252 [debug] youtube-dl version 2014.11.21 [debug] Python version 2.7.8 - Windows-7-6.1.7600 [debug] exe versions: ffmpeg N-62912- [debug] Proxy map: {} [youtube] Confirming age [youtube] 25gWNvrRDPU: Downloading webpage [youtube] 25gWNvrRDPU: Downloading video info webpage [youtube] 25gWNvrRDPU: Extracting video information [youtube] 25gWNvrRDPU: Downloading DASH manifest [debug] Invoking downloader on 'https://r4---sn-oxv-25ge.googlevideo.com/videoplayback?id=db981636fad10cf5&itag=243&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=video/webm&gir=yes&clen=11409245&lmt=1396846363846848&dur=309.709&sver=3&upn=ki5BIfeiROY&mt=1416569196&signature=8477E8EF370B5A718C66EC5227DB079E37A8A237.02B745A5B571E9F32B7E423529CB69DB2FD2C088&key=dg_yt0&fexp=907259,916641,917000,927622,932404,943909,945066,947209,947215,948124,951923,952302,952605,952901,953912,957103,957105,957201,958100&ip=46.253.172.132&ipbits=0&expire=1416590877&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur' [download] Destination: Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f243.webm [download] 100% of 10.88MiB in 00:01 [debug] Invoking downloader on 'https://r4---sn-oxv-25ge.googlevideo.com/videoplayback?id=db981636fad10cf5&itag=141&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=audio/mp4&gir=yes&clen=9894083&lmt=1389424415540199&dur=310.311&sver=3&upn=ki5BIfeiROY&mt=1416569196&signature=12D9281BBE5C450336E787EC9F20B3CBAC7AE2F4.4CA428F4A9ED30F8ADEC3EB6560E799E234B2921&key=dg_yt0&fexp=907259,916641,917000,927622,932404,943909,945066,947209,947215,948124,951923,952302,952605,952901,953912,957103,957105,957201,958100&ip=46.253.172.132&ipbits=0&expire=1416590877&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur' [download] Destination: Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f141.m4a [download] 100% of 9.44MiB in 00:00 [ffmpeg] Merging formats into "Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.webm" [debug] ffmpeg command line: ffmpeg -y -i 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f243.webm' -i 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.f141.m4a' -c copy -map 0:v:0 -map 1:a:0 -shortest 'Aben wo ha Music (DADDY LUMBA)-25gWNvrRDPU.webm' ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred Traceback (most recent call last): File "youtube_dl\YoutubeDL.pyo", line 1134, in post_process File "youtube_dl\postprocessor\ffmpeg.pyo", line 523, in run File "youtube_dl\postprocessor\ffmpeg.pyo", line 93, in run_ffmpeg_multiple_files FFmpegPostProcessorError
Author
Owner

@clampak commented on GitHub (Nov 22, 2014):

By specifying bestvideo+bestaudio, it grabs the best of each without the other and merges the two. The error you're getting is because the webm format can't have aac audio in it. This is documented in #3610.

Theoretically, if you just want to download the best quality, for this video only, then you could do:
youtube-dl -f 18+141 https://www.youtube.com/watch?v=25gWNvrRDPU

However, upon inspection this video is actually 352x240. That's the format 18.

@clampak commented on GitHub (Nov 22, 2014): By specifying `bestvideo+bestaudio`, it grabs the best of each without the other and merges the two. The error you're getting is because the webm format can't have aac audio in it. This is documented in #3610. Theoretically, if you just want to download the best quality, for this video only, then you could do: `youtube-dl -f 18+141 https://www.youtube.com/watch?v=25gWNvrRDPU` However, upon inspection this video is actually 352x240. That's the format 18.
Author
Owner

@clb92 commented on GitHub (Feb 24, 2015):

There's a new option available, which is relevant for you, in one of the newest versions of youtube-dl. You can use -f "bestvideo[ext=mp4]+bestaudio" to download the best mp4 video available.

@clb92 commented on GitHub (Feb 24, 2015): There's a new option available, which is relevant for you, in one of the newest versions of youtube-dl. You can use `-f "bestvideo[ext=mp4]+bestaudio"` to download the best mp4 video available.
Author
Owner

@Tatsh commented on GitHub (Jun 15, 2015):

Thanks @clb92. That is a great feature and unfortunately it is not documented on the manpage or help.

@Tatsh commented on GitHub (Jun 15, 2015): Thanks @clb92. That is a great feature and unfortunately it is not documented on the manpage or help.
Author
Owner

@dstftw commented on GitHub (Jun 15, 2015):

@Tatsh really?

@dstftw commented on GitHub (Jun 15, 2015): @Tatsh [really?](https://github.com/rg3/youtube-dl#format-selection)
Author
Owner

@Tatsh commented on GitHub (Jun 15, 2015):

@dstftw That link does not mention that one of the conditions is [ext=...]. Not all the conditions are documented. And youtube-dl -h | fgrep ext= outputs nothing. Now maybe you would not expect that in the --help text but I would certainly expect the format selection to be much more straightforward about valid syntax rather than giving some ideas via paragraphs. By comparison the Output Template section gives much more clear information by listing all possible values.

@Tatsh commented on GitHub (Jun 15, 2015): @dstftw That link does not mention that one of the conditions is `[ext=...]`. Not all the conditions are documented. And `youtube-dl -h | fgrep ext=` outputs nothing. Now maybe you would not expect that in the `--help` text but I would certainly expect the format selection to be much more straightforward about valid syntax rather than giving some ideas via paragraphs. By comparison the Output Template section gives much more clear information by listing all possible values.
Author
Owner

@dstftw commented on GitHub (Jun 15, 2015):

@Tatsh it actually does

and for ext, acodec, vcodec, container, and protocol and the comparisons =, !=

It's not feasible to write an example for every combination of field and comparison.

@dstftw commented on GitHub (Jun 15, 2015): @Tatsh it actually does > and for **ext**, acodec, vcodec, container, and protocol and the comparisons =, != It's not feasible to write an example for every combination of field and comparison.
Author
Owner

@mpenkov commented on GitHub (Sep 1, 2018):

It looks like this issue is resolved, and may be closed.

@mpenkov commented on GitHub (Sep 1, 2018): It looks like this issue is resolved, and may be closed.
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-ytdl-org#3451
No description provided.