diff mbox series

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

Message ID PA4PR03MB71674512452C085782D35705FD6A9@PA4PR03MB7167.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,v2] avfilter/vf_showinfo: add wallclock option | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Riedl Aug. 17, 2022, 8:30 a.m. UTC
Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
---
 libavfilter/vf_showinfo.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Nicolas George Aug. 17, 2022, 8:43 a.m. UTC | #1
Michael Riedl (12022-08-17):
> Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
> ---
>  libavfilter/vf_showinfo.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

What is the intended use case? It seems to me very ad-hoc. A fftools
option to add a timestamp to each log line seems a more generic and
cleaner approach.

Regards,
Michael Riedl Aug. 17, 2022, 9:01 a.m. UTC | #2
On 17.08.2022 10:43, Nicolas George wrote:
> Michael Riedl (12022-08-17):
>> Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
>> ---
>>   libavfilter/vf_showinfo.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
> 
> What is the intended use case? It seems to me very ad-hoc. A fftools
> option to add a timestamp to each log line seems a more generic and
> cleaner approach.

This is a good idea, I will look into that. Regarding vf_showinfo, I am 
working on options to limit the output to certain frames (first N, last 
N, only I-frames). I think this will be useful, what do you think?

Regards,
Andreas Rheinhardt Aug. 17, 2022, 9:22 a.m. UTC | #3
Nicolas George:
> Michael Riedl (12022-08-17):
>> Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
>> ---
>>  libavfilter/vf_showinfo.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
> 
> What is the intended use case? It seems to me very ad-hoc. A fftools
> option to add a timestamp to each log line seems a more generic and
> cleaner approach.
> 

Basically already exists:
https://ffmpeg.org/pipermail/ffmpeg-devel/2021-August/283434.html

- Andreas
Nicolas George Aug. 17, 2022, 9:28 a.m. UTC | #4
Andreas Rheinhardt (12022-08-17):
> Basically already exists:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2021-August/283434.html

Lacks subsecond precision and timezone information, but a good start.

Regards,
Nicolas George Aug. 17, 2022, 3:03 p.m. UTC | #5
Michael Riedl (12022-08-17):
> This is a good idea, I will look into that. Regarding vf_showinfo, I am
> working on options to limit the output to certain frames (first N, last N,
> only I-frames). I think this will be useful, what do you think?

I strongly doubt it, but I will not object if the option is clean and
unobtrusive enough. Please make sure the logic and implementation can
easily be generalized to other filters.

Regards,
Soft Works Aug. 24, 2022, 1:15 a.m. UTC | #6
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Michael Riedl
> Sent: Wednesday, August 17, 2022 11:02 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_showinfo: add
> wallclock option
> 
> On 17.08.2022 10:43, Nicolas George wrote:
> > Michael Riedl (12022-08-17):
> >> Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
> >> ---
> >>   libavfilter/vf_showinfo.c | 11 +++++++++++
> >>   1 file changed, 11 insertions(+)
> >
> > What is the intended use case? It seems to me very ad-hoc. A
> fftools
> > option to add a timestamp to each log line seems a more generic and
> > cleaner approach.
> 
> This is a good idea, I will look into that. 

There exists a patch that does this and might be useful for you:

https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=4526&state=%2A&archive=both

Best,
softworkz
Soft Works Aug. 24, 2022, 2 a.m. UTC | #7
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Nicolas George
> Sent: Wednesday, August 17, 2022 11:28 AM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/vf_showinfo: add
> wallclock option
> 
> Andreas Rheinhardt (12022-08-17):
> > Basically already exists:
> > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-August/283434.html
> 
> Lacks subsecond precision and timezone information, but a good start.
> 
> Regards,
> 
> --
>   Nicolas George

It does provide subsecond precision, please see the 'millisec' variable
here:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/MN2PR04MB5981773A7336C9B46D298354BAF79@MN2PR04MB5981.namprd04.prod.outlook.com/

Adding the ability to print time zone information is a good idea, I think.

The patchset allows to control whether to print date, time or both.
In practical use, I ended up printing a line with the date on startup
and print only time information, e.g. like this:

01:40:42.467 ffmpeg version 5.1...
01:40:42.467   built with ...
01:40:42.468 Execution Date: 2022-08-16 01:40:42
01:40:42.499 Input #0, matroska,webm, ...



If there is interest, I can submit my latest version of this.

Best,
softworkz
Michael Riedl Aug. 25, 2022, 12:08 p.m. UTC | #8
> The patchset allows to control whether to print date, time or both.
> In practical use, I ended up printing a line with the date on startup
> and print only time information, e.g. like this:
> 
> 01:40:42.467 ffmpeg version 5.1...
> 01:40:42.467   built with ...
> 01:40:42.468 Execution Date: 2022-08-16 01:40:42
> 01:40:42.499 Input #0, matroska,webm, ...
> 
> 
> 
> If there is interest, I can submit my latest version of this.

 From my side this would be interesting and helpful for me.

Thanks,
Michael
diff mbox series

Patch

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++) {