Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: breunigs via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: breunigs <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter/vf_frei0r: fix time when input is realigned (PR #20903)
Date: Wed, 12 Nov 2025 20:27:40 -0000
Message-ID: <176297926159.25.776932108030366925@2cb04c0e5124> (raw)

PR #20903 opened by breunigs
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20903
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20903.patch

av_frame_copy doesn't copy the input's PTS property, which resulted
in the frei0r filter always receiving the same static time.

Example that has a static distortion without patch:

ffmpeg -filter_complex "testsrc2=s=328x240:d=5,frei0r=distort0r" out.mp4

An installation of frei0r-plugins is required to run the tests,
which is usually seperate from the build headers. Some systems
have it packaged (e.g. `apt install frei0r-plugins`). An upstream
release extracted to `FREI0R_PATH` also works.

The distort0r filter requires dimensions to be divisible by 8.


>From 8a72bc558ea82e1a0f41d63a706531790a2ce878 Mon Sep 17 00:00:00 2001
From: Stefan Breunig <stefan-ffmpeg-devel@breunig.xyz>
Date: Wed, 12 Nov 2025 20:58:05 +0100
Subject: [PATCH] avfilter/vf_frei0r: fix time when input is realigned

av_frame_copy doesn't copy the input's PTS property, which resulted
in the frei0r filter always receiving the same static time.

Example that has a static distortion without patch:

ffmpeg -filter_complex "testsrc2=s=328x240:d=5,frei0r=distort0r" out.mp4

An installation of frei0r-plugins is required to run the tests,
which is usually seperate from the build headers. Some systems
have it packaged (e.g. `apt install frei0r-plugins`). An upstream
release extracted to `FREI0R_PATH` also works.

The distort0r filter requires dimensions to be divisible by 8.
---
 libavfilter/vf_frei0r.c                       |  4 ++++
 tests/fate/filter-video.mak                   |  3 ++-
 tests/ref/fate/filter-frei0r-filter-unaligned | 10 ++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-frei0r-filter-unaligned

diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 50d81d220f..5dd7387721 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -375,6 +375,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         if (!in2)
             goto fail;
         av_frame_copy(in2, in);
+        if(av_frame_copy_props(in2, in) < 0) {
+            av_frame_free(&in2);
+            goto fail;
+        }
         av_frame_free(&in);
         in = in2;
     }
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index cd5903c960..3fe7f10476 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -717,8 +717,9 @@ $(FATE_FILTER_VSYNTH-yes): SRC = $(TARGET_PATH)/tests/vsynth1/%02d.pgm
 
 FATE_FFMPEG += $(FATE_FILTER_VSYNTH-yes)
 
-FATE_FILTER_FREI0R-$(call FILTERFRAMECRC, TESTSRC2, FREI0R_FILTER) = fate-filter-frei0r-filter
+FATE_FILTER_FREI0R-$(call FILTERFRAMECRC, TESTSRC2, FREI0R_FILTER) = fate-filter-frei0r-filter fate-filter-frei0r-filter-unaligned
 fate-filter-frei0r-filter: CMD = framecrc -lavfi "testsrc2=r=1:d=5,frei0r=enable=gte(n\,3):filter_name=distort0r"
+fate-filter-frei0r-filter-unaligned: CMD = framecrc -lavfi "testsrc2=s=328x240:r=1:d=5,frei0r=filter_name=distort0r"
 FATE_FFMPEG += $(FATE_FILTER_FREI0R-yes)
 
 #
diff --git a/tests/ref/fate/filter-frei0r-filter-unaligned b/tests/ref/fate/filter-frei0r-filter-unaligned
new file mode 100644
index 0000000000..c3cffc69f1
--- /dev/null
+++ b/tests/ref/fate/filter-frei0r-filter-unaligned
@@ -0,0 +1,10 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 328x240
+#sar 0: 1/1
+0,          0,          0,        1,   314880, 0x7b9cad8f
+0,          1,          1,        1,   314880, 0x0184436f
+0,          2,          2,        1,   314880, 0x7e3f2776
+0,          3,          3,        1,   314880, 0x0dc5e915
+0,          4,          4,        1,   314880, 0xcf9c76ef
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-11-12 20:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=176297926159.25.776932108030366925@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@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