[Libav-user] blackdetect using libavfilter C API

Philippe Gorley philippe.gorley at savoirfairelinux.com
Fri Mar 8 17:32:07 EET 2019


On 2019-03-08 10:05 a.m., Venkateswaran.S wrote:
> Hi,
> 
> I'm using libavfilter to detect black frame in my video. I followed this 
> example https://ffmpeg.org/doxygen/3.4/filtering_video_8c-example.html , 
> but this example doesn't shows how to print black frame detected 
> duration, instead it prints out video frames.

The blackdetect filter sets "lavfi.black_start" in your AVFrame.metadata 
to a time string using AVFrame.pts and the time base (when it detects 
the start of a black sequence). When the black frames end, it sets 
"lavfi.black_end" in AVFrame.metadata, again using pts and time base.

You'll have to check each frame's metadata (AVDictionary*) and compute 
the duration yourself.

> As of now, I have replaced
> constchar*filter_descr 
> <https://ffmpeg.org/doxygen/3.4/filtering__video_8c.html#a84b31b94c024a45c4bcebd875a54e73d>= 
> "scale=78:24,transpose=cclock"; to constchar*filter_descr 
> <https://ffmpeg.org/doxygen/3.4/filtering__video_8c.html#a84b31b94c024a45c4bcebd875a54e73d>= 
> "blackdetect=d=2:pix_th=0.00";
> in the code.
> 
> Thanks & regards,
> S.Venkateswaran
> 
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
> 
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
> 

-- 
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux


More information about the Libav-user mailing list