Analogous to my previous patch to vf_psnr.c the attached patch
implements writing SSIM frame stats to standard output if the filename
is "-".
Regards,
Tobias
>From 55077db04d9d843b25b560b8c4cee8924064e443 Mon Sep 17 00:00:00 2001
From: Tobias Rapp <t.r...@noa-audio.com>
Date: Tue, 20 Oct 2015 15:34:36 +0200
Subject: [PATCH] avfilter/vf_ssim: Add support for writing stats to stdout
---
doc/filters.texi | 3 ++-
libavfilter/vf_ssim.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 4edc4f3..0712b6f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10220,7 +10220,8 @@ The description of the accepted parameters follows.
@table @option
@item stats_file, f
If specified the filter will use the named file to save the SSIM of
-each individual frame.
+each individual frame. When filename equals "-" the data is sent to
+standard output.
@end table
The file printed if @var{stats_file} is selected, contains a sequence of
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 5cd9361..b23d447 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -223,7 +223,9 @@ static av_cold int init(AVFilterContext *ctx)
{
SSIMContext *s = ctx->priv;
- if (s->stats_file_str) {
+ if (!strcmp(s->stats_file_str, "-")) {
+ s->stats_file = stdout;
+ } else if (s->stats_file_str) {
s->stats_file = fopen(s->stats_file_str, "w");
if (!s->stats_file) {
int err = AVERROR(errno);
@@ -354,7 +356,7 @@ static av_cold void uninit(AVFilterContext *ctx)
ff_dualinput_uninit(&s->dinput);
- if (s->stats_file)
+ if (s->stats_file && s->stats_file != stdout)
fclose(s->stats_file);
av_freep(&s->temp);
--
1.9.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel