ffmpeg-normalize 1.33.0__py3-none-any.whl → 1.33.2__py3-none-any.whl

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.
@@ -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
- from ._version import __version__
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
- from ._version import __version__
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
 
@@ -257,8 +261,11 @@ def create_parser() -> argparse.ArgumentParser:
257
261
  Whether the audio should not increase in loudness.
258
262
 
259
263
  If the measured loudness from the first pass is lower than the target
260
- loudness then normalization pass will be skipped for the measured audio
261
- source.
264
+ loudness then normalization will be skipped for the audio source.
265
+
266
+ For EBU normalization, this compares input integrated loudness to the target level.
267
+ For peak normalization, this compares the input peak level to the target level.
268
+ For RMS normalization, this compares the input RMS level to the target level.
262
269
  """
263
270
  ),
264
271
  )
@@ -624,7 +624,11 @@ class MediaFile:
624
624
  raise e
625
625
  else:
626
626
  # only move the temp file if it's not a null device and ReplayGain is not enabled!
627
- if self.output_file != os.devnull and temp_file and not self.ffmpeg_normalize.replaygain:
627
+ if (
628
+ self.output_file != os.devnull
629
+ and temp_file
630
+ and not self.ffmpeg_normalize.replaygain
631
+ ):
628
632
  _logger.debug(
629
633
  f"Moving temporary file from {temp_file} to {self.output_file}"
630
634
  )
@@ -641,8 +645,15 @@ class MediaFile:
641
645
  ebu_pass_2_stats = list(
642
646
  AudioStream.prune_and_parse_loudnorm_output(output).values()
643
647
  )
644
- for idx, audio_stream in enumerate(self.streams["audio"].values()):
645
- audio_stream.set_second_pass_stats(ebu_pass_2_stats[idx])
648
+ # Only set second pass stats if they exist (they might not if all streams were skipped with --lower-only)
649
+ if len(ebu_pass_2_stats) == len(self.streams["audio"]):
650
+ for idx, audio_stream in enumerate(self.streams["audio"].values()):
651
+ audio_stream.set_second_pass_stats(ebu_pass_2_stats[idx])
652
+ else:
653
+ _logger.debug(
654
+ f"Expected {len(self.streams['audio'])} EBU pass 2 statistics but got {len(ebu_pass_2_stats)}. "
655
+ "This can happen when normalization is skipped (e.g., with --lower-only)."
656
+ )
646
657
 
647
658
  # warn if self.media_file.ffmpeg_normalize.dynamic == False and any of the second pass stats contain "normalization_type" == "dynamic"
648
659
  if self.ffmpeg_normalize.dynamic is False:
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: ffmpeg-normalize
3
+ Version: 1.33.2
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
+ [![PyPI version](https://img.shields.io/pypi/v/ffmpeg-normalize.svg)](https://pypi.org/project/ffmpeg-normalize)
36
+ ![Docker Image Version](https://img.shields.io/docker/v/slhck/ffmpeg-normalize?sort=semver&label=Docker%20image)
37
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/slhck/ffmpeg-normalize/python-package.yml)
38
+
39
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
40
+ [![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#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 -->
@@ -0,0 +1,14 @@
1
+ ffmpeg_normalize/__init__.py,sha256=l0arjiMMBNbiH3IH67gT6SdZjPGAVLAdorUx38dNtvE,508
2
+ ffmpeg_normalize/__main__.py,sha256=UJIaAel7DSWd0eJr0FlZupsaHvj4wwrQsWd7fmBWB8s,20965
3
+ ffmpeg_normalize/_cmd_utils.py,sha256=1JspVpguAPsq7DqvyvjUNzHhVv8J3X93xNOMwito_jY,5284
4
+ ffmpeg_normalize/_errors.py,sha256=brTQ4osJ4fTA8wnyMPVVYfGwJ0wqeShRFydTEwi_VEY,48
5
+ ffmpeg_normalize/_ffmpeg_normalize.py,sha256=_ZK2P3kAM0mnxY3iCYH61T6jhMndTdO2Rqh03vJo7rY,11852
6
+ ffmpeg_normalize/_logger.py,sha256=3Ap4Fxg7xGrzz7h4IGuNEf0KKstx0Rq_eLbHPrHzcrI,1841
7
+ ffmpeg_normalize/_media_file.py,sha256=eJt9uNXmJheSH4B0ZZARFPMOwN0BGGXOELhcDpWmeew,26860
8
+ ffmpeg_normalize/_streams.py,sha256=hYqQiiVMJd-TrreHbrQertUnc4lQ9BPvBmDPKSr4o70,21596
9
+ ffmpeg_normalize/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ ffmpeg_normalize-1.33.2.dist-info/licenses/LICENSE.md,sha256=ig-_YggmJGbPQC_gUgBNFa0_XMsuHTpocivFnlOF4tE,1082
11
+ ffmpeg_normalize-1.33.2.dist-info/WHEEL,sha256=F3mArEuDT3LDFEqo9fCiUx6ISLN64aIhcGSiIwtu4r8,79
12
+ ffmpeg_normalize-1.33.2.dist-info/entry_points.txt,sha256=1bdrW7-kJRc8tctjnGcfe_Fwx39z5JOm0yZnJHnmwl8,69
13
+ ffmpeg_normalize-1.33.2.dist-info/METADATA,sha256=vv7kx0ptEuNiUEmFsJiDNugpkueKAvBjTAKUSSm9aZ4,11374
14
+ ffmpeg_normalize-1.33.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.8.16
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  ffmpeg-normalize = ffmpeg_normalize.__main__:main
3
+
@@ -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.
@@ -1 +0,0 @@
1
- __version__ = "1.33.0"