[Icecast] Webm files written without duration in header

Thomas B. Rücker thomas at ruecker.fi
Wed May 1 14:38:55 UTC 2019


On 5/1/19 9:58 AM, Sytze Visser wrote:
> I am streaming live with webm with ffmpeg to icecast 2.4.2. After the
> stream ends, I am unable to determine the duration of the file using
> ffprobe or mediainfo. Not sure but it seems that this has to do with
> headers?

It's a fundamental limitation of this type of streaming that the
duration can not be determined beforehand and there is no way for a
simple client to append necessary information.

> Should icecast be writing the duration into the header or should this
> somehow be passed from ffmpeg?

Does this mean you are using the dump feature to write the complete
stream to a file on the machine running Icecast?

> The requirement is really to determine the duration of the streamed
> event (i.e. not radio).

I'm not sure how to interpret this, there seem to be some unstated
assumptions, as e.g. radio broadcast has the same fundamental issues.

Nevertheless there is a trivial solution to address a file that is
missing such information: remux it.
This does not change the payload in any way, the Video and Audio (and
any other) bit-streams will not be changed. Only the WebM container
information gets rewritten. If there are malformed portions of the
stream (caused by e.g. CPU starved encoder or network stall), then those
might get removed though as a player wouldn't play them properly either.

There are many dedicated tools for remuxing MKV and or WebM.
A somewhat brute-force quick fix is of course: `ffmpeg -i foo.webm -c
copy bar.webm`



More information about the Icecast mailing list