ffmpeg-normalize 1.32.2__tar.gz → 1.33.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ffmpeg_normalize-1.33.1/LICENSE.md +9 -0
- ffmpeg_normalize-1.33.1/PKG-INFO +120 -0
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1}/README.md +8 -5
- ffmpeg_normalize-1.33.1/pyproject.toml +67 -0
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/__init__.py +4 -1
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/__main__.py +23 -3
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_cmd_utils.py +3 -3
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_ffmpeg_normalize.py +1 -1
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_media_file.py +23 -3
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_streams.py +23 -1
- ffmpeg_normalize-1.32.2/CHANGELOG.md +0 -1310
- ffmpeg_normalize-1.32.2/LICENSE +0 -21
- ffmpeg_normalize-1.32.2/PKG-INFO +0 -1423
- ffmpeg_normalize-1.32.2/ffmpeg_normalize/_version.py +0 -1
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/PKG-INFO +0 -1423
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/SOURCES.txt +0 -26
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/dependency_links.txt +0 -1
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/entry_points.txt +0 -2
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/not-zip-safe +0 -1
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/requires.txt +0 -7
- ffmpeg_normalize-1.32.2/ffmpeg_normalize.egg-info/top_level.txt +0 -1
- ffmpeg_normalize-1.32.2/setup.cfg +0 -18
- ffmpeg_normalize-1.32.2/setup.py +0 -64
- ffmpeg_normalize-1.32.2/test/out.mp4 +0 -0
- ffmpeg_normalize-1.32.2/test/test.mp4 +0 -0
- ffmpeg_normalize-1.32.2/test/test.py +0 -489
- ffmpeg_normalize-1.32.2/test/test.wav +0 -0
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_errors.py +0 -0
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_logger.py +0 -0
- {ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/py.typed +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
ffmpeg-normalize, Copyright (c) Werner Robitza
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ffmpeg-normalize
|
|
3
|
+
Version: 1.33.1
|
|
4
|
+
Summary: Normalize audio via ffmpeg
|
|
5
|
+
Keywords: ffmpeg,normalize,audio
|
|
6
|
+
Author: Werner Robitza
|
|
7
|
+
Author-email: Werner Robitza <werner.robitza@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
13
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
14
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Dist: tqdm>=4.64.1
|
|
24
|
+
Requires-Dist: colorama>=0.4.6 ; sys_platform == 'win32'
|
|
25
|
+
Requires-Dist: ffmpeg-progress-yield>=1.0.1
|
|
26
|
+
Requires-Dist: colorlog==6.7.0
|
|
27
|
+
Requires-Dist: mutagen>=1.47.0
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Project-URL: Homepage, https://github.com/slhck/ffmpeg-normalize
|
|
30
|
+
Project-URL: Repository, https://github.com/slhck/ffmpeg-normalize
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# ffmpeg-normalize
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/ffmpeg-normalize)
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
40
|
+
[](#contributors-)
|
|
41
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
42
|
+
|
|
43
|
+
A utility for batch-normalizing audio using ffmpeg.
|
|
44
|
+
|
|
45
|
+
This program normalizes media files to a certain loudness level using the EBU R128 loudness normalization procedure. It can also perform RMS-based normalization (where the mean is lifted or attenuated), or peak normalization to a certain target level.
|
|
46
|
+
|
|
47
|
+
## ✨ Features
|
|
48
|
+
|
|
49
|
+
- EBU R128 loudness normalization (two-pass by default, with an option for one-pass dynamic normalization)
|
|
50
|
+
- RMS-based normalization
|
|
51
|
+
- Peak normalization
|
|
52
|
+
- Video file support
|
|
53
|
+
- Docker support
|
|
54
|
+
- Python API
|
|
55
|
+
|
|
56
|
+
## 🚀 Quick Start
|
|
57
|
+
|
|
58
|
+
1. Install a recent version of [ffmpeg](https://ffmpeg.org/download.html)
|
|
59
|
+
2. Run `pip3 install ffmpeg-normalize` and `ffmpeg-normalize /path/to/your/file.mp4`, alternatively install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and run `uvx ffmpeg-normalize /path/to/your/file.mp4`
|
|
60
|
+
3. Done! 🎧 (the normalized file will be called `normalized/file.mkv`)
|
|
61
|
+
|
|
62
|
+
## 📓 Documentation
|
|
63
|
+
|
|
64
|
+
Check out our [documentation](https://slhck.info/ffmpeg-normalize/) for more info!
|
|
65
|
+
|
|
66
|
+
## 🤝 Contributors
|
|
67
|
+
|
|
68
|
+
The only reason this project exists in its current form is because [@benjaoming](https://github.com/slhck/ffmpeg-normalize/issues?q=is%3Apr+author%3Abenjaoming)'s initial PRs. Thanks for everyone's support!
|
|
69
|
+
|
|
70
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
71
|
+
<!-- prettier-ignore-start -->
|
|
72
|
+
<!-- markdownlint-disable -->
|
|
73
|
+
<table>
|
|
74
|
+
<tbody>
|
|
75
|
+
<tr>
|
|
76
|
+
<td align="center" valign="top" width="14.28%"><a href="https://overtag.dk/"><img src="https://avatars.githubusercontent.com/u/374612?v=4?s=100" width="100px;" alt="Benjamin Balder Bach"/><br /><sub><b>Benjamin Balder Bach</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=benjaoming" title="Code">💻</a></td>
|
|
77
|
+
<td align="center" valign="top" width="14.28%"><a href="https://chaos.social/@eleni"><img src="https://avatars.githubusercontent.com/u/511547?v=4?s=100" width="100px;" alt="Eleni Lixourioti"/><br /><sub><b>Eleni Lixourioti</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=Geekfish" title="Code">💻</a></td>
|
|
78
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/thenewguy"><img src="https://avatars.githubusercontent.com/u/77731?v=4?s=100" width="100px;" alt="thenewguy"/><br /><sub><b>thenewguy</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=thenewguy" title="Code">💻</a></td>
|
|
79
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/aviolo"><img src="https://avatars.githubusercontent.com/u/560229?v=4?s=100" width="100px;" alt="Anthony Violo"/><br /><sub><b>Anthony Violo</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=aviolo" title="Code">💻</a></td>
|
|
80
|
+
<td align="center" valign="top" width="14.28%"><a href="https://jacobs.af/"><img src="https://avatars.githubusercontent.com/u/952830?v=4?s=100" width="100px;" alt="Eric Jacobs"/><br /><sub><b>Eric Jacobs</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=jetpks" title="Code">💻</a></td>
|
|
81
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kostalski"><img src="https://avatars.githubusercontent.com/u/34033008?v=4?s=100" width="100px;" alt="kostalski"/><br /><sub><b>kostalski</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=kostalski" title="Code">💻</a></td>
|
|
82
|
+
<td align="center" valign="top" width="14.28%"><a href="http://justinppearson.com/"><img src="https://avatars.githubusercontent.com/u/8844823?v=4?s=100" width="100px;" alt="Justin Pearson"/><br /><sub><b>Justin Pearson</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=justinpearson" title="Code">💻</a></td>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr>
|
|
85
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Nottt"><img src="https://avatars.githubusercontent.com/u/13532436?v=4?s=100" width="100px;" alt="ad90xa0-aa"/><br /><sub><b>ad90xa0-aa</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=Nottt" title="Code">💻</a></td>
|
|
86
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Mathijsz"><img src="https://avatars.githubusercontent.com/u/1891187?v=4?s=100" width="100px;" alt="Mathijs"/><br /><sub><b>Mathijs</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=Mathijsz" title="Code">💻</a></td>
|
|
87
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mpuels"><img src="https://avatars.githubusercontent.com/u/2924816?v=4?s=100" width="100px;" alt="Marc Püls"/><br /><sub><b>Marc Püls</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=mpuels" title="Code">💻</a></td>
|
|
88
|
+
<td align="center" valign="top" width="14.28%"><a href="http://www.mvbattista.com/"><img src="https://avatars.githubusercontent.com/u/158287?v=4?s=100" width="100px;" alt="Michael V. Battista"/><br /><sub><b>Michael V. Battista</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=mvbattista" title="Code">💻</a></td>
|
|
89
|
+
<td align="center" valign="top" width="14.28%"><a href="http://auto-editor.com"><img src="https://avatars.githubusercontent.com/u/57511737?v=4?s=100" width="100px;" alt="WyattBlue"/><br /><sub><b>WyattBlue</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=WyattBlue" title="Code">💻</a></td>
|
|
90
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/g3n35i5"><img src="https://avatars.githubusercontent.com/u/17593457?v=4?s=100" width="100px;" alt="Jan-Frederik Schmidt"/><br /><sub><b>Jan-Frederik Schmidt</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=g3n35i5" title="Code">💻</a></td>
|
|
91
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mjhalwa"><img src="https://avatars.githubusercontent.com/u/8994014?v=4?s=100" width="100px;" alt="mjhalwa"/><br /><sub><b>mjhalwa</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=mjhalwa" title="Code">💻</a></td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/07416"><img src="https://avatars.githubusercontent.com/u/14923168?v=4?s=100" width="100px;" alt="07416"/><br /><sub><b>07416</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=07416" title="Documentation">📖</a></td>
|
|
95
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sian1468"><img src="https://avatars.githubusercontent.com/u/58017832?v=4?s=100" width="100px;" alt="sian1468"/><br /><sub><b>sian1468</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=sian1468" title="Tests">⚠️</a></td>
|
|
96
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/psavva"><img src="https://avatars.githubusercontent.com/u/1454758?v=4?s=100" width="100px;" alt="Panayiotis Savva"/><br /><sub><b>Panayiotis Savva</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=psavva" title="Code">💻</a></td>
|
|
97
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HighMans"><img src="https://avatars.githubusercontent.com/u/42877729?v=4?s=100" width="100px;" alt="HighMans"/><br /><sub><b>HighMans</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=HighMans" title="Code">💻</a></td>
|
|
98
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kanjieater"><img src="https://avatars.githubusercontent.com/u/32607317?v=4?s=100" width="100px;" alt="kanjieater"/><br /><sub><b>kanjieater</b></sub></a><br /><a href="#ideas-kanjieater" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
99
|
+
<td align="center" valign="top" width="14.28%"><a href="https://ahmetsait.com/"><img src="https://avatars.githubusercontent.com/u/8372246?v=4?s=100" width="100px;" alt="Ahmet Sait"/><br /><sub><b>Ahmet Sait</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=ahmetsait" title="Code">💻</a></td>
|
|
100
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/georgev93"><img src="https://avatars.githubusercontent.com/u/39860568?v=4?s=100" width="100px;" alt="georgev93"/><br /><sub><b>georgev93</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=georgev93" title="Code">💻</a></td>
|
|
101
|
+
</tr>
|
|
102
|
+
<tr>
|
|
103
|
+
<td align="center" valign="top" width="14.28%"><a href="https://davidbern.com/"><img src="https://avatars.githubusercontent.com/u/371066?v=4?s=100" width="100px;" alt="David Bern"/><br /><sub><b>David Bern</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=odie5533" title="Code">💻</a></td>
|
|
104
|
+
</tr>
|
|
105
|
+
</tbody>
|
|
106
|
+
<tfoot>
|
|
107
|
+
<tr>
|
|
108
|
+
<td align="center" size="13px" colspan="7">
|
|
109
|
+
<img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg">
|
|
110
|
+
<a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
|
|
111
|
+
</img>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
</tfoot>
|
|
115
|
+
</table>
|
|
116
|
+
|
|
117
|
+
<!-- markdownlint-restore -->
|
|
118
|
+
<!-- prettier-ignore-end -->
|
|
119
|
+
|
|
120
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
8
|
-
[](#contributors-)
|
|
9
9
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
10
10
|
|
|
11
11
|
A utility for batch-normalizing audio using ffmpeg.
|
|
@@ -14,7 +14,7 @@ This program normalizes media files to a certain loudness level using the EBU R1
|
|
|
14
14
|
|
|
15
15
|
## ✨ Features
|
|
16
16
|
|
|
17
|
-
- EBU R128 loudness normalization
|
|
17
|
+
- EBU R128 loudness normalization (two-pass by default, with an option for one-pass dynamic normalization)
|
|
18
18
|
- RMS-based normalization
|
|
19
19
|
- Peak normalization
|
|
20
20
|
- Video file support
|
|
@@ -24,9 +24,8 @@ This program normalizes media files to a certain loudness level using the EBU R1
|
|
|
24
24
|
## 🚀 Quick Start
|
|
25
25
|
|
|
26
26
|
1. Install a recent version of [ffmpeg](https://ffmpeg.org/download.html)
|
|
27
|
-
2. Run `pip3 install ffmpeg-normalize`
|
|
28
|
-
3.
|
|
29
|
-
4. Done! 🎧 (the normalized file will be called `normalized/file.mkv`)
|
|
27
|
+
2. Run `pip3 install ffmpeg-normalize` and `ffmpeg-normalize /path/to/your/file.mp4`, alternatively install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and run `uvx ffmpeg-normalize /path/to/your/file.mp4`
|
|
28
|
+
3. Done! 🎧 (the normalized file will be called `normalized/file.mkv`)
|
|
30
29
|
|
|
31
30
|
## 📓 Documentation
|
|
32
31
|
|
|
@@ -66,6 +65,10 @@ The only reason this project exists in its current form is because [@benjaoming]
|
|
|
66
65
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HighMans"><img src="https://avatars.githubusercontent.com/u/42877729?v=4?s=100" width="100px;" alt="HighMans"/><br /><sub><b>HighMans</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=HighMans" title="Code">💻</a></td>
|
|
67
66
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kanjieater"><img src="https://avatars.githubusercontent.com/u/32607317?v=4?s=100" width="100px;" alt="kanjieater"/><br /><sub><b>kanjieater</b></sub></a><br /><a href="#ideas-kanjieater" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
68
67
|
<td align="center" valign="top" width="14.28%"><a href="https://ahmetsait.com/"><img src="https://avatars.githubusercontent.com/u/8372246?v=4?s=100" width="100px;" alt="Ahmet Sait"/><br /><sub><b>Ahmet Sait</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=ahmetsait" title="Code">💻</a></td>
|
|
68
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/georgev93"><img src="https://avatars.githubusercontent.com/u/39860568?v=4?s=100" width="100px;" alt="georgev93"/><br /><sub><b>georgev93</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=georgev93" title="Code">💻</a></td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td align="center" valign="top" width="14.28%"><a href="https://davidbern.com/"><img src="https://avatars.githubusercontent.com/u/371066?v=4?s=100" width="100px;" alt="David Bern"/><br /><sub><b>David Bern</b></sub></a><br /><a href="https://github.com/slhck/ffmpeg-normalize/commits?author=odie5533" title="Code">💻</a></td>
|
|
69
72
|
</tr>
|
|
70
73
|
</tbody>
|
|
71
74
|
<tfoot>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.8.14,<0.9.0"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ffmpeg-normalize"
|
|
7
|
+
version = "1.33.1"
|
|
8
|
+
description = "Normalize audio via ffmpeg"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE.md"]
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Werner Robitza", email = "werner.robitza@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ffmpeg", "normalize", "audio"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
20
|
+
"Topic :: Multimedia :: Sound/Audio :: Analysis",
|
|
21
|
+
"Topic :: Multimedia :: Sound/Audio :: Conversion",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Natural Language :: English",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
]
|
|
31
|
+
requires-python = ">=3.9"
|
|
32
|
+
dependencies = [
|
|
33
|
+
"tqdm>=4.64.1",
|
|
34
|
+
"colorama>=0.4.6; platform_system=='Windows'",
|
|
35
|
+
"ffmpeg-progress-yield>=1.0.1",
|
|
36
|
+
"colorlog==6.7.0",
|
|
37
|
+
"mutagen>=1.47.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/slhck/ffmpeg-normalize"
|
|
42
|
+
Repository = "https://github.com/slhck/ffmpeg-normalize"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
ffmpeg-normalize = "ffmpeg_normalize.__main__:main"
|
|
46
|
+
|
|
47
|
+
[tool.uv_build]
|
|
48
|
+
src-layout = true
|
|
49
|
+
|
|
50
|
+
[dependency-groups]
|
|
51
|
+
dev = [
|
|
52
|
+
"pytest>=8.1.1,<9",
|
|
53
|
+
"ruff>=0.12.11",
|
|
54
|
+
"mypy>=1.0.0",
|
|
55
|
+
"types-tqdm",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[tool.mypy]
|
|
59
|
+
python_version = "3.13"
|
|
60
|
+
ignore_missing_imports = true
|
|
61
|
+
exclude = ["build"]
|
|
62
|
+
namespace_packages = false
|
|
63
|
+
no_implicit_optional = true
|
|
64
|
+
check_untyped_defs = true
|
|
65
|
+
warn_return_any = true
|
|
66
|
+
warn_unused_ignores = true
|
|
67
|
+
show_error_codes = true
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import importlib.metadata
|
|
2
|
+
|
|
1
3
|
from ._errors import FFmpegNormalizeError
|
|
2
4
|
from ._ffmpeg_normalize import FFmpegNormalize
|
|
3
5
|
from ._media_file import MediaFile
|
|
4
6
|
from ._streams import AudioStream, MediaStream, SubtitleStream, VideoStream
|
|
5
|
-
|
|
7
|
+
|
|
8
|
+
__version__ = importlib.metadata.version("ffmpeg-normalize")
|
|
6
9
|
|
|
7
10
|
__module_name__ = "ffmpeg_normalize"
|
|
8
11
|
|
|
@@ -13,7 +13,11 @@ from typing import NoReturn
|
|
|
13
13
|
from ._errors import FFmpegNormalizeError
|
|
14
14
|
from ._ffmpeg_normalize import NORMALIZATION_TYPES, FFmpegNormalize
|
|
15
15
|
from ._logger import setup_cli_logger
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
# Import version from package
|
|
18
|
+
import importlib.metadata
|
|
19
|
+
|
|
20
|
+
__version__ = importlib.metadata.version("ffmpeg-normalize")
|
|
17
21
|
|
|
18
22
|
_logger = logging.getLogger(__name__)
|
|
19
23
|
|
|
@@ -52,7 +56,12 @@ def create_parser() -> argparse.ArgumentParser:
|
|
|
52
56
|
)
|
|
53
57
|
|
|
54
58
|
group_io = parser.add_argument_group("File Input/output")
|
|
55
|
-
group_io.add_argument("input", nargs="
|
|
59
|
+
group_io.add_argument("input", nargs="*", help="Input media file(s)")
|
|
60
|
+
group_io.add_argument(
|
|
61
|
+
"--input-list",
|
|
62
|
+
type=str,
|
|
63
|
+
help="Path to a text file containing a line-separated list of input files",
|
|
64
|
+
)
|
|
56
65
|
group_io.add_argument(
|
|
57
66
|
"-o",
|
|
58
67
|
"--output",
|
|
@@ -583,7 +592,18 @@ def main() -> None:
|
|
|
583
592
|
"Will apply default file naming for the remaining ones."
|
|
584
593
|
)
|
|
585
594
|
|
|
586
|
-
|
|
595
|
+
# Collect input files from positional args and --input-list
|
|
596
|
+
input_files = list(cli_args.input) if cli_args.input else []
|
|
597
|
+
if cli_args.input_list:
|
|
598
|
+
if not os.path.exists(cli_args.input_list):
|
|
599
|
+
error(f"Input list file '{cli_args.input_list}' does not exist")
|
|
600
|
+
with open(cli_args.input_list, "r") as f:
|
|
601
|
+
input_files.extend([line.strip() for line in f if line.strip()])
|
|
602
|
+
|
|
603
|
+
if not input_files:
|
|
604
|
+
error("No input files specified. Use positional arguments or --input-list.")
|
|
605
|
+
|
|
606
|
+
for index, input_file in enumerate(input_files):
|
|
587
607
|
if cli_args.output is not None and index < len(cli_args.output):
|
|
588
608
|
if cli_args.output_folder and cli_args.output_folder != "normalized":
|
|
589
609
|
_logger.warning(
|
|
@@ -75,10 +75,10 @@ class CommandRunner:
|
|
|
75
75
|
"""
|
|
76
76
|
# wrapper for 'ffmpeg-progress-yield'
|
|
77
77
|
_logger.debug(f"Running command: {shlex.join(cmd)}")
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
with FfmpegProgress(cmd, dry_run=self.dry) as ff:
|
|
79
|
+
yield from ff.run_command_with_progress()
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
self.output = ff.stderr
|
|
82
82
|
|
|
83
83
|
if _logger.getEffectiveLevel() == logging.DEBUG and self.output is not None:
|
|
84
84
|
_logger.debug(
|
{ffmpeg_normalize-1.32.2 → ffmpeg_normalize-1.33.1/src}/ffmpeg_normalize/_ffmpeg_normalize.py
RENAMED
|
@@ -63,7 +63,7 @@ class FFmpegNormalize:
|
|
|
63
63
|
lower_only (bool, optional): Whether the audio should not increase in loudness. Defaults to False.
|
|
64
64
|
auto_lower_loudness_target (bool, optional): Automatically lower EBU Integrated Loudness Target.
|
|
65
65
|
dual_mono (bool, optional): Dual mono. Defaults to False.
|
|
66
|
-
dynamic (bool, optional):
|
|
66
|
+
dynamic (bool, optional): Use dynamic EBU R128 normalization. This is a one-pass algorithm and skips the initial media scan. Defaults to False.
|
|
67
67
|
audio_codec (str, optional): Audio codec. Defaults to "pcm_s16le".
|
|
68
68
|
audio_bitrate (float, optional): Audio bitrate. Defaults to None.
|
|
69
69
|
sample_rate (int, optional): Sample rate. Defaults to None.
|
|
@@ -207,8 +207,16 @@ class MediaFile:
|
|
|
207
207
|
"""
|
|
208
208
|
_logger.debug(f"Running normalization for {self.input_file}")
|
|
209
209
|
|
|
210
|
-
# run the first pass to get loudness stats
|
|
211
|
-
|
|
210
|
+
# run the first pass to get loudness stats, unless in dynamic EBU mode
|
|
211
|
+
if not (
|
|
212
|
+
self.ffmpeg_normalize.dynamic
|
|
213
|
+
and self.ffmpeg_normalize.normalization_type == "ebu"
|
|
214
|
+
):
|
|
215
|
+
self._first_pass()
|
|
216
|
+
else:
|
|
217
|
+
_logger.debug(
|
|
218
|
+
"Dynamic EBU mode: First pass will not run, as it is not needed."
|
|
219
|
+
)
|
|
212
220
|
|
|
213
221
|
# for second pass, create a temp file
|
|
214
222
|
temp_dir = mkdtemp()
|
|
@@ -596,6 +604,10 @@ class MediaFile:
|
|
|
596
604
|
yield 100
|
|
597
605
|
return
|
|
598
606
|
|
|
607
|
+
# track temp_dir for cleanup
|
|
608
|
+
temp_dir = None
|
|
609
|
+
temp_file = None
|
|
610
|
+
|
|
599
611
|
# special case: if output is a null device, write directly to it
|
|
600
612
|
if self.output_file == os.devnull:
|
|
601
613
|
cmd.append(self.output_file)
|
|
@@ -612,11 +624,19 @@ class MediaFile:
|
|
|
612
624
|
raise e
|
|
613
625
|
else:
|
|
614
626
|
# only move the temp file if it's not a null device and ReplayGain is not enabled!
|
|
615
|
-
if
|
|
627
|
+
if (
|
|
628
|
+
self.output_file != os.devnull
|
|
629
|
+
and temp_file
|
|
630
|
+
and not self.ffmpeg_normalize.replaygain
|
|
631
|
+
):
|
|
616
632
|
_logger.debug(
|
|
617
633
|
f"Moving temporary file from {temp_file} to {self.output_file}"
|
|
618
634
|
)
|
|
619
635
|
move(temp_file, self.output_file)
|
|
636
|
+
finally:
|
|
637
|
+
# clean up temp directory if it was created
|
|
638
|
+
if temp_dir and os.path.exists(temp_dir):
|
|
639
|
+
rmtree(temp_dir, ignore_errors=True)
|
|
620
640
|
|
|
621
641
|
output = cmd_runner.get_output()
|
|
622
642
|
# in the second pass, we do not normalize stream-by-stream, so we set the stats based on the
|
|
@@ -428,6 +428,28 @@ class AudioStream(MediaStream):
|
|
|
428
428
|
Return second pass loudnorm filter options string for ffmpeg
|
|
429
429
|
"""
|
|
430
430
|
|
|
431
|
+
# In dynamic mode, we can do everything in one pass, and we do not have first pass stats
|
|
432
|
+
if self.media_file.ffmpeg_normalize.dynamic:
|
|
433
|
+
if not self.ffmpeg_normalize.sample_rate:
|
|
434
|
+
_logger.warning(
|
|
435
|
+
"In dynamic mode, the sample rate will automatically be set to 192 kHz by the loudnorm filter. "
|
|
436
|
+
"Specify -ar/--sample-rate to override it."
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
opts = {
|
|
440
|
+
"i": self.media_file.ffmpeg_normalize.target_level,
|
|
441
|
+
"lra": self.media_file.ffmpeg_normalize.loudness_range_target,
|
|
442
|
+
"tp": self.media_file.ffmpeg_normalize.true_peak,
|
|
443
|
+
"offset": self.media_file.ffmpeg_normalize.offset,
|
|
444
|
+
"linear": "false",
|
|
445
|
+
"print_format": "json",
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if self.media_file.ffmpeg_normalize.dual_mono:
|
|
449
|
+
opts["dual_mono"] = "true"
|
|
450
|
+
|
|
451
|
+
return "loudnorm=" + dict_to_filter_opts(opts)
|
|
452
|
+
|
|
431
453
|
if not self.loudness_statistics["ebu_pass1"]:
|
|
432
454
|
raise FFmpegNormalizeError(
|
|
433
455
|
"First pass not run, you must call parse_loudnorm_stats first"
|
|
@@ -440,7 +462,7 @@ class AudioStream(MediaStream):
|
|
|
440
462
|
)
|
|
441
463
|
self.loudness_statistics["ebu_pass1"]["input_i"] = 0
|
|
442
464
|
|
|
443
|
-
will_use_dynamic_mode = self.media_file.ffmpeg_normalize.dynamic
|
|
465
|
+
will_use_dynamic_mode: bool = self.media_file.ffmpeg_normalize.dynamic
|
|
444
466
|
|
|
445
467
|
if self.media_file.ffmpeg_normalize.keep_loudness_range_target:
|
|
446
468
|
_logger.debug(
|