FFmpeg
Loading...
Searching...
No Matches
vf_blackframe.c File Reference

Search for black frames to detect scene transitions. More...

#include <stdio.h>
#include <inttypes.h>
#include <stdatomic.h>
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BlackFrameContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

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

Functions

static int blackframe_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
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 []
 
const FFFilter 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)
static const char *const format[]
Definition af_aiir.c:444
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
double value
Definition eval.c:102
const char * key
#define snprintf
Definition snprintf.h:34

Definition at line 64 of file vf_blackframe.c.

Referenced by filter_frame().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 130 of file vf_blackframe.c.

◆ FLAGS

Definition at line 131 of file vf_blackframe.c.

Function Documentation

◆ blackframe_slice()

static int blackframe_slice ( AVFilterContext * ctx,
void * arg,
int jobnr,
int nb_jobs )
static

Definition at line 68 of file vf_blackframe.c.

Referenced by filter_frame().

◆ filter_frame()

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

Definition at line 88 of file vf_blackframe.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blackframe )

Variable Documentation

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ 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:96
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition pixfmt.h:97
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78

Definition at line 58 of file vf_blackframe.c.

◆ 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 }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 132 of file vf_blackframe.c.

◆ avfilter_vf_blackframe_inputs

const AVFilterPad avfilter_vf_blackframe_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 144 of file vf_blackframe.c.

◆ ff_vf_blackframe

const FFFilter ff_vf_blackframe
Initial value:
= {
.p.name = "blackframe",
.p.description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),
.p.priv_class = &blackframe_class,
.priv_size = sizeof(BlackFrameContext),
}
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:182
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
static const AVFilterPad avfilter_vf_blackframe_inputs[]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 152 of file vf_blackframe.c.