[FFmpeg-devel] MKV Header: Writing duration early

Soft Works softworkz at hotmail.com
Tue Jul 12 13:15:08 EEST 2016

> There are two sides to this issue: change the muxer to write the value if it
> is known at the beginning and change the command-line tool to compute the
> value for their output.

> I suspect the muxer change would be reasonably easy.

> The change on the command-line tool, on the other hand, you would have to
> determine if the input duration is reliable, detect if filters may change
> the duration, take mapping from various files into account, etc. This is
> very hard.

Thanks Nicolas, that makes sense.

I had some hope that this kind of calculation would already be performed

anyway, while I haven't looked into that yet. I also haven't performed research

about other ffmpeg output formats, to see if there is an existing case

where duration is written early...

Before coding anything I'd like to get a feeling for what kind of solution

could be acceptable for the project.

Basically I suppose that whatever solution we could come up with, it should

be optional to make sure that there is no change to existing behaviour, right?

Since we would need some command-line parameter anyway, it could even

be a parameter like "-mkv_early_duration=01:30:10.010" to explicitly specify

the value. While this is not an intelligent solution, it's straightforward, but it

would require the parent application to parse the input file first in order to

determine the duration.

Another option would be a parameter like "-mkv_estimate_early_duration"

and see if there is some existing code we could build on. (I suppose ffserver

might have some code to estimate durations)

What do you think?


More information about the ffmpeg-devel mailing list