[FFmpeg-devel] [PATCH v2] avfilter/vf_freezedetect: add discard option to force drop freezen frame

Gyan ffmpeg at gyani.pro
Tue Oct 8 08:42:42 EEST 2019



On 08-10-2019 10:58 AM, Limin Wang wrote:
> On Tue, Oct 08, 2019 at 10:02:25AM +0530, Gyan wrote:
>>
>> On 08-10-2019 09:24 AM, lance.lmwang at gmail.com wrote:
>>> From: Limin Wang <lance.lmwang at gmail.com>
>>>
>>> How to tested it, please try with the following command:
>>> ./ffmpeg  -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:discard=0"  -f null -
>>> frame=  150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 234x
>>>
>>> ./ffmpeg  -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:discard=1"  -f null -
>>> frame=   30 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=59.7x
>>>
>>> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
>>> ---
>>>   doc/filters.texi              | 10 ++++++++++
>>>   libavfilter/vf_freezedetect.c |  8 +++++++-
>>>   2 files changed, 17 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/filters.texi b/doc/filters.texi
>>> index 333f502083..8aa7471f7e 100644
>>> --- a/doc/filters.texi
>>> +++ b/doc/filters.texi
>>> @@ -10678,6 +10678,9 @@ timestamp of the first frame of the freeze. The
>>>   @code{lavfi.freezedetect.freeze_duration} and
>>>   @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
>>>   after the freeze.
>>> +In addition, you can choose to discard the freezen frames instead of report
>>> +by metadata. Please note the first few freezen frames (the detection interval)
>>> +won't be dropped for the filter doesn't buffer any frames.
>> freezen --> frozen
> OK, will fix it.
>
>> You could suggest that users apply tpad at start of stream so that
>> all frozen frames can be removed. Afterwards, users can trim out
>> those added frames.
>> Test this if you add it.
> I'm not familar with tpad and trim filter yet, anyway, it's not easy to
> use it. If you think it's useful to remove all frozen frames, I prefer
> to sumit another patch to fix it with frame cached.

Yes, the filter should remove all frozen frames. That it doesn't, is a 
current limitation.
If the limitation can be removed internally, that is preferable to 
external workarounds.

Gyan



More information about the ffmpeg-devel mailing list