From 549b45459e4c2e1819edefc15fdf116f0689e7d3 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 6 Jul 2025 08:35:11 +0200 Subject: [PATCH] avfilter/vf_frei0r: fix time not being passed in seconds 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 --- libavfilter/vf_frei0r.c | 2 +- tests/fate/filter-video.mak | 4 ++++ tests/ref/fate/filter-frei0r-filter | 10 ++++++++++ 3 files changed, 15 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 63b59a4d65..cd5903c960 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -717,6 +717,10 @@ $(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-filter: CMD = framecrc -lavfi "testsrc2=r=1:d=5,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