Go to the documentation of this file.
54 #define SET_META(key, format, value) \
55 snprintf(buf, sizeof(buf), format, value); \
56 av_dict_set(metadata, key, buf, 0)
64 uint8_t *p =
frame->data[0];
68 for (
i = 0;
i <
frame->height;
i++) {
69 for (x = 0; x <
inlink->w; x++)
70 s->nblack += p[x] <
s->bthresh;
71 p +=
frame->linesize[0];
75 s->last_keyframe =
s->frame;
78 if (pblack >=
s->bamount) {
79 metadata = &
frame->metadata;
82 "type:%c last_keyframe:%d\n",
83 s->frame, pblack,
frame->pts,
87 SET_META(
"lavfi.blackframe.pblack",
"%u", pblack);
95 #define OFFSET(x) offsetof(BlackFrameContext, x)
96 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
98 {
"amount",
"percentage of the pixels that have to be below the threshold "
100 {
"threshold",
"threshold below which a pixel value is considered black",
102 {
"thresh",
"threshold below which a pixel value is considered black",
118 .
name =
"blackframe",
121 .priv_class = &blackframe_class,
AVPixelFormat
Pixel format.
#define FILTER_PIXFMTS_ARRAY(array)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
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.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
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_OUTPUTS(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
@ AV_OPT_TYPE_INT
Underlying C type is int.
#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)
@ 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)