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
2fa01995
Commit
2fa01995
authored
Aug 04, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: add showfreqs filter
parent
e6b8797b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
750 additions
and
1 deletion
+750
-1
Changelog
Changelog
+1
-0
configure
configure
+2
-0
filters.texi
doc/filters.texi
+115
-0
Makefile
libavfilter/Makefile
+1
-0
allfilters.c
libavfilter/allfilters.c
+1
-0
avf_showfreqs.c
libavfilter/avf_showfreqs.c
+558
-0
version.h
libavfilter/version.h
+1
-1
audio_fifo.c
libavutil/audio_fifo.c
+19
-0
audio_fifo.h
libavutil/audio_fifo.h
+16
-0
fifo.c
libavutil/fifo.c
+26
-0
fifo.h
libavutil/fifo.h
+10
-0
No files found.
Changelog
View file @
2fa01995
...
@@ -31,6 +31,7 @@ version <next>:
...
@@ -31,6 +31,7 @@ version <next>:
- atadenoise video filter
- atadenoise video filter
- OS X VideoToolbox support
- OS X VideoToolbox support
- aphasemeter filter
- aphasemeter filter
- showfreqs filter
version 2.7:
version 2.7:
...
...
configure
View file @
2fa01995
...
@@ -2785,6 +2785,8 @@ select_filter_select="pixelutils"
...
@@ -2785,6 +2785,8 @@ select_filter_select="pixelutils"
smartblur_filter_deps
=
"gpl swscale"
smartblur_filter_deps
=
"gpl swscale"
showcqt_filter_deps
=
"avcodec"
showcqt_filter_deps
=
"avcodec"
showcqt_filter_select
=
"fft"
showcqt_filter_select
=
"fft"
showfreqs_filter_deps
=
"avcodec"
showfreqs_filter_select
=
"fft"
showspectrum_filter_deps
=
"avcodec"
showspectrum_filter_deps
=
"avcodec"
showspectrum_filter_select
=
"rdft"
showspectrum_filter_select
=
"rdft"
spp_filter_deps
=
"gpl avcodec"
spp_filter_deps
=
"gpl avcodec"
...
...
doc/filters.texi
View file @
2fa01995
...
@@ -12704,6 +12704,121 @@ gamma=2:gamma2=2
...
@@ -12704,6 +12704,121 @@ gamma=2:gamma2=2
@end itemize
@end itemize
@section showfreqs
Convert input audio to video output representing the audio power spectrum.
Audio amplitude is on Y-axis while frequency is on X-axis.
The filter accepts the following options:
@table @option
@item size, s
Specify size of video. For the syntax of this option, check the
@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
Default is @code{1024x512}.
@item mode
Set display mode.
This set how each frequency bin will be represented.
It accepts the following values:
@table @samp
@item line
@item bar
@item dot
@end table
Default is @code{bar}.
@item ascale
Set amplitude scale.
It accepts the following values:
@table @samp
@item lin
Linear scale.
@item sqrt
Square root scale.
@item cbrt
Cubic root scale.
@item log
Logarithmic scale.
@end table
Default is @code{log}.
@item fscale
Set frequency scale.
It accepts the following values:
@table @samp
@item lin
Linear scale.
@item log
Logarithmic scale.
@item rlog
Reverse logarithmic scale.
@end table
Default is @code{lin}.
@item win_size
Set window size.
It accepts the following values:
@table @samp
@item w16
@item w32
@item w64
@item w128
@item w256
@item w512
@item w1024
@item w2048
@item w4096
@item w8192
@item w16384
@item w32768
@item w65536
@end table
Default is @code{w2048}
@item win_func
Set windowing function.
It accepts the following values:
@table @samp
@item rect
@item bartlett
@item hanning
@item hamming
@item blackman
@item welch
@item flattop
@item bharris
@item bnuttall
@item bhann
@item sine
@item nuttall
@end table
Default is @code{hanning}.
@item overlap
Set window overlap. In range @code{[0, 1]}. Default is @code{1},
which means optimal overlap for selected window function will be picked.
@item averaging
Set time averaging. Setting this to 0 will display current maximal peaks.
Default is @code{1}, which means time averaging is disabled.
@item color
Specify list of colors separated by space or by '|' which will be used to
draw channel frequencies. Unrecognized or missing colors will be replaced
by white color.
@end table
@section showspectrum
@section showspectrum
Convert input audio to a video output, representing the audio frequency
Convert input audio to a video output, representing the audio frequency
...
...
libavfilter/Makefile
View file @
2fa01995
...
@@ -258,6 +258,7 @@ OBJS-$(CONFIG_APHASEMETER_FILTER) += avf_aphasemeter.o
...
@@ -258,6 +258,7 @@ OBJS-$(CONFIG_APHASEMETER_FILTER) += avf_aphasemeter.o
OBJS-$(CONFIG_AVECTORSCOPE_FILTER)
+=
avf_avectorscope.o
OBJS-$(CONFIG_AVECTORSCOPE_FILTER)
+=
avf_avectorscope.o
OBJS-$(CONFIG_CONCAT_FILTER)
+=
avf_concat.o
OBJS-$(CONFIG_CONCAT_FILTER)
+=
avf_concat.o
OBJS-$(CONFIG_SHOWCQT_FILTER)
+=
avf_showcqt.o
OBJS-$(CONFIG_SHOWCQT_FILTER)
+=
avf_showcqt.o
OBJS-$(CONFIG_SHOWFREQS_FILTER)
+=
avf_showfreqs.o
OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)
+=
avf_showspectrum.o
OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)
+=
avf_showspectrum.o
OBJS-$(CONFIG_SHOWVOLUME_FILTER)
+=
avf_showvolume.o
OBJS-$(CONFIG_SHOWVOLUME_FILTER)
+=
avf_showvolume.o
OBJS-$(CONFIG_SHOWWAVES_FILTER)
+=
avf_showwaves.o
OBJS-$(CONFIG_SHOWWAVES_FILTER)
+=
avf_showwaves.o
...
...
libavfilter/allfilters.c
View file @
2fa01995
...
@@ -273,6 +273,7 @@ void avfilter_register_all(void)
...
@@ -273,6 +273,7 @@ void avfilter_register_all(void)
REGISTER_FILTER
(
AVECTORSCOPE
,
avectorscope
,
avf
);
REGISTER_FILTER
(
AVECTORSCOPE
,
avectorscope
,
avf
);
REGISTER_FILTER
(
CONCAT
,
concat
,
avf
);
REGISTER_FILTER
(
CONCAT
,
concat
,
avf
);
REGISTER_FILTER
(
SHOWCQT
,
showcqt
,
avf
);
REGISTER_FILTER
(
SHOWCQT
,
showcqt
,
avf
);
REGISTER_FILTER
(
SHOWFREQS
,
showfreqs
,
avf
);
REGISTER_FILTER
(
SHOWSPECTRUM
,
showspectrum
,
avf
);
REGISTER_FILTER
(
SHOWSPECTRUM
,
showspectrum
,
avf
);
REGISTER_FILTER
(
SHOWVOLUME
,
showvolume
,
avf
);
REGISTER_FILTER
(
SHOWVOLUME
,
showvolume
,
avf
);
REGISTER_FILTER
(
SHOWWAVES
,
showwaves
,
avf
);
REGISTER_FILTER
(
SHOWWAVES
,
showwaves
,
avf
);
...
...
libavfilter/avf_showfreqs.c
0 → 100644
View file @
2fa01995
This diff is collapsed.
Click to expand it.
libavfilter/version.h
View file @
2fa01995
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 3
4
#define LIBAVFILTER_VERSION_MINOR 3
5
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavutil/audio_fifo.c
View file @
2fa01995
...
@@ -136,6 +136,25 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
...
@@ -136,6 +136,25 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
return
nb_samples
;
return
nb_samples
;
}
}
int
av_audio_fifo_peek
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
)
{
int
i
,
ret
,
size
;
if
(
nb_samples
<
0
)
return
AVERROR
(
EINVAL
);
nb_samples
=
FFMIN
(
nb_samples
,
af
->
nb_samples
);
if
(
!
nb_samples
)
return
0
;
size
=
nb_samples
*
af
->
sample_size
;
for
(
i
=
0
;
i
<
af
->
nb_buffers
;
i
++
)
{
if
((
ret
=
av_fifo_generic_peek
(
af
->
buf
[
i
],
data
[
i
],
size
,
NULL
))
<
0
)
return
AVERROR_BUG
;
}
return
nb_samples
;
}
int
av_audio_fifo_read
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
)
int
av_audio_fifo_read
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
)
{
{
int
i
,
ret
,
size
;
int
i
,
ret
,
size
;
...
...
libavutil/audio_fifo.h
View file @
2fa01995
...
@@ -93,6 +93,22 @@ int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
...
@@ -93,6 +93,22 @@ int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
*/
*/
int
av_audio_fifo_write
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
);
int
av_audio_fifo_write
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
);
/**
* Peek data from an AVAudioFifo.
*
* @see enum AVSampleFormat
* The documentation for AVSampleFormat describes the data layout.
*
* @param af AVAudioFifo to read from
* @param data audio data plane pointers
* @param nb_samples number of samples to peek
* @return number of samples actually peek, or negative AVERROR code
* on failure. The number of samples actually peek will not
* be greater than nb_samples, and will only be less than
* nb_samples if av_audio_fifo_size is less than nb_samples.
*/
int
av_audio_fifo_peek
(
AVAudioFifo
*
af
,
void
**
data
,
int
nb_samples
);
/**
/**
* Read data from an AVAudioFifo.
* Read data from an AVAudioFifo.
*
*
...
...
libavutil/fifo.c
View file @
2fa01995
...
@@ -148,6 +148,32 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
...
@@ -148,6 +148,32 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
return
total
-
size
;
return
total
-
size
;
}
}
int
av_fifo_generic_peek
(
AVFifoBuffer
*
f
,
void
*
dest
,
int
buf_size
,
void
(
*
func
)(
void
*
,
void
*
,
int
))
{
// Read memory barrier needed for SMP here in theory
uint8_t
*
rptr
=
f
->
rptr
;
uint32_t
rndx
=
f
->
rndx
;
do
{
int
len
=
FFMIN
(
f
->
end
-
f
->
rptr
,
buf_size
);
if
(
func
)
func
(
dest
,
f
->
rptr
,
len
);
else
{
memcpy
(
dest
,
f
->
rptr
,
len
);
dest
=
(
uint8_t
*
)
dest
+
len
;
}
// memory barrier needed for SMP here in theory
av_fifo_drain
(
f
,
len
);
buf_size
-=
len
;
}
while
(
buf_size
>
0
);
f
->
rptr
=
rptr
;
f
->
rndx
=
rndx
;
return
0
;
}
int
av_fifo_generic_read
(
AVFifoBuffer
*
f
,
void
*
dest
,
int
buf_size
,
int
av_fifo_generic_read
(
AVFifoBuffer
*
f
,
void
*
dest
,
int
buf_size
,
void
(
*
func
)(
void
*
,
void
*
,
int
))
void
(
*
func
)(
void
*
,
void
*
,
int
))
{
{
...
...
libavutil/fifo.h
View file @
2fa01995
...
@@ -83,6 +83,16 @@ int av_fifo_size(const AVFifoBuffer *f);
...
@@ -83,6 +83,16 @@ int av_fifo_size(const AVFifoBuffer *f);
*/
*/
int
av_fifo_space
(
const
AVFifoBuffer
*
f
);
int
av_fifo_space
(
const
AVFifoBuffer
*
f
);
/**
* Feed data from an AVFifoBuffer to a user-supplied callback.
* Similar as av_fifo_gereric_read but without discarding data.
* @param f AVFifoBuffer to read from
* @param buf_size number of bytes to read
* @param func generic read function
* @param dest data destination
*/
int
av_fifo_generic_peek
(
AVFifoBuffer
*
f
,
void
*
dest
,
int
buf_size
,
void
(
*
func
)(
void
*
,
void
*
,
int
));
/**
/**
* Feed data from an AVFifoBuffer to a user-supplied callback.
* Feed data from an AVFifoBuffer to a user-supplied callback.
* @param f AVFifoBuffer to read from
* @param f AVFifoBuffer to read from
...
...
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