ffmpeg-normalize 1.45.0__tar.gz → 1.45.2__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.
Files changed (19) hide show
  1. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/PKG-INFO +1 -1
  2. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/pyproject.toml +1 -1
  3. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/pyproject.toml.orig +1 -1
  4. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/__main__.py +5 -2
  5. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_ffmpeg_normalize.py +1 -1
  6. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_media_file.py +20 -4
  7. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_streams.py +7 -1
  8. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/LICENSE.md +0 -0
  9. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/README.md +0 -0
  10. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/__init__.py +0 -0
  11. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_cmd_utils.py +0 -0
  12. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_console.py +0 -0
  13. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_errors.py +0 -0
  14. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_logger.py +0 -0
  15. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/_presets.py +0 -0
  16. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/data/presets/music.json +0 -0
  17. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/data/presets/podcast.json +0 -0
  18. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/data/presets/streaming-video.json +0 -0
  19. {ffmpeg_normalize-1.45.0 → ffmpeg_normalize-1.45.2}/src/ffmpeg_normalize/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffmpeg-normalize
3
- Version: 1.45.0
3
+ Version: 1.45.2
4
4
  Summary: Normalize audio via ffmpeg
5
5
  Keywords: ffmpeg,normalize,audio
6
6
  Author: Werner Robitza
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "ffmpeg-normalize"
7
- version = "1.45.0"
7
+ version = "1.45.2"
8
8
  description = "Normalize audio via ffmpeg"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "ffmpeg-normalize"
7
- version = "1.45.0"
7
+ version = "1.45.2"
8
8
  description = "Normalize audio via ffmpeg"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -649,8 +649,11 @@ def create_parser(suppress_defaults: bool = False) -> argparse.ArgumentParser:
649
649
  normalized audio stream.
650
650
 
651
651
  The tag holds an ffmpeg-command-equivalent string with the audio codec,
652
- the bitrate, sample rate and channel count (when set), plus the
653
- normalization filter including the measured loudnorm values.
652
+ the bitrate, sample rate and channel count (when set), the normalization
653
+ filter including the measured loudnorm values, and any
654
+ `-e`/`--extra-output-options` appended verbatim (these are not
655
+ audio-scoped, so an unrelated option passed there also ends up in the
656
+ tag). Extra input options are demuxer settings and are not included.
654
657
 
655
658
  This is a Matroska/WebM tag convention; other containers may store it
656
659
  differently. Has no effect together with `--metadata-disable`.
@@ -89,7 +89,7 @@ class FFmpegNormalize:
89
89
  subtitle_disable (bool, optional): Disable subtitles. Defaults to False.
90
90
  metadata_disable (bool, optional): Disable metadata. Defaults to False.
91
91
  chapters_disable (bool, optional): Disable chapters. Defaults to False.
92
- write_encoder_settings (bool, optional): Write the effective encoder settings (codec, bitrate, sample rate, channels and the normalization filter including the measured loudnorm values) as an ENCODER_SETTINGS tag on each normalized audio stream. Defaults to False.
92
+ write_encoder_settings (bool, optional): Write the effective encoder settings (codec, bitrate, sample rate, channels, the normalization filter including the measured loudnorm values, and any extra_output_options) as an ENCODER_SETTINGS tag on each normalized audio stream. Defaults to False.
93
93
  extra_input_options (list, optional): Extra input options. Defaults to None.
94
94
  extra_output_options (list, optional): Extra output options. Defaults to None.
95
95
  output_format (str, optional): Output format. Defaults to None.
@@ -40,7 +40,7 @@ _logger = logging.getLogger(__name__)
40
40
 
41
41
  # Note: this does not contain MP3, see https://github.com/slhck/ffmpeg-normalize/issues/246
42
42
  # We may need to remove other formats as well, to be checked.
43
- AUDIO_ONLY_FORMATS = {"aac", "ast", "flac", "mka", "oga", "ogg", "opus", "wav"}
43
+ AUDIO_ONLY_FORMATS = {"aac", "ast", "mka", "oga", "ogg", "opus", "wav"}
44
44
  ONE_STREAM = {"aac", "ast", "flac", "mp3", "wav"}
45
45
 
46
46
 
@@ -215,7 +215,10 @@ class MediaFile:
215
215
  elif "Video" in line:
216
216
  _logger.debug(f"Found video stream at index {stream_id}")
217
217
  self.streams["video"][stream_id] = VideoStream(
218
- self.ffmpeg_normalize, self, stream_id
218
+ self.ffmpeg_normalize,
219
+ self,
220
+ stream_id,
221
+ attached_pic="(attached pic)" in line,
219
222
  )
220
223
 
221
224
  elif "Subtitle" in line:
@@ -837,6 +840,12 @@ class MediaFile:
837
840
  if self.output_ext.lower() in AUDIO_ONLY_FORMATS:
838
841
  return False
839
842
 
843
+ # FLAC holds pictures (cover art), not video
844
+ if self.output_ext.lower() == "flac" and not all(
845
+ stream.attached_pic for stream in self.streams["video"].values()
846
+ ):
847
+ return False
848
+
840
849
  return not self.ffmpeg_normalize.video_disable
841
850
 
842
851
  def _first_pass(self) -> None:
@@ -964,13 +973,18 @@ class MediaFile:
964
973
  Return an ffmpeg-command-equivalent description of how a single audio
965
974
  stream is encoded in the second pass: the codec, then the bitrate,
966
975
  sample rate and channel count when set, followed by the effective
967
- filter chain (which includes the loudnorm measured values).
976
+ filter chain (which includes the loudnorm measured values) and finally
977
+ any ``--extra-output-options``.
968
978
 
969
979
  Written as the ``ENCODER_SETTINGS`` stream tag when
970
980
  ``write_encoder_settings`` is enabled. The filter chain comes from the
971
981
  cache populated by :meth:`_get_audio_filter_cmd`, which must run first.
972
982
  The loudnorm ``print_format`` option is dropped, as it only controls
973
- first-pass diagnostics and not the normalization itself.
983
+ first-pass diagnostics and not the normalization itself. Extra output
984
+ options are appended verbatim: they commonly carry encoder tuning
985
+ (``-q:a``, ``-compression_level``, ``-application`` ...), but are not
986
+ audio-scoped, so an unrelated option passed there will also appear here.
987
+ Extra *input* options are demuxer settings and are deliberately omitted.
974
988
 
975
989
  Returns:
976
990
  str: e.g. ``-c:a libopus -b:a 128000 -af loudnorm=i=-23.0:...``
@@ -987,6 +1001,8 @@ class MediaFile:
987
1001
  if filter_chain:
988
1002
  af = re.sub(r":print_format=\w+", "", ",".join(filter_chain))
989
1003
  args += ["-af", af]
1004
+ if self.ffmpeg_normalize.extra_output_options:
1005
+ args += self.ffmpeg_normalize.extra_output_options
990
1006
  return shlex.join(args)
991
1007
 
992
1008
  def _get_audio_codec(self) -> str | None:
@@ -132,9 +132,15 @@ class MediaStream:
132
132
 
133
133
  class VideoStream(MediaStream):
134
134
  def __init__(
135
- self, ffmpeg_normalize: FFmpegNormalize, media_file: MediaFile, stream_id: int
135
+ self,
136
+ ffmpeg_normalize: FFmpegNormalize,
137
+ media_file: MediaFile,
138
+ stream_id: int,
139
+ attached_pic: bool = False,
136
140
  ):
137
141
  super().__init__(ffmpeg_normalize, media_file, "video", stream_id)
142
+ # Cover art rather than a video track
143
+ self.attached_pic = attached_pic
138
144
 
139
145
 
140
146
  class SubtitleStream(MediaStream):