[FFmpeg-devel] [PATCH 0/5] replace scale2ref by scale=rw:rh

Niklas Haas ffmpeg at haasn.xyz
Wed Apr 24 13:51:55 EEST 2024


As discussed in my previous series for fixing scale2ref[1], this filter
is fundamentally broken, and the only real fix would be to switch to
activate(), or ideally FFFrameSync.

[1] https://ffmpeg.org//pipermail/ffmpeg-devel/2024-March/323382.html

The main thing making this difficult is the fact that scale2ref also
wants to output ref frames to its secondary output, which FFFrameSync
does not support, and which is ultimately at least part of the root
cause of trac #10795.

Since this is in principle completely unnecessary (users can just
'split' the ref input and have it be consumed by vf_scale), and to make
the design of this filter a bit more robust and maintainable, switch to
an approach where vf_scale itself gains the ability to reference
a secondary input stream, using the "ref_*" series of variables.

This makes the current [i][ri]scale2ref[o][ro] equivalent to the only
slightly more verbose [ri]split[t][ro]; [i][t]scale=rw:rh[o]. (And
conversely, it is no longer necessary to use nullsink to consume an
unused [ro])

Incidentally, I think it would be nice if lavfi could *automatically*
split filter links referenced multiple times, so we could just write
e.g. [i][ri]scale=rw:rh[o]; [ri][o]overlay[out] and have it work. Maybe
I'll try getting that to work, next.

Either way, after the deprecation period has elapsed, we can delete
scale2ref from the codebase in order to make vf_scale.c IMHO
significantly simpler versus the status quo.



More information about the ffmpeg-devel mailing list