From: Marton Balint via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Marton Balint <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] Revert "lavfi: make sure frame SAR matches the link value" (PR #21482)
Date: Thu, 15 Jan 2026 23:36:04 -0000
Message-ID: <176852016504.25.1615190366179230382@4457048688e7> (raw)
PR #21482 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21482
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21482.patch
This reverts commit fcc33ada47e594d6b35b71c4a998af796f56492e.
It breaks playback of files with changing aspect ratio in ffplay, such as [1], because the filter chain is initialized with the initial aspect ratio, so any change is overwritten.
Michael already reported this issue at the time of patch submission [2], but it was applied anyway.
Ideally we could reinitialize the filter chain, but we never wanted to do that just for an aspect ratio change, because a filter chain reinitialization in the middle of playback / encoding can cause even worse issues. So I think it is better to just revert this.
[1] https://samples.ffmpeg.org/archive/container/mpegts/mpegts+mpeg2video+mp2++aspect.ts
[2] https://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312175.html
>From b306cc24bf8d023d579b0637f58ce8cb0039cfb8 Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
Date: Fri, 16 Jan 2026 00:11:57 +0100
Subject: [PATCH 1/2] avfilter: do not overwrite frame aspect ratio with source
frame props in histogram and vectorscrope
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavfilter/vf_histogram.c | 1 +
libavfilter/vf_vectorscope.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index f77148cdfe..1a5626b317 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -594,6 +594,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
av_frame_copy_props(out, in);
+ out->sample_aspect_ratio = outlink->sample_aspect_ratio;
av_frame_free(&in);
s->x_pos++;
if (s->x_pos >= s->width) {
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index eeee166172..483132332e 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -1469,6 +1469,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
+ out->sample_aspect_ratio = outlink->sample_aspect_ratio;
s->vectorscope(s, in, out, s->pd);
s->graticulef(s, out, s->x, s->y, s->pd, s->cs);
--
2.52.0
>From 8b13e72ad8bb6c1d64606481049f7dbaf0c1cd85 Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
Date: Wed, 14 Jan 2026 23:03:26 +0100
Subject: [PATCH 2/2] Revert "lavfi: make sure frame SAR matches the link
value"
This reverts commit fcc33ada47e594d6b35b71c4a998af796f56492e.
It breaks playback of files with changing aspect ratio in ffplay, such as [1],
because the filter chain is initialized with the initial aspect ratio, so any
change is overwritten.
[1] https://samples.ffmpeg.org/archive/container/mpegts/mpegts+mpeg2video+mp2++aspect.ts
---
libavfilter/avfilter.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 169c2baa42..bb0b665f0c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1084,8 +1084,6 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
if (av_pix_fmt_desc_get(link->format)->flags & AV_PIX_FMT_FLAG_ALPHA)
av_assert1(frame->alpha_mode == link->alpha_mode);
}
-
- frame->sample_aspect_ratio = link->sample_aspect_ratio;
} else {
if (frame->format != link->format) {
av_log(link->dst, AV_LOG_ERROR, "Format change is not supported\n");
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2026-01-15 23:36 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=176852016504.25.1615190366179230382@4457048688e7 \
--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