Go to the documentation of this file.
55 #define SET_META(key, format, value) \
56 snprintf(buf, sizeof(buf), format, value); \
57 av_dict_set(metadata, key, buf, 0)
65 uint8_t *p =
frame->data[0];
69 for (
i = 0;
i <
frame->height;
i++) {
70 for (x = 0; x <
inlink->w; x++)
71 s->nblack += p[x] <
s->bthresh;
72 p +=
frame->linesize[0];
76 s->last_keyframe =
s->frame;
79 if (pblack >=
s->bamount) {
80 metadata = &
frame->metadata;
83 "type:%c last_keyframe:%d\n",
84 s->frame, pblack,
frame->pts,
88 SET_META(
"lavfi.blackframe.pblack",
"%u", pblack);
96 #define OFFSET(x) offsetof(BlackFrameContext, x)
97 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
99 {
"amount",
"percentage of the pixels that have to be below the threshold "
101 {
"threshold",
"threshold below which a pixel value is considered black",
103 {
"thresh",
"threshold below which a pixel value is considered black",
126 .
name =
"blackframe",
129 .priv_class = &blackframe_class,
AVPixelFormat
Pixel format.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define FILTER_PIXFMTS_ARRAY(array)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
static const AVFilterPad avfilter_vf_blackframe_outputs[]
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
A link between two filters.
unsigned int nblack
number of black pixels counted so far
static enum AVPixelFormat pix_fmts[]
A filter pad used for either input or output.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
#define SET_META(key, format, value)
static const AVFilterPad avfilter_vf_blackframe_inputs[]
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
int bthresh
black threshold
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_LOG_INFO
Standard information.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define i(width, name, range_min, range_max)
static const AVOption blackframe_options[]
unsigned int frame
frame number
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
const char * name
Pad name.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
const AVFilter ff_vf_blackframe
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define FILTER_OUTPUTS(array)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define flags(name, subs,...)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
unsigned int last_keyframe
frame number of the last received key-frame
AVFILTER_DEFINE_CLASS(blackframe)