[FFmpeg-devel] [PATCH] libavfilter/vf_overlay_cuda: Pass the main frame to the output if secondary frame is not available. now filter fails if secondary frame is not available due to e.g secondary source delay.

Nicolas George george at nsup.org
Fri Aug 21 14:01:33 EEST 2020


Alex Pokotilo (12020-08-21):
> I'm sorry. I'm a newbie. Am I right I just need to commit in following format:

No need to apologize.

> first line: short description......
> LF
> more details here

Exactly.

> Should I send a new patch as a separate email or reply to this one ?

It does not matter.

> I create a filter graph with vf_cuda_overlay in my application. I
> start sending frames into a "main" stream link using
> av_buffersrc_write_frame.
> I start sending frames into a "secondary" stream too almost
> immediately. I have one output sink in my filter graph.

What are the timestamps (and corresponding time bases) of the first
frame you send on each input?

> After each write I call av_buffersink_get_frame and get AVERROR_BUG
> from vf_overlay_cuda for some time initially but after several frames
> it starts returning mixed frame.
> I've checked vf_blend and other framesync filters. They do the same as
> I did in the fix.

The fix is probably right, but I would like to make 100% sure, and I do
not have a CUDA setup. Plus, it would help check the code of your
application is right.

> Maybe the problem In my application I cannot guarantee that both
> streams have the same timeline.
> Could you please point me to the place where framesync checks second
> stream availability before it calls it's filter(overlay_cuda_blend in
> my case).
> This topic is very complex to me now so any help from your side can
> really help me.

The code in framesync is rather complex because it is designed to handle
a wide variety of cases.

If you are willing to make a quick test, this would be interesting: in
libavfilter/framesync.c, in the function ff_framesync_init_dualinput,
replace fs->in[1].before = EXT_NULL; with EXT_INFINITY and see if it
changes something.

But most importantly, seeing the timestamps of the frames would let me
know if the issue is exactly what I think it is.

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/20200821/431b4508/attachment.sig>


More information about the ffmpeg-devel mailing list