[FFmpeg-devel] [PATCH] avfilter/vf_showinfo: add wallclock option

Michael Riedl michael.riedl at nativewaves.com
Wed Aug 10 17:59:10 EEST 2022


Signed-off-by: Michael Riedl <michael.riedl at nativewaves.com>
---
 libavfilter/vf_showinfo.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 2c8514fc80..1953f777c7 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -43,6 +43,7 @@
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
 #include "libavutil/uuid.h"
+#include "libavutil/time.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -51,6 +52,7 @@
 typedef struct ShowInfoContext {
     const AVClass *class;
     int calculate_checksums;
+    int print_wallclock;
 } ShowInfoContext;
 
 #define OFFSET(x) offsetof(ShowInfoContext, x)
@@ -58,6 +60,7 @@ typedef struct ShowInfoContext {
 
 static const AVOption showinfo_options[] = {
     { "checksum", "calculate checksums", OFFSET(calculate_checksums), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, VF },
+    { "wallclock", "print wallclock", OFFSET(print_wallclock), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
     { NULL }
 };
 
@@ -740,6 +743,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
                    sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
         av_log(ctx, AV_LOG_INFO, "\b]");
     }
+
+    if (s->print_wallclock) {
+        av_log(ctx, AV_LOG_INFO,
+               " wallclock:%"PRId64" ",
+               av_gettime()
+        );
+    }
+
     av_log(ctx, AV_LOG_INFO, "\n");
 
     for (i = 0; i < frame->nb_side_data; i++) {
-- 
2.37.1.windows.1



More information about the ffmpeg-devel mailing list