[FFmpeg-devel] [PATCH 4/4] fftools/ffmpeg: deprecate -re

Anton Khirnov anton at khirnov.net
Tue May 2 16:43:16 EEST 2023


It is exactly equivalent to -readrate 1.0
---
 Changelog              | 1 +
 doc/ffmpeg.texi        | 2 +-
 fftools/ffmpeg.h       | 3 +++
 fftools/ffmpeg_demux.c | 5 +++++
 fftools/ffmpeg_opt.c   | 4 +++-
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 2061aaf462..5feb4fd24e 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ version <next>:
 - afireqsrc audio source filter
 - arls filter
 - ffmpeg CLI new option: -readrate_initial_burst
+- ffmpeg CLI option -re deprecated in favor of -readrate 1.0
 
 version 6.0:
 - Radiance HDR image support
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index a12700e2f3..01fd2ae0fe 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1707,7 +1707,7 @@ it may cause packet loss.
 
 It is useful for when flow speed of output packets is important, such as live streaming.
 @item -re (@emph{input})
-Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
+This option is deprecated and equivalent to setting @code{-readrate 1}.
 @item -readrate_initial_burst @var{seconds}
 Set an initial read burst time, in seconds, after which @option{-re/-readrate}
 will be enforced.
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index b30f0758ec..ec4c580b91 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -56,6 +56,7 @@
 #define FFMPEG_ROTATION_METADATA 1
 #define FFMPEG_OPT_QPHIST 1
 #define FFMPEG_OPT_ADRIFT_THRESHOLD 1
+#define FFMPEG_OPT_RE 1
 
 enum VideoSyncMethod {
     VSYNC_AUTO = -1,
@@ -124,7 +125,9 @@ typedef struct OptionsContext {
     /* input options */
     int64_t input_ts_offset;
     int loop;
+#if FFMPEG_OPT_RE
     int rate_emu;
+#endif
     float readrate;
     double readrate_initial_burst;
     int accurate_seek;
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 9eea5a4eec..6727193697 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -1232,12 +1232,17 @@ int ifile_open(const OptionsContext *o, const char *filename)
         av_log(d, AV_LOG_ERROR, "Option -readrate is %0.3f; it must be non-negative.\n", f->readrate);
         exit_program(1);
     }
+#if FFMPEG_OPT_RE
     if (o->rate_emu) {
+        av_log(d, AV_LOG_WARNING, "Option -re is deprecated and will be removed. "
+               "Use -readrate 1.0 instead\n");
+
         if (f->readrate) {
             av_log(d, AV_LOG_WARNING, "Both -readrate and -re set. Using -readrate %0.3f.\n", f->readrate);
         } else
             f->readrate = 1.0f;
     }
+#endif
 
     if (f->readrate) {
         d->readrate_initial_burst = o->readrate_initial_burst ? o->readrate_initial_burst : 0.5;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 7f22b22604..9670b65a96 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1448,9 +1448,11 @@ const OptionDef options[] = {
         "dump each input packet" },
     { "hex",            OPT_BOOL | OPT_EXPERT,                       { &do_hex_dump },
         "when dumping packets, also dump the payload" },
+#if FFMPEG_OPT_RE
     { "re",             OPT_BOOL | OPT_EXPERT | OPT_OFFSET |
                         OPT_INPUT,                                   { .off = OFFSET(rate_emu) },
-        "read input at native frame rate; equivalent to -readrate 1", "" },
+        "deprecated, equivalent to -readrate 1.0", "" },
+#endif
     { "readrate",       HAS_ARG | OPT_FLOAT | OPT_OFFSET |
                         OPT_EXPERT | OPT_INPUT,                      { .off = OFFSET(readrate) },
         "read input at specified rate", "speed" },
-- 
2.39.2



More information about the ffmpeg-devel mailing list