[FFmpeg-cvslog] avfilter/vf_psnr: Add support for writing stats to stdout
Tobias Rapp
git at videolan.org
Wed Oct 21 00:50:35 CEST 2015
ffmpeg | branch: master | Tobias Rapp <t.rapp at noa-audio.com> | Tue Oct 20 15:02:21 2015 +0200| [1ec8c1554ed81a31ac4f82621121405de067b21e] | committer: Michael Niedermayer
avfilter/vf_psnr: Add support for writing stats to stdout
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ec8c1554ed81a31ac4f82621121405de067b21e
---
doc/filters.texi | 3 ++-
libavfilter/vf_psnr.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 1af0a72..486398d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8939,7 +8939,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 PSNR 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_psnr.c b/libavfilter/vf_psnr.c
index a01b2c1..bfb0711 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -193,7 +193,9 @@ static av_cold int init(AVFilterContext *ctx)
s->min_mse = +INFINITY;
s->max_mse = -INFINITY;
- 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);
@@ -334,7 +336,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);
}
More information about the ffmpeg-cvslog
mailing list