50 #define OFFSET(x) offsetof(BlackDetectContext, x)
51 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
55 {
"black_min_duration",
"set minimum detected black duration in seconds",
OFFSET(black_min_duration_time),
AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, DBL_MAX,
FLAGS },
56 {
"picture_black_ratio_th",
"set the picture black ratio threshold",
OFFSET(picture_black_ratio_th),
AV_OPT_TYPE_DOUBLE, {.dbl=.98}, 0, 1,
FLAGS },
65 #define YUVJ_FORMATS \
66 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
90 blackdetect->
class = &blackdetect_class;
113 "black_min_duration:%s pixel_black_th:%f pixel_black_th_i:%d picture_black_ratio_th:%f\n",
127 "black_start:%s black_end:%s black_duration:%s\n",
153 double picture_black_ratio = 0;
157 for (i = 0; i < inlink->
h; i++) {
158 for (x = 0; x < inlink->
w; x++)
163 picture_black_ratio = (double)blackdetect->
nb_black_pixels / (inlink->
w * inlink->
h);
166 "frame:%u picture_black_ratio:%f pos:%"PRId64
" pts:%s t:%s type:%c\n",
211 .
name =
"blackdetect",
216 .
inputs = blackdetect_inputs,
217 .
outputs = blackdetect_outputs,
218 .priv_class = &blackdetect_class,