[FFmpeg-devel] [PATCH] libavfilter/f_select: switch to activate and properly handle EOF pts
Li-Heng Chen
lihengc at netflix.com
Thu Sep 15 19:42:20 EEST 2022
On Thu, Sep 15, 2022 at 2:41 AM Nicolas George <george at nsup.org> wrote:
>
> Li-Heng Chen (12022-09-14):
> > Please allow me to explain again with your example. That's say we have
> > an input with 20 frames (0-19), and we want to keep prime number frames
> > with select filter, -vf select='eq(n\,2)+eq(n\,3)+...+eq(n\,13)+eq(n\,17)'
> >
> > In the activation function, select->eof_pts is updated to n at n=4, 6,
> > 8, 12, 14, 18
> > However, select->eof_pts is passed into ff_outlink_set_status only at
> > n=20, since
> > ff_inlink_acknowledge_status returns 1.
>
> I understood that. And I argue it is wrong.
>
> > Regardless of my logic, this behavior looks weird to me. In my opinion,
> > -vf select='eq(n\,24),fps=25/1' should produce the same result as just having
> > -vf select='eq(n\,24)'. However, select='eq(n\,24),fps=25/1' generates
> > 22 identical
> > frames while select='eq(n\,24)' only outputs one frame...
>
> Trick question:
>
> testsrc=r=25:d=4,select='gte(n\,0)*gte(24\,n)+gte(n\,50)*gte(74\,n)',fps=25
>
> How many frames do you expect on the output?
>
Played with this cmd
-f lavfi -i testsrc=r=25:d=4 -vf
select='gte(n\,0)*gte(24\,n)+gte(n\,50)*gte(74\,n)',fps=25/1
1) Existing ffmpeg behavior: output 100 frames
- n=25-49 are duplicated from frame #24;
- n=75-99 duplicated from frame #74.
2) with my patch: output 75 frames due to the EOF pts change
-> n=25-49 are duplicated from frame #24.
I guess your argument is that the duplication behavior should be
consistent between [25,50) and [75,99)? That makes sense to me!
Interestingly, however, I also tried the cmd without the fps filter
-f lavfi -i testsrc=r=25:d=4 -vf
select='gte(n\,0)*gte(24\,n)+gte(n\,50)*gte(74\,n)'
The existing ffmpeg outputs 75 frames, where n=25-49 are duplicated
from frame #24. This matches the behavior in 2)
Best,
Li-Heng
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list