Go to the documentation of this file.
63 #define SET_META(key, format, value) \
64 snprintf(buf, sizeof(buf), format, value); \
65 av_dict_set(metadata, key, buf, 0)
77 for (
i = 0;
i <
frame->height;
i++) {
78 for (x = 0; x <
inlink->w; x++)
79 s->nblack += p[x] <
s->bthresh;
80 p +=
frame->linesize[0];
84 s->last_keyframe =
s->frame;
87 if (pblack >=
s->bamount) {
88 metadata = &
frame->metadata;
91 "type:%c last_keyframe:%d\n",
92 s->frame, pblack,
frame->pts,
96 SET_META(
"lavfi.blackframe.pblack",
"%u", pblack);
104 #define OFFSET(x) offsetof(BlackFrameContext, x)
105 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
107 {
"amount",
"percentage of the pixels that have to be below the threshold "
109 {
"threshold",
"threshold below which a pixel value is considered black",
111 {
"thresh",
"threshold below which a pixel value is considered black",
136 .
name =
"blackframe",
139 .priv_class = &blackframe_class,
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
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
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
A filter pad used for either input or output.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static const AVFilterPad outputs[]
static enum AVPixelFormat pix_fmts[]
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Describe the class of an AVClass context structure.
#define SET_META(key, format, value)
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 inputs
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)
AVFilter ff_vf_blackframe
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
static int query_formats(AVFilterContext *ctx)
@ 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)
@ 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)