[FFmpeg-devel] [PATCH v6 0/3] Add option to log timing

ffmpegagent ffmpegagent at gmail.com
Fri Feb 7 16:34:26 EET 2025


This commit adds two logging flags: 'time' and 'datetime'.

Usage:

ffmpeg -loglevel +time

or

ffmpeg -loglevel +datetime

Update V1

 * Fix merge conflicts

Update V2

 * Rebased

Update V3

 * Fix print timing on exit (as reported by Michael Niedermayer)

Update V4

 * Rename variable
 * Rename flags to time and datetime (as suggested by Marth64)

Update V5

 * Fix commit message (as noted by epirat07)

Update V6

 * Handle empty quiet messages in log.c rather than clearing log flags in
   ffmpeg.c (as suggested by Tobias Rapp)

softworkz (3):
  avutil/log: support logging of date and time information
  fftools/opt_common: add time and datetime log flags
  doc/fftools-common-opts: document log timing flags

 doc/APIchanges               |  3 +++
 doc/fftools-common-opts.texi |  4 ++++
 fftools/opt_common.c         | 12 ++++++++++++
 libavutil/log.c              | 32 +++++++++++++++++++++++++++++---
 libavutil/log.h              | 10 ++++++++++
 libavutil/version.h          |  2 +-
 6 files changed, 59 insertions(+), 4 deletions(-)


base-commit: 4ba9ae7742a6f8a29d6486e25ff5709a075edb5b
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-37%2Fsoftworkz%2Fsubmit_logtiming-v6
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-37/softworkz/submit_logtiming-v6
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/37

Range-diff vs v5:

 1:  dae6bd3210 ! 1:  4c5bf1c03b avutil/log: support logging of date and time information
     @@ libavutil/log.c: static void format_line(void *avcl, int level, const char *fmt,
               if(type) type[1] = get_category(avcl);
           }
       
     -+    if (*print_prefix && (flags & (AV_LOG_PRINT_TIME | AV_LOG_PRINT_DATETIME)))
     ++    if (*print_prefix && (level > AV_LOG_QUIET) && (flags & (AV_LOG_PRINT_TIME | AV_LOG_PRINT_DATETIME)))
      +        format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME);
      +
           if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
 2:  63ab3a9411 ! 2:  81d9e24908 fftools/opt_common: add time and datetime log flags
     @@ Commit message
      
          ffmpeg -loglevel +datetime
      
     -    Setting av_log_set_flags(0) in term_exit in ffmpeg.c prevents
     -    timing to be printed when exiting.
     -
          Signed-off-by: softworkz <softworkz at hotmail.com>
      
     - ## fftools/ffmpeg.c ##
     -@@ fftools/ffmpeg.c: static void term_exit_sigsafe(void)
     - 
     - void term_exit(void)
     - {
     -+    av_log_set_flags(0);
     -     av_log(NULL, AV_LOG_QUIET, "%s", "");
     -     term_exit_sigsafe();
     - }
     -
       ## fftools/opt_common.c ##
      @@ fftools/opt_common.c: int opt_loglevel(void *optctx, const char *opt, const char *arg)
                   } else {
 3:  038cbf45ed = 3:  a3522a2116 doc/fftools-common-opts: document log timing flags

-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list