ffmpeg-normalize 1.45.4__tar.gz → 1.45.5__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.4 → ffmpeg_normalize-1.45.5}/PKG-INFO +1 -1
  2. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/pyproject.toml +1 -1
  3. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/pyproject.toml.orig +1 -1
  4. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_media_file.py +38 -15
  5. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/LICENSE.md +0 -0
  6. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/README.md +0 -0
  7. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/__init__.py +0 -0
  8. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/__main__.py +0 -0
  9. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_cmd_utils.py +0 -0
  10. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_console.py +0 -0
  11. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_errors.py +0 -0
  12. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_ffmpeg_normalize.py +0 -0
  13. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_logger.py +0 -0
  14. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_presets.py +0 -0
  15. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/_streams.py +0 -0
  16. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/data/presets/music.json +0 -0
  17. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/data/presets/podcast.json +0 -0
  18. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/src/ffmpeg_normalize/data/presets/streaming-video.json +0 -0
  19. {ffmpeg_normalize-1.45.4 → ffmpeg_normalize-1.45.5}/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.4
3
+ Version: 1.45.5
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.4"
7
+ version = "1.45.5"
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.4"
7
+ version = "1.45.5"
8
8
  description = "Normalize audio via ffmpeg"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1074,6 +1074,21 @@ class MediaFile:
1074
1074
  # add input file and basic filter
1075
1075
  cmd.extend(["-i", self.input_file, "-filter_complex", audio_filter_cmd])
1076
1076
 
1077
+ # Determine streams to normalize and passthrough
1078
+ streams_to_normalize = self._get_streams_to_normalize()
1079
+ all_audio_streams = list(self.streams["audio"].values())
1080
+
1081
+ # Determine which streams to passthrough
1082
+ if self.ffmpeg_normalize.keep_other_audio and (
1083
+ self.ffmpeg_normalize.audio_streams is not None
1084
+ or self.ffmpeg_normalize.audio_default_only
1085
+ ):
1086
+ streams_to_passthrough = [
1087
+ s for s in all_audio_streams if s not in streams_to_normalize
1088
+ ]
1089
+ else:
1090
+ streams_to_passthrough = []
1091
+
1077
1092
  # map metadata, only if needed
1078
1093
  if self.ffmpeg_normalize.metadata_disable:
1079
1094
  cmd.extend(["-map_metadata", "-1"])
@@ -1085,6 +1100,20 @@ class MediaFile:
1085
1100
  stream_key = stream_type[0]
1086
1101
  if stream_type not in self.streams:
1087
1102
  continue
1103
+ if stream_type == "audio":
1104
+ # output audio is the normalized streams, then the
1105
+ # passthrough ones, which need not be the first input
1106
+ # streams, so take the tags from the stream itself
1107
+ for idx, audio_stream in enumerate(
1108
+ streams_to_normalize + streams_to_passthrough
1109
+ ):
1110
+ cmd.extend(
1111
+ [
1112
+ f"-map_metadata:s:a:{idx}",
1113
+ f"0:s:{audio_stream.stream_id}",
1114
+ ]
1115
+ )
1116
+ continue
1088
1117
  for idx, _ in enumerate(self.streams[stream_type].items()):
1089
1118
  cmd.extend(
1090
1119
  [
@@ -1112,21 +1141,6 @@ class MediaFile:
1112
1141
  f"The chosen output extension {self.output_ext} does not support video/cover art. It will be disabled."
1113
1142
  )
1114
1143
 
1115
- # Determine streams to normalize and passthrough
1116
- streams_to_normalize = self._get_streams_to_normalize()
1117
- all_audio_streams = list(self.streams["audio"].values())
1118
-
1119
- # Determine which streams to passthrough
1120
- if self.ffmpeg_normalize.keep_other_audio and (
1121
- self.ffmpeg_normalize.audio_streams is not None
1122
- or self.ffmpeg_normalize.audio_default_only
1123
- ):
1124
- streams_to_passthrough = [
1125
- s for s in all_audio_streams if s not in streams_to_normalize
1126
- ]
1127
- else:
1128
- streams_to_passthrough = []
1129
-
1130
1144
  # ... and map the output of the normalization filters
1131
1145
  for ol in output_labels:
1132
1146
  cmd.extend(["-map", ol])
@@ -1229,6 +1243,15 @@ class MediaFile:
1229
1243
  # drop it from the copy (keeping any other flags, e.g. comment)
1230
1244
  # to avoid players picking the un-normalized original
1231
1245
  cmd.extend([f"-disposition:a:{output_audio_idx}", "-default"])
1246
+ # per-stream metadata mapping above turns off ffmpeg's automatic
1247
+ # copying of stream tags, so map the copy's tags explicitly
1248
+ if not self.ffmpeg_normalize.metadata_disable:
1249
+ cmd.extend(
1250
+ [
1251
+ f"-map_metadata:s:a:{output_audio_idx}",
1252
+ f"0:s:a:{index}",
1253
+ ]
1254
+ )
1232
1255
  output_audio_idx += 1
1233
1256
 
1234
1257
  # extra options (if any)