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++)
86 pblack = s->
nblack * 100 / (inlink->
w * inlink->
h);
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,
141 .
inputs = avfilter_vf_blackframe_inputs,
142 .
outputs = avfilter_vf_blackframe_outputs,
static const AVOption blackframe_options[]
This structure describes decoded (raw) audio or video data.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
unsigned int last_keyframe
frame number of the last received key-frame
Main libavfilter public API header.
int h
agreed upon image height
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.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
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.
AVDictionary * metadata
metadata.
A filter pad used for either input or output.
A link between two filters.
#define SET_META(key, format, value)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
common internal API header
as above, but U and V bytes are swapped
enum AVPictureType pict_type
Picture type of the frame.
AVFilter ff_vf_blackframe
unsigned int frame
frame number
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
unsigned int nblack
number of black pixels counted so far
#define AV_LOG_INFO
Standard information.
AVFILTER_DEFINE_CLASS(blackframe)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int bthresh
black threshold
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const AVFilterPad avfilter_vf_blackframe_outputs[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
AVFilterContext * dst
dest filter
int key_frame
1 -> keyframe, 0-> not
AVPixelFormat
Pixel format.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int query_formats(AVFilterContext *ctx)