FFmpeg returned an error: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

See original GitHub issue

OS: 10.15.7 Catalina (MacOS)

Launch command used: ./destreamer.sh -i “https://web.microsoftstream.com/video/VIDEO-1

I am an elementary school teacher with enough tech savvy to follow instructions and copy-paste things into Terminal. (lol)

I’m trying to download a large (3h30m) video from MS Stream that our district shared for our last Pro-D day: I showed part of it (1h30m) to my class and a student has asked if I could post it in Teams. I only want to post the relevant section, and I thought finding a way to download it would be quicker than screen recording it… ha!

I got as far as reinstalling a newer version of ffmpeg but I don’t know what to do with this latest error. I searched previous issues and found the same error code in a closed/resolved issue but it was for Linux, not Mac. So now I am stuck.

Hoping there is an easy fix so I don’t have to screen record a 1h30m video this weekend!

Here’s what I get when I try to download the video:

Downloading Video: Indigenous Education Focus Day Nov 27th

Spawning ffmpeg with access token and HLS URL. This may take a few seconds…

Then it shows me a pixely image of the video’s title image, and then

progress [░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% 0 0s

[ERROR] FFmpeg returned an error: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

[FATAL ERROR] Unknown FFmpeg error

I don’t know where to go from here.

Verbose log
PASTE VERBOSE LOG HERE

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
snobucommented, Dec 14, 2020

@pistachoo, looking at your verbose output, i see you’re running a ffmpeg binary from 2015. That’s not going to work for destreamer.

[VERBOSE] Using ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers

Not sure how you ended up with that from brew, so maybe remove it and just download a fresh binary somewhere in your $PATH or tinker with your brew installation to get you the current ffmpeg version (4.3.1).

You can find static ffmpeg MacOS binaries here - https://evermeet.cx/ffmpeg/

1reaction
lukaarmacommented, Dec 14, 2020

@pistachoo, looking at your verbose output, i see you’re running a ffmpeg binary from 2015. That’s not going to work for destreamer.

Nice catch!

@lukaarma We should probably warn for aged ffmpeg binaries since it seems this is a common pitfall. Tracking here #294

Further discussion moving there

Read more comments on GitHub >

github_iconTop Results From Across the Web

FFMPEG MOV to MP4 error {Could not write header for output ...
FFMPEG MOV to MP4 error {Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument} - Stack Overflow. Stack ......
Read more >
FFmpeg returned an error: Could not write header for output ...
FFmpeg returned an error: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument #199.
Read more >
Could not write header for output file #0 (incorrect codec ...
of my h264 mp4 files are throwing this error. Full output of an example is below. Any troubleshooting recommendations are appreciated.
Read more >
f segment fails with "Could not write header for output file #0 ...
... "Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument" ... I'm trying to split this file into...
Read more >
[FFmpeg-user] Could not write header for output file #0 ...
error, commands only explain but not the solution, nor is there ... Could not write header for output file #0 (incorrect codec parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found