[FFmpeg-devel] [PATCH 4/9] avfilter/overlay_subs: Add overlay_subs filter

Nicolas George george at nsup.org
Thu Aug 19 11:28:08 EEST 2021


Soft Works (12021-08-19):
> The primary problem I have is that the regular overlay filter just 
> enforces an overlay format that matches the primary input video format:
> 
> e.g.: when the primary video is yuv420p, it requests yuva420p for
> the overlay input which causes a format filter to be inserted automatically.
> 
> That's not possible in this case because we have subtitle frames as 
> input. Ideally, there wouldn't happen any format conversion up-front.
> Neither for the main video, nor for the overlay rects.
> What I mean is, that only the pixels of the overlay area would be touched,
> like for example: convert yuv to rgb, blend with rgba overlay, convert
> back rgb to yuv.
> 
> Does that make sense?

Yes and no. Yes it makes sense in itself.

But no, it does not make sense as an excuse to duplicate hundreds of
lines of code. If you want this special filter, you have to find a way
of sharing the code.

But I can say immediately that, after a quick glance, I do not like your
patch series at all, for a very simple reason: it is all over the place.

One of the key features of the sub2video hack was that it was entirely
contained: a few dozens lines of code in ffmpeg.c clearly identified.
Once proper support for subtitles in libavfilter is added, removing the
sub2video hack will be very easy.

As far as I can see, your proposal does not have that feature. Quite the
opposite: it takes the place in libavfilter that proper subtitles
support would take. As such, it makes it harder to implement subtitles
properly.

If you want to help on this, consider helping implementing real
subtitles support in libavfilter.

The first step towards this would be to continue cleaning up the
negotiation, so that a new type can be added without it becoming even
more spaghetti. This is the work I have started in
85a6404d7e6c759ddf71d6374812d7ff719728ec. If you want to help, review
reduce_formats(), swap_*() and pick_formats() to see if some are
redundant and to include them in the negotiation description structure.

Note that this refactoring of negotiation is not only for subtitles: it
also helps for data packets and for partial graph reconfiguration.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210819/bb7d9d0b/attachment.sig>


More information about the ffmpeg-devel mailing list