Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/9] fftools/ffmpeg: deprecate -fps_mode/vsync drop
Date: Thu, 14 Dec 2023 20:31:31 +0100
Message-ID: <20231214193138.2503-2-anton@khirnov.net> (raw)
In-Reply-To: <20231214193138.2503-1-anton@khirnov.net>

It depends on the ability of muxers to generate timestamps, which is
itself deprecated.
---
 doc/ffmpeg.texi         | 3 ---
 fftools/ffmpeg.h        | 3 +++
 fftools/ffmpeg_filter.c | 9 +++++++--
 fftools/ffmpeg_mux.c    | 2 ++
 fftools/ffmpeg_opt.c    | 7 ++++++-
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index c503963941..f157c06e12 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1742,9 +1742,6 @@ constant frame rate.
 @item vfr (2)
 Frames are passed through with their timestamp or dropped so as to
 prevent 2 frames from having the same timestamp.
-@item drop
-As passthrough but destroys all timestamps, making the muxer generate
-fresh timestamps based on frame-rate.
 @item auto (-1)
 Chooses between cfr and vfr depending on muxer capabilities. This is the
 default method.
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index affa80856a..96f4e757e1 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -60,6 +60,7 @@
 #define FFMPEG_OPT_ENC_TIME_BASE_NUM 1
 #define FFMPEG_OPT_TOP 1
 #define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
+#define FFMPEG_OPT_VSYNC_DROP 1
 
 #define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
 
@@ -69,7 +70,9 @@ enum VideoSyncMethod {
     VSYNC_CFR,
     VSYNC_VFR,
     VSYNC_VSCFR,
+#if FFMPEG_OPT_VSYNC_DROP
     VSYNC_DROP,
+#endif
 };
 
 enum EncTimeBase {
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index bb755d7bb4..9fc877b437 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2104,8 +2104,11 @@ static void video_sync_process(OutputFilterPriv *ofp, AVFrame *frame,
 
     if (delta0 < 0 &&
         delta > 0 &&
-        ost->vsync_method != VSYNC_PASSTHROUGH &&
-        ost->vsync_method != VSYNC_DROP) {
+        ost->vsync_method != VSYNC_PASSTHROUGH
+#if FFMPEG_OPT_VSYNC_DROP
+        && ost->vsync_method != VSYNC_DROP
+#endif
+        ) {
         if (delta0 < -0.6) {
             av_log(ost, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
         } else
@@ -2143,7 +2146,9 @@ static void video_sync_process(OutputFilterPriv *ofp, AVFrame *frame,
             ofp->next_pts = llrint(sync_ipts);
         frame->duration = llrint(duration);
         break;
+#if FFMPEG_OPT_VSYNC_DROP
     case VSYNC_DROP:
+#endif
     case VSYNC_PASSTHROUGH:
         ofp->next_pts = llrint(sync_ipts);
         frame->duration = llrint(duration);
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 74df6dcb64..3ce4ef131e 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -150,8 +150,10 @@ static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
         goto fail;
     }
 
+#if FFMPEG_OPT_VSYNC_DROP
     if (ost->type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
         pkt->pts = pkt->dts = AV_NOPTS_VALUE;
+#endif
 
     // rescale timestamps to the stream timebase
     if (ost->type == AVMEDIA_TYPE_AUDIO && !ost->enc) {
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 6177a96a4e..96d3c56fd7 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -188,7 +188,12 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
     if      (!av_strcasecmp(arg, "cfr"))         *vsync_var = VSYNC_CFR;
     else if (!av_strcasecmp(arg, "vfr"))         *vsync_var = VSYNC_VFR;
     else if (!av_strcasecmp(arg, "passthrough")) *vsync_var = VSYNC_PASSTHROUGH;
-    else if (!av_strcasecmp(arg, "drop"))        *vsync_var = VSYNC_DROP;
+#if FFMPEG_OPT_VSYNC_DROP
+    else if (!av_strcasecmp(arg, "drop")) {
+        av_log(NULL, AV_LOG_WARNING, "-vsync/fps_mode drop is deprecated\n");
+        *vsync_var = VSYNC_DROP;
+    }
+#endif
     else if (!is_global && !av_strcasecmp(arg, "auto"))  *vsync_var = VSYNC_AUTO;
     else if (!is_global) {
         av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx);
-- 
2.42.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-12-14 19:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 19:31 [FFmpeg-devel] [PATCH 1/9] fftools/ffmpeg_mux: stop logging to AVFormatContext Anton Khirnov
2023-12-14 19:31 ` Anton Khirnov [this message]
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 3/9] fftools/ffmpeg_mux: factor timestamps processing out of write_packet() Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 4/9] fftools/cmdutils: change option flags to (1 << N) style Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 5/9] fftools/ffmpeg_mux_init: change 1-bit bitfields from int to unsigned Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 6/9] fftools/ffmpeg: print keyframe information with -stats_* Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 7/9] doc/ffmpeg: drop misleading claims from -stats_*_fmt Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 8/9] fftools/ffmpeg_mux: deduplicate uniniting EncStats Anton Khirnov
2023-12-14 19:31 ` [FFmpeg-devel] [PATCH 9/9] fftools/ffmpeg: use a mutex for enc_stats_write() Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231214193138.2503-2-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git