From 3dc494f8b94bc89884ce8aee96b485b963094aa6 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 16 Jan 2014 13:08:36 +0100 Subject: lavfi/vidstabtransform: apply various documentation/option minor fixes Improve consistency with the rest of the documentation. --- doc/filters.texi | 116 +++++++++++++++++--------------------- libavfilter/vf_vidstabtransform.c | 32 ++++++----- 2 files changed, 71 insertions(+), 77 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 64dd084..242602c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -8136,23 +8136,27 @@ the unsharp filter, see below. To enable compilation of this filter you need to configure FFmpeg with @code{--enable-libvidstab}. -This filter accepts the following options: +@subsection Options @table @option - @item input -path to the file used to read the transforms (default: @file{transforms.trf}) +Set path to the file used to read the transforms. Default value is +@file{transforms.trf}). @item smoothing -Set the number of frames (value*2 + 1) used for lowpass filtering the camera movements -(default: 10). For example a number of 10 means that 21 frames are used -(10 in the past and 10 in the future) to smoothen the motion in the -video. A larger values leads to a smoother video, but limits the -acceleration of the camera (pan/tilt movements). -0 is a special case where a static camera is simulated. +Set the number of frames (value*2 + 1) used for lowpass filtering the +camera movements. Default value is 10. + +For example a number of 10 means that 21 frames are used (10 in the +past and 10 in the future) to smoothen the motion in the video. A +larger values leads to a smoother video, but limits the acceleration +of the camera (pan/tilt movements). 0 is a special case where a +static camera is simulated. @item optalgo -Set the camera path optimization algorithm: +Set the camera path optimization algorithm. + +Accepted values are: @table @samp @item gauss gaussian kernel low-pass filter on camera motion (default) @@ -8161,16 +8165,18 @@ averaging on transformations @end table @item maxshift -maximal number of pixels to translate frames (default: -1 no limit) +Set maximal number of pixels to translate frames. Default value is -1, +meaning no limit. @item maxangle -maximal angle in radians (degree*PI/180) to rotate frames (default: -1 -no limit) +Set maximal angle in radians (degree*PI/180) to rotate frames. Default +value is -1, meaning no limit. @item crop -How to deal with borders that may be visible due to movement -compensation. Available values are: +Specify how to deal with borders that may be visible due to movement +compensation. +Available values are: @table @samp @item keep keep image information from previous frame (default) @@ -8179,49 +8185,41 @@ fill the border black @end table @item invert -@table @samp -@item 0 -keep transforms normal (default) -@item 1 -invert transforms -@end table +Invert transforms if set to 1. Default value is 0. @item relative -consider transforms as -@table @samp -@item 0 -absolute -@item 1 -relative to previous frame (default) -@end table +Consider transforms as relative to previsou frame if set to 1, +absolute if set to 0. Default value is 0. @item zoom -Set percentage to zoom (default: 0) -@table @samp -@item >0 -zoom in -@item <0 -zoom out -@end table +Set percentage to zoom. A positive value will result in a zoom-in +effect, a negative value in a zoom-out effect. Default value is 0 (no +zoom). @item optzoom -Set optimal zooming to avoid borders +Set optimal zooming to avoid borders. + +Accepted values are: @table @samp @item 0 disabled @item 1 -optimal static zoom value is determined (only very strong movements will lead to visible borders) (default) +optimal static zoom value is determined (only very strong movements +will lead to visible borders) (default) @item 2 -optimal adaptive zoom value is determined (no borders will be visible), see @option{zoomspeed} +optimal adaptive zoom value is determined (no borders will be +visible), see @option{zoomspeed} @end table -Note that the value given at zoom is added to the one calculated -here. + +Note that the value given at zoom is added to the one calculated here. @item zoomspeed -Set percent to zoom maximally each frame (for @option{optzoom=2}). Range is from 0 to 5, default value is 0.2 +Set percent to zoom maximally each frame (enabled when +@option{optzoom} is set to 2). Range is from 0 to 5, default value is +0.25. @item interpol -type of interpolation +Specify type of interpolation. Available values are: @table @samp @@ -8236,49 +8234,39 @@ cubic in both directions (slow) @end table @item tripod -virtual tripod mode means that the video is stabilized such that the -camera stays stationary. Use also @code{tripod} option of -@ref{vidstabdetect}. -@table @samp -@item 0 -off (default) -@item 1 -virtual tripod mode: equivalent to @code{relative=0:smoothing=0} -@end table +Enable virtual tripod mode if set to 1, which is equivalent to +@code{relative=0:smoothing=0}. Default value is 0. -@item debug -Increase log verbosity of set to 1. Also the detected global motions are written to the temporary file @file{global_motions.trf}. -@table @samp -@item 0 -disabled (default) -@item 1 -enabled -@end table +Use also @code{tripod} option of @ref{vidstabdetect}. +@item debug +Increase log verbosity if set to 1. Also the detected global motions +are written to the temporary file @file{global_motions.trf}. Default +value is 0. @end table @subsection Examples @itemize @item -typical call with default default values: - (note the unsharp filter which is always recommended) +Use @command{ffmpeg} for a typical stabilization with default values: @example ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg @end example +Note the use of the unsharp filter which is always recommended. + @item -zoom in a bit more and load transform data from a given file +Zoom in a bit more and load transform data from a given file: @example vidstabtransform=zoom=5:input="mytransforms.trf" @end example @item -smoothen the video even more +Smoothen the video even more: @example vidstabtransform=smoothing=30 @end example - @end itemize @section vflip diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index e31c0a6..80968ae 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -47,11 +47,12 @@ typedef struct { #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption vidstabtransform_options[] = { - {"input", "path to the file storing the transforms", OFFSET(input), + {"input", "set path to the file storing the transforms", OFFSET(input), AV_OPT_TYPE_STRING, {.str = DEFAULT_INPUT_NAME}, .flags = FLAGS }, - {"smoothing", "number of frames*2 + 1 used for lowpass filtering", OFFSETC(smoothing), + {"smoothing", "set number of frames*2 + 1 used for lowpass filtering", OFFSETC(smoothing), AV_OPT_TYPE_INT, {.i64 = 15}, 0, 1000, FLAGS}, - {"optalgo", "camera path optimization algo", OFFSETC(camPathAlgo), + + {"optalgo", "set camera path optimization algo", OFFSETC(camPathAlgo), AV_OPT_TYPE_INT, {.i64 = VSOptimalL1}, VSOptimalL1, VSAvg, FLAGS, "optalgo"}, { "opt", "global optimization", 0, // from version 1.0 on AV_OPT_TYPE_CONST, {.i64 = VSOptimalL1 }, 0, 0, FLAGS, "optalgo"}, @@ -59,27 +60,31 @@ static const AVOption vidstabtransform_options[] = { AV_OPT_TYPE_CONST, {.i64 = VSGaussian }, 0, 0, FLAGS, "optalgo"}, { "avg", "simple averaging on motion", 0, AV_OPT_TYPE_CONST, {.i64 = VSAvg }, 0, 0, FLAGS, "optalgo"}, - {"maxshift", "maximal number of pixels to translate image", OFFSETC(maxShift), + + {"maxshift", "set maximal number of pixels to translate image", OFFSETC(maxShift), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 500, FLAGS}, - {"maxangle", "maximal angle in rad to rotate image", OFFSETC(maxAngle), + {"maxangle", "set maximal angle in rad to rotate image", OFFSETC(maxAngle), AV_OPT_TYPE_DOUBLE, {.dbl = -1.0}, -1.0, 3.14, FLAGS}, - {"crop", "set cropping mode", OFFSETC(crop), + + {"crop", "set cropping mode", OFFSETC(crop), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS, "crop"}, { "keep", "keep border", 0, AV_OPT_TYPE_CONST, {.i64 = VSKeepBorder }, 0, 0, FLAGS, "crop"}, { "black", "black border", 0, AV_OPT_TYPE_CONST, {.i64 = VSCropBorder }, 0, 0, FLAGS, "crop"}, - {"invert", "1: invert transforms", OFFSETC(invert), + + {"invert", "invert transforms", OFFSETC(invert), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, - {"relative", "consider transforms as 0: absolute, 1: relative", OFFSETC(relative), + {"relative", "consider transforms as relative", OFFSETC(relative), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, FLAGS}, - {"zoom", "percentage to zoom >0: zoom in, <0 zoom out", OFFSETC(zoom), + {"zoom", "set percentage to zoom (>0: zoom in, <0: zoom out", OFFSETC(zoom), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, -100, 100, FLAGS}, - {"optzoom", "0: nothing, 1: optimal static zoom, 2: optimal dynamic zoom", OFFSETC(optZoom), + {"optzoom", "set optimal zoom (0: nothing, 1: optimal static zoom, 2: optimal dynamic zoom)", OFFSETC(optZoom), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 2, FLAGS}, {"zoomspeed", "for adative zoom: percent to zoom maximally each frame", OFFSETC(zoomSpeed), AV_OPT_TYPE_DOUBLE, {.dbl = 0.25}, 0, 5, FLAGS}, - {"interpol", "type of interpolation", OFFSETC(interpolType), + + {"interpol", "set type of interpolation", OFFSETC(interpolType), AV_OPT_TYPE_INT, {.i64 = 2}, 0, 3, FLAGS, "interpol"}, { "no", "no interpolation", 0, AV_OPT_TYPE_CONST, {.i64 = VS_Zero }, 0, 0, FLAGS, "interpol"}, @@ -89,9 +94,10 @@ static const AVOption vidstabtransform_options[] = { AV_OPT_TYPE_CONST, {.i64 = VS_BiLinear},0, 0, FLAGS, "interpol"}, { "bicubic", "bi-cubic", 0, AV_OPT_TYPE_CONST, {.i64 = VS_BiCubic },0, 0, FLAGS, "interpol"}, - {"tripod", "if 1: virtual tripod mode (equiv. to relative=0:smoothing=0)", OFFSET(tripod), + + {"tripod", "enable virtual tripod mode (same as relative=0:smoothing=0)", OFFSET(tripod), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, - {"debug", "if 1: more output printed and global motions are stored to file",OFFSET(debug), + {"debug", "enable debug mode and writer global motions information to file", OFFSET(debug), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, {NULL} }; -- cgit v1.1