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 sd->
class = &vidstabdetect_class;
75 VSMotionDetect *
md = &(sd->
md);
82 vsMotionDetectionCleanup(md);
105 VSMotionDetect*
md = &(sd->
md);
111 av_log(ctx,
AV_LOG_ERROR,
"pixel-format error: wrong bits/per/pixel, please report a BUG");
126 sd->
conf.modName =
"vidstabdetect";
127 if (vsMotionDetectInit(md, &sd->
conf, &fi) != VS_OK) {
128 av_log(ctx,
AV_LOG_ERROR,
"initialization of Motion Detection failed, please report a BUG");
132 vsMotionDetectGetConfig(&sd->
conf, md);
141 sd->
f = fopen(sd->
result,
"w");
146 if (vsPrepareFile(md, sd->
f) != VS_OK) {
159 VSMotionDetect *
md = &(sd->
md);
160 LocalMotions localmotions;
169 for (plane = 0; plane < md->fi.planes; plane++) {
170 frame.data[plane] = in->
data[plane];
171 frame.linesize[plane] = in->
linesize[plane];
173 if (vsMotionDetection(md, &localmotions, &frame) != VS_OK) {
177 if (vsWriteToFile(md, sd->
f, &localmotions) != VS_OK) {
181 vs_vector_del(&localmotions);
206 .
name =
"vidstabdetect",
208 "pass 1 of 2 for stabilization "
209 "(see vidstabtransform for pass 2)."),
214 .
inputs = avfilter_vf_vidstabdetect_inputs,
215 .
outputs = avfilter_vf_vidstabdetect_outputs,
216 .priv_class = &vidstabdetect_class,