summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-06-19 17:10:48 +0200
committerAnton Khirnov <anton@khirnov.net>2022-07-28 16:37:16 +0200
commit1a378b8274a3a4625d3ea95ce108ef597c752ff2 (patch)
tree0b0f3f10ef1014a39a230431ce750ae3039ed38f
parent1eae0ee02ee74dc1833e9610a1574fe25cc7a2f0 (diff)
fftools/ffmpeg: deprecate -psnr
It is entirely redundant with -flags +psnr.
-rw-r--r--doc/ffmpeg.texi3
-rw-r--r--fftools/ffmpeg.h3
-rw-r--r--fftools/ffmpeg_opt.c12
3 files changed, 15 insertions, 3 deletions
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0e657b0138..974d1c108f 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -992,7 +992,8 @@ to keep the interlaced format for minimum losses.
The alternative is to deinterlace the input stream by use of a filter
such as @code{yadif} or @code{bwdif}, but deinterlacing introduces losses.
@item -psnr
-Calculate PSNR of compressed frames.
+Calculate PSNR of compressed frames. This option is deprecated, pass the
+PSNR flag to the encoder instead, using @code{-flags +psnr}.
@item -vstats
Dump video coding statistics to @file{vstats_HHMMSS.log}.
@item -vstats_file @var{file}
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 59c2f47a66..0795a380f8 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -49,6 +49,9 @@
#include "libswresample/swresample.h"
+// deprecated features
+#define FFMPEG_OPT_PSNR 1
+
enum VideoSyncMethod {
VSYNC_AUTO = -1,
VSYNC_PASSTHROUGH,
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 32e0d9a7ff..716b53d81f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -183,7 +183,9 @@ int64_t stats_period = 500000;
static int file_overwrite = 0;
static int no_file_overwrite = 0;
+#if FFMPEG_OPT_PSNR
static int do_psnr = 0;
+#endif
static int input_stream_potentially_available = 0;
static int ignore_unknown_streams = 0;
static int copy_unknown_streams = 0;
@@ -1926,8 +1928,12 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
}
video_enc->rc_override_count = i;
- if (do_psnr)
+#if FFMPEG_OPT_PSNR
+ if (do_psnr) {
+ av_log(NULL, AV_LOG_WARNING, "The -psnr option is deprecated, use -flags +psnr\n");
video_enc->flags|= AV_CODEC_FLAG_PSNR;
+ }
+#endif
/* two pass mode */
MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
@@ -3942,8 +3948,10 @@ const OptionDef options[] = {
{ "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(passlogfiles) },
"select two pass log file name prefix", "prefix" },
+#if FFMPEG_OPT_PSNR
{ "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr },
- "calculate PSNR of compressed frames" },
+ "calculate PSNR of compressed frames (deprecated, use -flags +psnr)" },
+#endif
{ "vstats", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_vstats },
"dump video coding statistics to file" },
{ "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { .func_arg = opt_vstats_file },