[FFmpeg-devel] [PATCH] fftools/ffmpeg: move elapsed time counter to the end of the status line

James Almer jamrial at gmail.com
Fri May 9 19:24:47 EEST 2025


On 5/9/2025 9:06 AM, Marton Balint wrote:
> Elapsed time is much less important than the actual progress, and I am guessing
> several ffmpeg CLI frontends use the existing status line for showing progress,
> so putting a new field in the beginning is less optimal anyway.

LGTM, but for the record, we don't guarantee the printed output to be 
unchanged across versions, so anyone having scripts depending on that 
will have a bad time.

> 
> Related to ticket #11582.
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>   fftools/ffmpeg.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 24d43e6197..2e575e7b10 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -580,15 +580,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
>       av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
>       av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC);
>   
> -    secs = (int)t;
> -    ms = (int)((t - secs) * 1000);
> -    mins = secs / 60;
> -    secs %= 60;
> -    hours = mins / 60;
> -    mins %= 60;
> -
> -    av_bprintf(&buf, "elapsed=%"PRId64":%02d:%02d.%02d ", hours, mins, secs, ms / 10);
> -
>       for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
>           const float q = ost->enc ? atomic_load(&ost->quality) / (float) FF_QP2LAMBDA : -1;
>   
> @@ -679,6 +670,15 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
>           av_bprintf(&buf_script, "speed=%4.3gx\n", speed);
>       }
>   
> +    secs = (int)t;
> +    ms = (int)((t - secs) * 1000);
> +    mins = secs / 60;
> +    secs %= 60;
> +    hours = mins / 60;
> +    mins %= 60;
> +
> +    av_bprintf(&buf, " elapsed=%"PRId64":%02d:%02d.%02d", hours, mins, secs, ms / 10);
> +
>       if (print_stats || is_last_report) {
>           const char end = is_last_report ? '\n' : '\r';
>           if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250509/27786fe5/attachment.sig>


More information about the ffmpeg-devel mailing list