[FFmpeg-devel] [PATCH 4/4] lavfi/select: store scene score in buf ref metadata.

Clément Bœsch ubitux at gmail.com
Wed Oct 10 00:55:13 CEST 2012


---
 libavfilter/vf_select.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c
index c68618f..bb10273 100644
--- a/libavfilter/vf_select.c
+++ b/libavfilter/vf_select.c
@@ -238,8 +238,12 @@ static int select_frame(AVFilterContext *ctx, AVFilterBufferRef *picref)
     AVFilterLink *inlink = ctx->inputs[0];
     double res;
 
-    if (CONFIG_AVCODEC && select->do_scene_detect)
+    if (CONFIG_AVCODEC && select->do_scene_detect) {
+        char buf[32];
         select->var_values[VAR_SCENE] = get_scene_score(ctx, picref);
+        snprintf(buf, sizeof(buf), "%f", select->var_values[VAR_SCENE]);
+        av_dict_set(&picref->metadata, "lavfi.scene_score", buf, 0);
+    }
     if (isnan(select->var_values[VAR_START_PTS]))
         select->var_values[VAR_START_PTS] = TS2D(picref->pts);
     if (isnan(select->var_values[VAR_START_T]))
-- 
1.7.12.2



More information about the ffmpeg-devel mailing list