FFmpeg
Data Structures | Macros | Functions | Variables
vf_blackframe.c File Reference
#include <stdio.h>
#include <inttypes.h>
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BlackFrameContext
 

Macros

#define SET_META(key, format, value)
 
#define OFFSET(x)   offsetof(BlackFrameContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
 AVFILTER_DEFINE_CLASS (blackframe)
 

Variables

static enum AVPixelFormat pix_fmts []
 
static const AVOption blackframe_options []
 
static const AVFilterPad avfilter_vf_blackframe_inputs []
 
static const AVFilterPad avfilter_vf_blackframe_outputs []
 
const AVFilter ff_vf_blackframe
 

Detailed Description

Search for black frames to detect scene transitions. Ported from MPlayer libmpcodecs/vf_blackframe.c.

Definition in file vf_blackframe.c.

Macro Definition Documentation

◆ SET_META

#define SET_META (   key,
  format,
  value 
)
Value:
snprintf(buf, sizeof(buf), format, value); \
av_dict_set(metadata, key, buf, 0)

Definition at line 55 of file vf_blackframe.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(BlackFrameContext, x)

Definition at line 96 of file vf_blackframe.c.

◆ FLAGS

Definition at line 97 of file vf_blackframe.c.

Function Documentation

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 59 of file vf_blackframe.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blackframe  )

Variable Documentation

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ blackframe_options

const AVOption blackframe_options[]
static
Initial value:
= {
{ "amount", "percentage of the pixels that have to be below the threshold "
"for the frame to be considered black", OFFSET(bamount), AV_OPT_TYPE_INT, { .i64 = 98 }, 0, 100, FLAGS },
{ "threshold", "threshold below which a pixel value is considered black",
OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255, FLAGS },
{ "thresh", "threshold below which a pixel value is considered black",
OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255, FLAGS },
{ NULL }
}

Definition at line 98 of file vf_blackframe.c.

◆ avfilter_vf_blackframe_inputs

const AVFilterPad avfilter_vf_blackframe_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}

Definition at line 110 of file vf_blackframe.c.

◆ avfilter_vf_blackframe_outputs

const AVFilterPad avfilter_vf_blackframe_outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 118 of file vf_blackframe.c.

◆ ff_vf_blackframe

const AVFilter ff_vf_blackframe
Initial value:
= {
.name = "blackframe",
.description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),
.priv_size = sizeof(BlackFrameContext),
.priv_class = &blackframe_class,
}

Definition at line 125 of file vf_blackframe.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
avfilter_vf_blackframe_outputs
static const AVFilterPad avfilter_vf_blackframe_outputs[]
Definition: vf_blackframe.c:118
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_blackframe.c:59
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_blackframe.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
key
const char * key
Definition: hwcontext_opencl.c:168
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
NULL
#define NULL
Definition: coverity.c:32
avfilter_vf_blackframe_inputs
static const AVFilterPad avfilter_vf_blackframe_inputs[]
Definition: vf_blackframe.c:110
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
format
ofilter format
Definition: ffmpeg_filter.c:172
FLAGS
#define FLAGS
Definition: vf_blackframe.c:97
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
AV_PIX_FMT_NV21
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition: pixfmt.h:90
OFFSET
#define OFFSET(x)
Definition: vf_blackframe.c:96
AV_PIX_FMT_NV12
@ 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...
Definition: pixfmt.h:89
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:137
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
BlackFrameContext
Definition: vf_blackframe.c:40
snprintf
#define snprintf
Definition: snprintf.h:34