34 #include "libavutil/opt.h"
69 for (i = 0; i < frame->
height; i++) {
70 for (x = 0; x < inlink->
w; x++)
78 pblack = s->
nblack * 100 / (inlink->
w * inlink->
h);
81 "type:%c last_keyframe:%d\n",
91 #define OFFSET(x) offsetof(BlackFrameContext, x)
92 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
94 {
"amount",
"Percentage of the pixels that have to be below the threshold "
96 {
"threshold",
"threshold below which a pixel value is considered black",
98 {
"thresh",
"threshold below which a pixel value is considered black",
123 .
name =
"blackframe",
126 .priv_class = &blackframe_class,
128 .
inputs = avfilter_vf_blackframe_inputs,
129 .
outputs = avfilter_vf_blackframe_outputs,
static const AVOption blackframe_options[]
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
void * priv
private data for use by the filter
static const AVFilterPad outputs[]
unsigned int last_keyframe
frame number of the last received key-frame
int h
agreed upon image height
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static const AVFilterPad avfilter_vf_blackframe_inputs[]
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
as above, but U and V bytes are swapped
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static double av_q2d(AVRational a)
Convert rational to double.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
A filter pad used for either input or output.
A link between two filters.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVPixelFormat
Pixel format.
int w
agreed upon image width
common internal API header
enum AVPictureType pict_type
Picture type of the frame.
unsigned int frame
frame number
Main libavfilter public API header.
AVFilterLink ** outputs
array of pointers to output links
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
unsigned int nblack
number of black pixels counted so far
#define AV_LOG_INFO
Standard information.
int bthresh
black threshold
AVFilter avfilter_vf_blackframe
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVFilterContext * dst
dest filter
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
static const AVFilterPad avfilter_vf_blackframe_outputs[]
#define AVFILTER_DEFINE_CLASS(fname)
int key_frame
1 -> keyframe, 0-> not
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int query_formats(AVFilterContext *ctx)