Go to the documentation of this file.
21 #define DEFAULT_RESULT_NAME "transforms.trf"
23 #include <vid.stab/libvidstab.h>
44 #define OFFSET(x) offsetof(StabData, x)
45 #define OFFSETC(x) (offsetof(StabData, conf)+offsetof(VSMotionDetectConfig, x))
46 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
50 {
"shakiness",
"how shaky is the video and how quick is the camera?"
53 {
"stepsize",
"region around minimum is scanned with 1 pixel resolution",
OFFSETC(stepSize),
AV_OPT_TYPE_INT, {.i64 = 6}, 1, 32,
FLAGS},
56 {
"tripod",
"virtual tripod mode (if >0): motion is compared to a reference"
67 s->class = &vidstabdetect_class;
75 VSMotionDetect *
md = &(
s->md);
82 vsMotionDetectionCleanup(
md);
90 VSMotionDetect*
md = &(
s->md);
101 if (fi.log2ChromaW !=
desc->log2_chroma_w) {
106 if (fi.log2ChromaH !=
desc->log2_chroma_h) {
113 s->conf.modName =
"vidstabdetect";
114 if (vsMotionDetectInit(
md, &
s->conf, &fi) != VS_OK) {
119 vsMotionDetectGetConfig(&
s->conf,
md);
134 if (vsPrepareFile(
md,
s->f) != VS_OK) {
146 VSMotionDetect *
md = &(
s->md);
147 LocalMotions localmotions;
156 for (plane = 0; plane <
md->fi.planes; plane++) {
160 if (vsMotionDetection(
md, &localmotions, &
frame) != VS_OK) {
164 if (vsWriteToFile(
md,
s->f, &localmotions) != VS_OK) {
169 vs_vector_del(&localmotions);
192 .
name =
"vidstabdetect",
194 "pass 1 of 2 for stabilization "
195 "(see vidstabtransform for pass 2)."),
203 .priv_class = &vidstabdetect_class,
const AVFilter ff_vf_vidstabdetect
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define FILTER_PIXFMTS_ARRAY(array)
#define DEFAULT_RESULT_NAME
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
This structure describes decoded (raw) audio or video data.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
#define AV_LOG_VERBOSE
Detailed information.
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const char * name
Filter name.
static const AVFilterPad avfilter_vf_vidstabdetect_outputs[]
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
VSPixelFormat ff_av2vs_pixfmt(AVFilterContext *ctx, enum AVPixelFormat pf)
convert AV's pixelformat to vid.stab pixelformat
enum AVPixelFormat ff_vidstab_pix_fmts[]
static av_cold int init(AVFilterContext *ctx)
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
static const AVFilterPad avfilter_vf_vidstabdetect_inputs[]
VSMotionDetectConfig conf
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
#define AVERROR_EXTERNAL
Generic error in an external library.
static int config_input(AVFilterLink *inlink)
static const AVOption vidstabdetect_options[]
#define AV_LOG_INFO
Standard information.
static av_cold void uninit(AVFilterContext *ctx)
const char * name
Pad name.
FILE * avpriv_fopen_utf8(const char *path, const char *mode)
Open a file using a UTF-8 filename.
AVFILTER_DEFINE_CLASS(vidstabdetect)
void ff_vs_init(void)
sets the memory allocation function and logging constants to av versions
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...