Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
386dc9a3
Commit
386dc9a3
authored
Mar 24, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/thumbnail: add support for named options.
parent
3b811bcf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
17 deletions
+36
-17
filters.texi
doc/filters.texi
+19
-5
version.h
libavfilter/version.h
+1
-1
vf_thumbnail.c
libavfilter/vf_thumbnail.c
+16
-11
No files found.
doc/filters.texi
View file @
386dc9a3
...
...
@@ -5251,22 +5251,36 @@ Swap U & V plane.
@section thumbnail
Select the most representative frame in a given sequence of consecutive frames.
It accepts as argument the frames batch size to analyze (default @var{N}=100);
in a set of @var{N} frames, the filter will pick one of them, and then handle
the next batch of @var{N} frames until the end.
The filter accepts parameters as a list of @var{key}=@var{value}
pairs, separated by ":". If the key of the first options is omitted,
the arguments are interpreted according to the syntax
thumbnail[=@var{n}].
@table @option
@item n
Set the frames batch size to analyze; in a set of @var{n} frames, the filter
will pick one of them, and then handle the next batch of @var{n} frames until
the end. Default is @code{100}.
@end table
Since the filter keeps track of the whole frames sequence, a bigger @var{
N
}
Since the filter keeps track of the whole frames sequence, a bigger @var{
n
}
value will result in a higher memory usage, so a high value is not recommended.
The following example extract one picture each 50 frames:
@subsection Examples
@itemize
@item
Extract one picture each 50 frames:
@example
thumbnail=50
@end example
@item
Complete example of a thumbnail creation with @command{ffmpeg}:
@example
ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
@end example
@end itemize
@section tile
...
...
libavfilter/version.h
View file @
386dc9a3
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 48
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vf_thumbnail.c
View file @
386dc9a3
...
...
@@ -27,6 +27,7 @@
* @see http://notbrainsurgery.livejournal.com/29773.html
*/
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
...
...
@@ -38,27 +39,27 @@ struct thumb_frame {
};
typedef
struct
{
const
AVClass
*
class
;
int
n
;
///< current frame
int
n_frames
;
///< number of frames for analysis
struct
thumb_frame
*
frames
;
///< the n_frames frames
AVRational
tb
;
///< copy of the input timebase to ease access
}
ThumbContext
;
#define OFFSET(x) offsetof(ThumbContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
thumbnail_options
[]
=
{
{
"n"
,
"set the frames batch size"
,
OFFSET
(
n_frames
),
AV_OPT_TYPE_INT
,
{.
i64
=
100
},
2
,
INT_MAX
,
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
thumbnail
);
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
ThumbContext
*
thumb
=
ctx
->
priv
;
if
(
!
args
)
{
thumb
->
n_frames
=
100
;
}
else
{
int
n
=
sscanf
(
args
,
"%d"
,
&
thumb
->
n_frames
);
if
(
n
!=
1
||
thumb
->
n_frames
<
2
)
{
thumb
->
n_frames
=
0
;
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid number of frames specified (minimum is 2).
\n
"
);
return
AVERROR
(
EINVAL
);
}
}
thumb
->
frames
=
av_calloc
(
thumb
->
n_frames
,
sizeof
(
*
thumb
->
frames
));
if
(
!
thumb
->
frames
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
...
...
@@ -226,6 +227,8 @@ static const AVFilterPad thumbnail_outputs[] = {
{
NULL
}
};
static
const
char
*
const
shorthand
[]
=
{
"n"
,
NULL
};
AVFilter
avfilter_vf_thumbnail
=
{
.
name
=
"thumbnail"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Select the most representative frame in a given sequence of consecutive frames."
),
...
...
@@ -235,4 +238,6 @@ AVFilter avfilter_vf_thumbnail = {
.
query_formats
=
query_formats
,
.
inputs
=
thumbnail_inputs
,
.
outputs
=
thumbnail_outputs
,
.
priv_class
=
&
thumbnail_class
,
.
shorthand
=
shorthand
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment