Merging formats fails - Could not write header for output file #0 (incorrect codec parameters ?) #5476

Closed
opened 2026-02-21 02:49:12 -05:00 by deekerman · 2 comments
Owner

Originally created by @przemoc on GitHub (Sep 2, 2015).

youtube-dl -v "https://www.youtube.com/watch?v=OI_YqAdLKFc"

gives following output ending with error:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=OI_YqAdLKFc']
[debug] Encodings: locale cp1250, fs mbcs, out None, pref cp1250
[debug] youtube-dl version 2015.08.28
[debug] Python version 2.7.8 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-50911-g9efcfbe
[debug] Proxy map: {}
[youtube] OI_YqAdLKFc: Downloading webpage
[youtube] OI_YqAdLKFc: Downloading video info webpage
[youtube] OI_YqAdLKFc: Extracting video information
[youtube] OI_YqAdLKFc: Downloading DASH manifest
[youtube] OI_YqAdLKFc: Downloading DASH manifest
[debug] Invoking downloader on 'https://r2---sn-f5f7ln7l.googlevideo.com/videoplayback?id=388fd8a8074b2857&itag=271&source=youtube&requiressl=yes&ms=au&mv=m&pl=17&mm=31&mn=sn-f5f7ln7l&ratebypass=yes&mime=video/webm&gir=yes&clen=167013643&lmt=1441060274597265&dur=400.566&upn=nET3XzeXQv8&fexp=9407992,9408710,9409069,9409096,9412774,9414936,9415356,9415365,9415485,9416023,9416104,9416126,9416359,9417335,9417707,9417815,9418153,9418356,9418448,9419256,9420021&sver=3&signature=11F9D290A0B9338B1C6507E10B61FC72B0193B55.3F62E7E75D70C259CE9DEA5D4C8F4BD58D20C3E9&key=dg_yt0&mt=1441234081&ip=89.74.38.183&ipbits=0&expire=1441255800&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,pl,mm,mn,ratebypass,mime,gir,clen,lmt,dur'
[download] Resuming download at byte 18899177
[download] Destination: Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm

[download]  11.3% of 159.28MiB at 90.91KiB/s ETA 26:31
[download]  11.3% of 159.28MiB at 250.00KiB/s ETA 09:38
[download]  11.3% of 159.28MiB at 583.34KiB/s ETA 04:07
[download]  11.3% of 159.28MiB at  1.22MiB/s ETA 01:55 
[download]  11.3% of 159.28MiB at  2.16MiB/s ETA 01:05 
[download]  11.4% of 159.28MiB at  2.80MiB/s ETA 00:50 
[download]  11.4% of 159.28MiB at  3.65MiB/s ETA 00:38 
[download]  11.5% of 159.28MiB at  3.72MiB/s ETA 00:37 
[download]  11.6% of 159.28MiB at  3.62MiB/s ETA 00:38 
[download]  11.9% of 159.28MiB at  3.54MiB/s ETA 00:39 
[download]  12.6% of 159.28MiB at  3.51MiB/s ETA 00:39 
[download]  13.8% of 159.28MiB at  3.51MiB/s ETA 00:39 
[download]  16.0% of 159.28MiB at  3.50MiB/s ETA 00:38 
[download]  18.2% of 159.28MiB at  3.51MiB/s ETA 00:37 
[download]  20.4% of 159.28MiB at  3.51MiB/s ETA 00:36 
[download]  22.6% of 159.28MiB at  3.51MiB/s ETA 00:35 
[download]  24.8% of 159.28MiB at  3.51MiB/s ETA 00:34 
[download]  27.1% of 159.28MiB at  3.51MiB/s ETA 00:33 
[download]  29.3% of 159.28MiB at  3.51MiB/s ETA 00:32 
[download]  31.5% of 159.28MiB at  3.51MiB/s ETA 00:31 
[download]  33.7% of 159.28MiB at  3.51MiB/s ETA 00:30 
[download]  35.9% of 159.28MiB at  3.51MiB/s ETA 00:29 
[download]  38.1% of 159.28MiB at  3.51MiB/s ETA 00:28 
[download]  40.3% of 159.28MiB at  3.51MiB/s ETA 00:27 
[download]  42.5% of 159.28MiB at  3.51MiB/s ETA 00:26 
[download]  44.7% of 159.28MiB at  3.51MiB/s ETA 00:25 
[download]  46.9% of 159.28MiB at  3.51MiB/s ETA 00:24 
[download]  49.1% of 159.28MiB at  3.51MiB/s ETA 00:23 
[download]  51.3% of 159.28MiB at  3.51MiB/s ETA 00:22 
[download]  53.5% of 159.28MiB at  3.51MiB/s ETA 00:21 
[download]  55.8% of 159.28MiB at  3.51MiB/s ETA 00:20 
[download]  57.9% of 159.28MiB at  3.51MiB/s ETA 00:19 
[download]  60.2% of 159.28MiB at  3.51MiB/s ETA 00:18 
[download]  62.4% of 159.28MiB at  3.51MiB/s ETA 00:17 
[download]  64.6% of 159.28MiB at  3.51MiB/s ETA 00:16 
[download]  66.8% of 159.28MiB at  3.51MiB/s ETA 00:15 
[download]  69.0% of 159.28MiB at  3.51MiB/s ETA 00:14 
[download]  71.2% of 159.28MiB at  3.51MiB/s ETA 00:13 
[download]  73.4% of 159.28MiB at  3.51MiB/s ETA 00:12 
[download]  75.6% of 159.28MiB at  3.51MiB/s ETA 00:11 
[download]  77.8% of 159.28MiB at  3.51MiB/s ETA 00:10 
[download]  80.0% of 159.28MiB at  3.51MiB/s ETA 00:09 
[download]  82.2% of 159.28MiB at  3.51MiB/s ETA 00:08 
[download]  84.4% of 159.28MiB at  3.51MiB/s ETA 00:07 
[download]  86.6% of 159.28MiB at  3.51MiB/s ETA 00:06 
[download]  88.8% of 159.28MiB at  3.51MiB/s ETA 00:05 
[download]  91.0% of 159.28MiB at  3.51MiB/s ETA 00:04 
[download]  93.3% of 159.28MiB at  3.51MiB/s ETA 00:03 
[download]  95.5% of 159.28MiB at  3.51MiB/s ETA 00:02 
[download]  97.7% of 159.28MiB at  3.51MiB/s ETA 00:01 
[download]  99.9% of 159.28MiB at  3.51MiB/s ETA 00:00 
[download] 100.0% of 159.28MiB at  3.51MiB/s ETA 00:00 
[download] 100% of 159.28MiB in 00:40                  
[debug] Invoking downloader on 'https://r2---sn-f5f7ln7l.googlevideo.com/videoplayback?id=388fd8a8074b2857&itag=171&source=youtube&requiressl=yes&ms=au&mv=m&pl=17&mm=31&mn=sn-f5f7ln7l&ratebypass=yes&mime=audio/webm&gir=yes&clen=5309970&lmt=1441059508900662&dur=404.531&upn=nET3XzeXQv8&fexp=9407992,9408710,9409069,9409096,9412774,9414936,9415356,9415365,9415485,9416023,9416104,9416126,9416359,9417335,9417707,9417815,9418153,9418356,9418448,9419256,9420021&sver=3&signature=159BD04F7A91CECF8242635D194CF51944240D76.3D539512F168B832C33162CB34434EEF91C3A447&key=dg_yt0&mt=1441234081&ip=89.74.38.183&ipbits=0&expire=1441255800&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,pl,mm,mn,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm

[download]   0.0% of 5.06MiB at 90.91KiB/s ETA 00:57
[download]   0.1% of 5.06MiB at 250.00KiB/s ETA 00:20
[download]   0.1% of 5.06MiB at 583.33KiB/s ETA 00:08
[download]   0.3% of 5.06MiB at  1.13MiB/s ETA 00:04 
[download]   0.6% of 5.06MiB at  2.16MiB/s ETA 00:02 
[download]   1.2% of 5.06MiB at  2.80MiB/s ETA 00:01 
[download]   2.4% of 5.06MiB at  3.76MiB/s ETA 00:01 
[download]   4.9% of 5.06MiB at  3.72MiB/s ETA 00:01 
[download]   9.9% of 5.06MiB at  3.62MiB/s ETA 00:01 
[download]  19.7% of 5.06MiB at  3.39MiB/s ETA 00:01 
[download]  39.5% of 5.06MiB at  3.53MiB/s ETA 00:00 
[download]  79.0% of 5.06MiB at  3.52MiB/s ETA 00:00 
[download] 100.0% of 5.06MiB at  3.51MiB/s ETA 00:00 
[download] 100% of 5.06MiB in 00:01                  
[ffmpeg] Merging formats into "Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.webm"
[debug] ffmpeg command line: ffmpeg -y -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm' -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm' -c copy -map 0:v:0 -map 1:a:0 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.temp.webm'
ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Traceback (most recent call last):
  File "youtube_dl\YoutubeDL.pyo", line 1699, in post_process
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 403, in run
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 151, in run_ffmpeg_multiple_files
FFmpegPostProcessorError

Not sure if it is this particular format combination (271+171) or peculiarity of this particular video.

I've downloaded some previous videos of this youtube user in the past and didn't have this problem, but maybe other format combinations were used then.

Originally created by @przemoc on GitHub (Sep 2, 2015). ``` youtube-dl -v "https://www.youtube.com/watch?v=OI_YqAdLKFc" ``` gives following output ending with error: ``` [debug] System config: [] [debug] User config: [] [debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=OI_YqAdLKFc'] [debug] Encodings: locale cp1250, fs mbcs, out None, pref cp1250 [debug] youtube-dl version 2015.08.28 [debug] Python version 2.7.8 - Windows-7-6.1.7601-SP1 [debug] exe versions: ffmpeg N-50911-g9efcfbe [debug] Proxy map: {} [youtube] OI_YqAdLKFc: Downloading webpage [youtube] OI_YqAdLKFc: Downloading video info webpage [youtube] OI_YqAdLKFc: Extracting video information [youtube] OI_YqAdLKFc: Downloading DASH manifest [youtube] OI_YqAdLKFc: Downloading DASH manifest [debug] Invoking downloader on 'https://r2---sn-f5f7ln7l.googlevideo.com/videoplayback?id=388fd8a8074b2857&itag=271&source=youtube&requiressl=yes&ms=au&mv=m&pl=17&mm=31&mn=sn-f5f7ln7l&ratebypass=yes&mime=video/webm&gir=yes&clen=167013643&lmt=1441060274597265&dur=400.566&upn=nET3XzeXQv8&fexp=9407992,9408710,9409069,9409096,9412774,9414936,9415356,9415365,9415485,9416023,9416104,9416126,9416359,9417335,9417707,9417815,9418153,9418356,9418448,9419256,9420021&sver=3&signature=11F9D290A0B9338B1C6507E10B61FC72B0193B55.3F62E7E75D70C259CE9DEA5D4C8F4BD58D20C3E9&key=dg_yt0&mt=1441234081&ip=89.74.38.183&ipbits=0&expire=1441255800&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,pl,mm,mn,ratebypass,mime,gir,clen,lmt,dur' [download] Resuming download at byte 18899177 [download] Destination: Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm [download] 11.3% of 159.28MiB at 90.91KiB/s ETA 26:31 [download] 11.3% of 159.28MiB at 250.00KiB/s ETA 09:38 [download] 11.3% of 159.28MiB at 583.34KiB/s ETA 04:07 [download] 11.3% of 159.28MiB at 1.22MiB/s ETA 01:55 [download] 11.3% of 159.28MiB at 2.16MiB/s ETA 01:05 [download] 11.4% of 159.28MiB at 2.80MiB/s ETA 00:50 [download] 11.4% of 159.28MiB at 3.65MiB/s ETA 00:38 [download] 11.5% of 159.28MiB at 3.72MiB/s ETA 00:37 [download] 11.6% of 159.28MiB at 3.62MiB/s ETA 00:38 [download] 11.9% of 159.28MiB at 3.54MiB/s ETA 00:39 [download] 12.6% of 159.28MiB at 3.51MiB/s ETA 00:39 [download] 13.8% of 159.28MiB at 3.51MiB/s ETA 00:39 [download] 16.0% of 159.28MiB at 3.50MiB/s ETA 00:38 [download] 18.2% of 159.28MiB at 3.51MiB/s ETA 00:37 [download] 20.4% of 159.28MiB at 3.51MiB/s ETA 00:36 [download] 22.6% of 159.28MiB at 3.51MiB/s ETA 00:35 [download] 24.8% of 159.28MiB at 3.51MiB/s ETA 00:34 [download] 27.1% of 159.28MiB at 3.51MiB/s ETA 00:33 [download] 29.3% of 159.28MiB at 3.51MiB/s ETA 00:32 [download] 31.5% of 159.28MiB at 3.51MiB/s ETA 00:31 [download] 33.7% of 159.28MiB at 3.51MiB/s ETA 00:30 [download] 35.9% of 159.28MiB at 3.51MiB/s ETA 00:29 [download] 38.1% of 159.28MiB at 3.51MiB/s ETA 00:28 [download] 40.3% of 159.28MiB at 3.51MiB/s ETA 00:27 [download] 42.5% of 159.28MiB at 3.51MiB/s ETA 00:26 [download] 44.7% of 159.28MiB at 3.51MiB/s ETA 00:25 [download] 46.9% of 159.28MiB at 3.51MiB/s ETA 00:24 [download] 49.1% of 159.28MiB at 3.51MiB/s ETA 00:23 [download] 51.3% of 159.28MiB at 3.51MiB/s ETA 00:22 [download] 53.5% of 159.28MiB at 3.51MiB/s ETA 00:21 [download] 55.8% of 159.28MiB at 3.51MiB/s ETA 00:20 [download] 57.9% of 159.28MiB at 3.51MiB/s ETA 00:19 [download] 60.2% of 159.28MiB at 3.51MiB/s ETA 00:18 [download] 62.4% of 159.28MiB at 3.51MiB/s ETA 00:17 [download] 64.6% of 159.28MiB at 3.51MiB/s ETA 00:16 [download] 66.8% of 159.28MiB at 3.51MiB/s ETA 00:15 [download] 69.0% of 159.28MiB at 3.51MiB/s ETA 00:14 [download] 71.2% of 159.28MiB at 3.51MiB/s ETA 00:13 [download] 73.4% of 159.28MiB at 3.51MiB/s ETA 00:12 [download] 75.6% of 159.28MiB at 3.51MiB/s ETA 00:11 [download] 77.8% of 159.28MiB at 3.51MiB/s ETA 00:10 [download] 80.0% of 159.28MiB at 3.51MiB/s ETA 00:09 [download] 82.2% of 159.28MiB at 3.51MiB/s ETA 00:08 [download] 84.4% of 159.28MiB at 3.51MiB/s ETA 00:07 [download] 86.6% of 159.28MiB at 3.51MiB/s ETA 00:06 [download] 88.8% of 159.28MiB at 3.51MiB/s ETA 00:05 [download] 91.0% of 159.28MiB at 3.51MiB/s ETA 00:04 [download] 93.3% of 159.28MiB at 3.51MiB/s ETA 00:03 [download] 95.5% of 159.28MiB at 3.51MiB/s ETA 00:02 [download] 97.7% of 159.28MiB at 3.51MiB/s ETA 00:01 [download] 99.9% of 159.28MiB at 3.51MiB/s ETA 00:00 [download] 100.0% of 159.28MiB at 3.51MiB/s ETA 00:00 [download] 100% of 159.28MiB in 00:40 [debug] Invoking downloader on 'https://r2---sn-f5f7ln7l.googlevideo.com/videoplayback?id=388fd8a8074b2857&itag=171&source=youtube&requiressl=yes&ms=au&mv=m&pl=17&mm=31&mn=sn-f5f7ln7l&ratebypass=yes&mime=audio/webm&gir=yes&clen=5309970&lmt=1441059508900662&dur=404.531&upn=nET3XzeXQv8&fexp=9407992,9408710,9409069,9409096,9412774,9414936,9415356,9415365,9415485,9416023,9416104,9416126,9416359,9417335,9417707,9417815,9418153,9418356,9418448,9419256,9420021&sver=3&signature=159BD04F7A91CECF8242635D194CF51944240D76.3D539512F168B832C33162CB34434EEF91C3A447&key=dg_yt0&mt=1441234081&ip=89.74.38.183&ipbits=0&expire=1441255800&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,pl,mm,mn,ratebypass,mime,gir,clen,lmt,dur' [download] Destination: Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm [download] 0.0% of 5.06MiB at 90.91KiB/s ETA 00:57 [download] 0.1% of 5.06MiB at 250.00KiB/s ETA 00:20 [download] 0.1% of 5.06MiB at 583.33KiB/s ETA 00:08 [download] 0.3% of 5.06MiB at 1.13MiB/s ETA 00:04 [download] 0.6% of 5.06MiB at 2.16MiB/s ETA 00:02 [download] 1.2% of 5.06MiB at 2.80MiB/s ETA 00:01 [download] 2.4% of 5.06MiB at 3.76MiB/s ETA 00:01 [download] 4.9% of 5.06MiB at 3.72MiB/s ETA 00:01 [download] 9.9% of 5.06MiB at 3.62MiB/s ETA 00:01 [download] 19.7% of 5.06MiB at 3.39MiB/s ETA 00:01 [download] 39.5% of 5.06MiB at 3.53MiB/s ETA 00:00 [download] 79.0% of 5.06MiB at 3.52MiB/s ETA 00:00 [download] 100.0% of 5.06MiB at 3.51MiB/s ETA 00:00 [download] 100% of 5.06MiB in 00:01 [ffmpeg] Merging formats into "Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.webm" [debug] ffmpeg command line: ffmpeg -y -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm' -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm' -c copy -map 0:v:0 -map 1:a:0 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.temp.webm' ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Traceback (most recent call last): File "youtube_dl\YoutubeDL.pyo", line 1699, in post_process File "youtube_dl\postprocessor\ffmpeg.pyo", line 403, in run File "youtube_dl\postprocessor\ffmpeg.pyo", line 151, in run_ffmpeg_multiple_files FFmpegPostProcessorError ``` Not sure if it is this particular format combination (271+171) or peculiarity of this particular video. I've downloaded some previous videos of this youtube user in the past and didn't have this problem, but maybe other format combinations were used then.
Author
Owner

@jaimeMF commented on GitHub (Sep 3, 2015):

Using -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' could work.

Could you run ffmpeg -y -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm' -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm' -c copy -map 0:v:0 -map 1:a:0 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.temp.webm' from the same directory and post the output?

@jaimeMF commented on GitHub (Sep 3, 2015): Using `-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]'` could work. Could you run `ffmpeg -y -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f271.webm' -i 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.f171.webm' -c copy -map 0:v:0 -map 1:a:0 'Linking a MIDI Controller to Track Controls In REAPER-OI_YqAdLKFc.temp.webm'` from the same directory and post the output?
Author
Owner

@przemoc commented on GitHub (Sep 3, 2015):

I have to apologize.

Some time ago I updated ImageMagick via Chocolatey and forgot that it puts its dir at the beginning of PATH env var. This made ImageMagick's old ffmpeg (N-50911-g9efcfbe built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)) being used here. I fixed this and additionally downloaded latest Zeranoe's 64-bit build (N-74798-gd1bdaf3 built with gcc 4.9.3 (GCC)).

Now everything works fine, so I'm closing this.

@przemoc commented on GitHub (Sep 3, 2015): I have to apologize. Some time ago I updated ImageMagick via Chocolatey and forgot that it puts its dir at the beginning of `PATH` env var. This made ImageMagick's old ffmpeg (`N-50911-g9efcfbe` built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)) being used here. I fixed this and additionally downloaded latest Zeranoe's [64-bit build](http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150903-git-d1bdaf3-win64-static.7z) (`N-74798-gd1bdaf3` built with gcc 4.9.3 (GCC)). Now everything works fine, so I'm closing this.
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#5476
No description provided.