[PATCH] avfilter/vf_frei0r: fix time not being passed in seconds
Stefan Breunig
stefan-ffmpeg-devel at breunig.xyz
Sun Jul 6 09:57:57 EEST 2025
The frei0r API expects the time in seconds, but was given it in
milliseconds. The bug might exist since 41f1d3a (~14 years ago),
but plugins depending on the time are unwatchable without this
patch. For example:
ffmpeg -filter_complex "testsrc2=d=5,frei0r=distort0r" out.mp4
Signed-off-by: Stefan Breunig <stefan-ffmpeg-devel at breunig.xyz>
---
libavfilter/vf_frei0r.c | 2 +-
tests/fate/filter-video.mak | 5 +++++
tests/ref/fate/filter-frei0r-filter | 10 ++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 tests/ref/fate/filter-frei0r-filter
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 1284e27310..50d81d220f 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -379,7 +379,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
in = in2;
}
- s->update(s->instance, in->pts * av_q2d(inlink->time_base) * 1000,
+ s->update(s->instance, in->pts * av_q2d(inlink->time_base),
(const uint32_t *)in->data[0],
(uint32_t *)out->data[0]);
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 34cf7afa83..775febfde4 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -701,6 +701,11 @@ $(FATE_FILTER_VSYNTH-yes): SRC = $(TARGET_PATH)/tests/vsynth1/%02d.pgm
FATE_FFMPEG += $(FATE_FILTER_VSYNTH-yes)
+FATE_FILTER_FREI0R-$(call ALLYES, TESTSRC2_FILTER FREI0R_FILTER) = fate-filter-frei0r-filter
+fate-filter-frei0r-filter: SRC = testsrc2=r=1:d=5
+fate-filter-frei0r-filter: CMD = framecrc -lavfi "$(SRC),frei0r=enable=gte(n\,3):filter_name=distort0r"
+FATE_FFMPEG += $(FATE_FILTER_FREI0R-yes)
+
#
# Metadata tests
#
diff --git a/tests/ref/fate/filter-frei0r-filter b/tests/ref/fate/filter-frei0r-filter
new file mode 100644
index 0000000000..4b1588785d
--- /dev/null
+++ b/tests/ref/fate/filter-frei0r-filter
@@ -0,0 +1,10 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0, 0, 0, 1, 307200, 0x30630897
+0, 1, 1, 1, 307200, 0xd08784dd
+0, 2, 2, 1, 307200, 0xe94387a0
+0, 3, 3, 1, 307200, 0x5df7a70e
+0, 4, 4, 1, 307200, 0x9c203210
--
2.47.2
More information about the ffmpeg-devel
mailing list