[FFmpeg-devel] [PATCH 2/3] ffmpeg.c: Continuously log current kbps and kBytes total for each non-seekable (aka live) output stream.

Michael Smithng michael at transparentpixel.com
Tue Aug 14 23:23:26 CEST 2012

On Aug 13, 2012, at 8:34 PM, Michael Niedermayer wrote:


>> print  kB= and kbps= (actual_kBytes and actual_kbps)  along with normal printed output.
> unrelated to the bugfix and thus doesnt belong in the same patch as
> the bugfix.
> [...]

I presume you're referencing the kB and kbps?

I think stuffing these values back into the existing snprintf(s) is a bad idea. The changes also illustrate the data for each ost rather than just 1, given the way we fall through print_report currently. I think it's more relevant to report each output_stream than just the first one.

Basically we didn't want to change those values in case someone was depending on that output being in the existing format. The addition of these 2 extra fields is the least invasive change we could think of.

In the total_size calculation in print_report it first attempts to get avio_size, if that fails, it tries to get avio_tell and failing that it sets total_size to 0.

total_size = avio_size(oc->pb);
if (total_size < 0) { // FIXME improve avio_size() so it works with non seekable output too                                                                                                                                                                                    
	total_size = avio_tell(oc->pb);
        if (total_size < 0)                                                                                                                                                                                                                                                       
            total_size = 0;                                                                                                                                                                                                                                                       

Instead of setting total_size to 0, we could do something like this instead

total_size = output_streams[0]->actual_bytes_written;

Is this more appropriate for you?

More information about the ffmpeg-devel mailing list