63 #define SET_META(key, format, value) \
64 snprintf(buf, sizeof(buf), format, value); \
65 av_dict_set(metadata, key, buf, 0)
78 for (x = 0; x < inlink->
w; x++)
79 s->nblack += p[x] <
s->bthresh;
84 s->last_keyframe =
s->frame;
86 pblack =
s->nblack * 100 / (inlink->
w * inlink->
h);
87 if (pblack >=
s->bamount) {
91 "type:%c last_keyframe:%d\n",
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,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define AV_LOG_INFO
Standard information.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
AVPixelFormat
Pixel format.
@ 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...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Describe the class of an AVClass context structure.
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int key_frame
1 -> keyframe, 0-> not
AVDictionary * metadata
metadata.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
enum AVPictureType pict_type
Picture type of the frame.
unsigned int last_keyframe
frame number of the last received key-frame
unsigned int frame
frame number
unsigned int nblack
number of black pixels counted so far
int bthresh
black threshold
AVFILTER_DEFINE_CLASS(blackframe)
static int query_formats(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static const AVFilterPad avfilter_vf_blackframe_inputs[]
AVFilter ff_vf_blackframe
#define SET_META(key, format, value)
static const AVOption blackframe_options[]
static const AVFilterPad avfilter_vf_blackframe_outputs[]