[FFmpeg-user] Could not write header for output file #0 (incorrect codec parameters ?):

Reuben Martin reuben.m at gmail.com
Fri Jun 24 01:52:21 CEST 2016


On Thu, Jun 23, 2016 at 4:00 PM, juan carlos Rebate <nerus492 at gmail.com>
wrote:

> according to the standard, html5 the mp4 format is ideal for this purpose,
> many companies that previously used flash html5 technology now used in mp4
> format, so again I say that is because ffmpeg
>


You need to understand that live streaming video, and pre-encoded
play-on-demand video are very different things. mp4 is indeed great for
html5, but it is not streamed live. You can use mp4 for live streaming IF
THE VIDEO IS IN CHUNKED FORMAT. This means the video is chopped up into
small little mp4 files that are maybe a few seconds long each. You can't
just load this into an html5 video tag, you have to use the javascript
Media Source Extensions API in order to manage downloading and chaining all
these little mp4 chunks together into a continuous video feed. You can't
stream mp4 format in the same sense as RTP, MPEG-TS, or RTMP. MP4 files
require an "moov atom" that gives info about the file, including how long
it is. Well, you have no way to know how long it is till the video is
finished encoding, so you can't use it live. This is also why "web
optimized" mp4 files move the "moov atom" to the front of the file, so that
it is the first atom that is read when downloading an on-demand-video, so
that it can start decoding before the file is finished downloading.
Otherwise if has to download the whole thing before it can play it because
by default the moov atom is placed at the end of the file. Hopefully you
understand why the moov atom creates an problem with live video that is not
done encoding. The chunked videos get around this by the short little mp4
videos being self-contained with each including it's moov atom.

This is the second time I've told you about Media Source Extensions.
Seriously, do some reading.
https://www.smashingmagazine.com/2016/04/html5-media-source-extensions-bringing-production-video-web/

-Reuben


More information about the ffmpeg-user mailing list