[FFmpeg-devel] [PATCH 2/3] ffmpeg.c: Continuously log current kbps and kBytes total for each non-seekable (aka live) output stream.
michaelni at gmx.at
Tue Aug 14 05:34:00 CEST 2012
On Mon, Aug 13, 2012 at 07:16:55PM -0700, Michael Smithng wrote:
> in write_frame():
> if return value is not negative, add size of data written (see above) to ost->actual_bytes_written.
> in print_report():
> + static int64_t print_timebase = 1000000; (set timebase of logged stats to 1 second)
> + static int64_t last_last_time = -1;
> + double elapsed_time;
> + double actual_time;
> + double actual_kBytes;
> + double actual_kbps;
> when last_time is initialized, also initialize last_last_time.
> when (cur_time - last_time) >= print_timebase,
> set last_last_time to last_time
> add print_timebase to last_time (this moves our timer forward by exact intervals)
> if last_time still lags behind cur_time by more than print_timebase,
> set it to cur_time - print_timebase to catch it up rapidly.
> then elapsed_time = (double)(last_time - last_last_time) / 1000000.0; (regularized time interval)
> now for each output stream,
> calculate actual_kBytes = accumulated actual_bytes_written / 1000.
> calculate actual_kbps = 8 * (actual_kBytes - (actual_prev_bytes / 1000.)) divided by elapsed_time.
> set actual_prev_bytes = actual_bytes_written.
> 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
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel