How to calculate the overhead of wrapping multiple elementary streams? I run a web service which muxes multiple elementary streams (e.g., H.264 + FLAC) into a single matroska container/wrapper/file. There is no transcoding as I only copy the streams, using a process like ffmpeg  -i i.mkv -i i.flac   -map 0:0 -c:0 copy -map 1:0 -c:1 copy out.mkv.

The problem is that the service must provide the total file size (in bytes) of the file (out.mkv) resulting from the mux up front (i.e., before the actual muxing completes).  Is it possible to calculate it?
The only exact approach is to simulate the muxing. On a *nix system this would be

ffmpeg -i i.mkv -i i.flac -c copy -map 0:0 -map 1:0 -f matroska /dev/null


At the bottom of console readout, there's this line:

frame=152217 fps=71723 q=-1.0 Lsize=  551301kB time=01:41:28.66 ...


The Lsize is what you want. This operation is pretty quick as there's nothing written to disk.