[FFmpeg-devel] [PATCH 1/2] avfilter/f_metadata: add pts_time to print output

Tobias Rapp t.rapp at noa-archive.com
Mon May 9 11:35:37 CEST 2016


This allows e.g. to correlate signalstats metadata to time position
without having to find out the filter chain timebase first.

Signed-off-by: Tobias Rapp <t.rapp at noa-archive.com>
---
 libavfilter/f_metadata.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index fa6b9d3..ee631c5 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -30,6 +30,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/timestamp.h"
 #include "avfilter.h"
 #include "audio.h"
 #include "formats.h"
@@ -305,13 +306,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         break;
     case METADATA_PRINT:
         if (!s->key && e) {
-            s->print(ctx, "frame %"PRId64" pts %"PRId64"\n", inlink->frame_count, frame->pts);
+            s->print(ctx, "frame %"PRId64" pts %"PRId64" pts_time %s\n",
+                     inlink->frame_count, frame->pts, av_ts2timestr(frame->pts, &inlink->time_base));
             s->print(ctx, "%s=%s\n", e->key, e->value);
             while ((e = av_dict_get(metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
                 s->print(ctx, "%s=%s\n", e->key, e->value);
             }
         } else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
-            s->print(ctx, "frame %"PRId64" pts %"PRId64"\n", inlink->frame_count, frame->pts);
+            s->print(ctx, "frame %"PRId64" pts %"PRId64" pts_time %s\n",
+                     inlink->frame_count, frame->pts, av_ts2timestr(frame->pts, &inlink->time_base));
             s->print(ctx, "%s=%s\n", s->key, e->value);
         }
         return ff_filter_frame(outlink, frame);
-- 
1.9.1




More information about the ffmpeg-devel mailing list