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
ec1ef083
Commit
ec1ef083
authored
Mar 18, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add audio normalize script example.
parent
133035c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
normalize.py
tools/normalize.py
+33
-0
No files found.
tools/normalize.py
0 → 100755
View file @
ec1ef083
#!/usr/bin/env python2
import
sys
,
subprocess
if
len
(
sys
.
argv
)
>
1
:
ifile
=
sys
.
argv
[
1
]
encopt
=
sys
.
argv
[
2
:
-
1
]
ofile
=
sys
.
argv
[
-
1
]
else
:
print
'usage:
%
s <input> [encode_options] <output>'
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
analysis_cmd
=
'ffprobe -v error -of compact=p=0:nk=1 '
analysis_cmd
+=
'-show_entries frame_tags=lavfi.r128.I -f lavfi '
analysis_cmd
+=
"amovie='
%
s',ebur128=metadata=1"
%
ifile
try
:
probe_out
=
subprocess
.
check_output
(
analysis_cmd
,
shell
=
True
)
except
subprocess
.
CalledProcessError
,
e
:
sys
.
exit
(
e
.
returncode
)
loudness
=
ref
=
-
23
for
line
in
probe_out
.
splitlines
():
sline
=
line
.
rstrip
()
if
sline
:
loudness
=
sline
adjust
=
ref
-
float
(
loudness
)
if
abs
(
adjust
)
<
0.0001
:
print
'No normalization needed for '
+
ifile
else
:
print
"Adjust
%
s by
%.1
fdB"
%
(
ifile
,
adjust
)
norm_cmd
=
[
'ffmpeg'
,
'-i'
,
ifile
,
'-af'
,
'volume=
%
fdB'
%
adjust
]
norm_cmd
+=
encopt
+
[
ofile
]
print
' =>
%
s'
%
' '
.
join
(
norm_cmd
)
subprocess
.
call
(
norm_cmd
)
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