Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
fbedce6b
Commit
fbedce6b
authored
Oct 09, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/silencedetect: export silence info to metadata.
parent
de23953d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
af_silencedetect.c
libavfilter/af_silencedetect.c
+19
-5
version.h
libavfilter/version.h
+1
-1
filter.mak
tests/fate/filter.mak
+4
-0
filter-metadata-silencedetect
tests/ref/fate/filter-metadata-silencedetect
+0
-0
No files found.
libavfilter/af_silencedetect.c
View file @
fbedce6b
...
...
@@ -78,6 +78,12 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return
0
;
}
static
char
*
get_metadata_val
(
AVFilterBufferRef
*
insamples
,
const
char
*
key
)
{
AVDictionaryEntry
*
e
=
av_dict_get
(
insamples
->
metadata
,
key
,
NULL
,
0
);
return
e
&&
e
->
value
?
e
->
value
:
NULL
;
}
static
int
filter_samples
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
insamples
)
{
int
i
;
...
...
@@ -94,6 +100,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
silence
->
last_sample_rate
=
srate
;
// TODO: support more sample formats
// TODO: document metadata
if
(
insamples
->
format
==
AV_SAMPLE_FMT_DBL
)
{
double
*
p
=
(
double
*
)
insamples
->
data
[
0
];
...
...
@@ -103,16 +110,23 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
silence
->
nb_null_samples
++
;
if
(
silence
->
nb_null_samples
>=
nb_samples_notify
)
{
silence
->
start
=
insamples
->
pts
-
(
int64_t
)(
silence
->
duration
/
av_q2d
(
inlink
->
time_base
)
+
.
5
);
av_log
(
silence
,
AV_LOG_INFO
,
"silence_start: %s
\n
"
,
av_ts2timestr
(
silence
->
start
,
&
inlink
->
time_base
));
av_dict_set
(
&
insamples
->
metadata
,
"lavfi.silence_start"
,
av_ts2timestr
(
silence
->
start
,
&
inlink
->
time_base
),
0
);
av_log
(
silence
,
AV_LOG_INFO
,
"silence_start: %s
\n
"
,
get_metadata_val
(
insamples
,
"lavfi.silence_start"
));
}
}
}
else
{
if
(
silence
->
start
)
if
(
silence
->
start
)
{
av_dict_set
(
&
insamples
->
metadata
,
"lavfi.silence_end"
,
av_ts2timestr
(
insamples
->
pts
,
&
inlink
->
time_base
),
0
);
av_dict_set
(
&
insamples
->
metadata
,
"lavfi.silence_duration"
,
av_ts2timestr
(
insamples
->
pts
-
silence
->
start
,
&
inlink
->
time_base
),
0
);
av_log
(
silence
,
AV_LOG_INFO
,
"silence_end: %s | silence_duration: %s
\n
"
,
av_ts2timestr
(
insamples
->
pts
,
&
inlink
->
time_base
),
av_ts2timestr
(
insamples
->
pts
-
silence
->
start
,
&
inlink
->
time_base
));
get_metadata_val
(
insamples
,
"lavfi.silence_end"
),
get_metadata_val
(
insamples
,
"lavfi.silence_duration"
));
}
silence
->
nb_null_samples
=
silence
->
start
=
0
;
}
}
...
...
libavfilter/version.h
View file @
fbedce6b
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 20
#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, \
...
...
tests/fate/filter.mak
View file @
fbedce6b
...
...
@@ -53,6 +53,10 @@ FATE_FILTER-$(call ALLYES, FFPROBE LAVFI_INDEV MOVIE_FILTER SELECT_FILTER AVCODE
fate-filter-metadata-scenedetect: SRC = $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov
fate-filter-metadata-scenedetect: CMD = run $(FILTER_METADATA_COMMAND) "movie=$(SRC),select=gt(scene\,.4)"
FATE_FILTER-$(call ALLYES, FFPROBE LAVFI_INDEV AMOVIE_FILTER AMR_DEMUXER AMRWB_DECODER) += fate-filter-metadata-silencedetect
fate-filter-metadata-silencedetect: SRC = $(SAMPLES)/amrwb/seed-12k65.awb
fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie=$(SRC),silencedetect=d=.1"
FATE_SAMPLES_AVCONV += $(FATE_FILTER-yes)
fate-filter: $(FATE_FILTER-yes)
tests/ref/fate/filter-metadata-silencedetect
0 → 100644
View file @
fbedce6b
This diff is collapsed.
Click to expand it.
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