ffmpeg-normalize 1.45.3__tar.gz → 1.45.4__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.45.3 → ffmpeg_normalize-1.45.4}/PKG-INFO +1 -1
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/pyproject.toml +1 -1
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/pyproject.toml.orig +1 -1
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_media_file.py +27 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/LICENSE.md +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/README.md +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/__init__.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/__main__.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_cmd_utils.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_console.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_errors.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_ffmpeg_normalize.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_logger.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_presets.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_streams.py +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/data/presets/music.json +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/data/presets/podcast.json +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/data/presets/streaming-video.json +0 -0
- {ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/py.typed +0 -0
|
@@ -98,6 +98,8 @@ class MediaFile:
|
|
|
98
98
|
)
|
|
99
99
|
self.output_ext = current_ext
|
|
100
100
|
self.streams: StreamDict = {"audio": {}, "video": {}, "subtitle": {}}
|
|
101
|
+
# stream ids of attachments, e.g. fonts used by styled subtitles
|
|
102
|
+
self.attachment_streams: list[int] = []
|
|
101
103
|
self.temp_file: Union[str, None] = None
|
|
102
104
|
self.batch_reference: float | None = None
|
|
103
105
|
# Second-pass filter chain per normalized audio stream, keyed by stream
|
|
@@ -227,6 +229,10 @@ class MediaFile:
|
|
|
227
229
|
self.ffmpeg_normalize, self, stream_id
|
|
228
230
|
)
|
|
229
231
|
|
|
232
|
+
elif "Attachment" in line and stream_id not in self.attachment_streams:
|
|
233
|
+
_logger.debug(f"Found attachment stream at index {stream_id}")
|
|
234
|
+
self.attachment_streams.append(stream_id)
|
|
235
|
+
|
|
230
236
|
if not self.streams["audio"]:
|
|
231
237
|
raise FFmpegNormalizeError(
|
|
232
238
|
f"Input file {self.input_file} does not contain any audio streams"
|
|
@@ -243,6 +249,7 @@ class MediaFile:
|
|
|
243
249
|
self.streams["audio"] = {first_stream.stream_id: first_stream}
|
|
244
250
|
self.streams["video"] = {}
|
|
245
251
|
self.streams["subtitle"] = {}
|
|
252
|
+
self.attachment_streams = []
|
|
246
253
|
|
|
247
254
|
def _get_streams_to_normalize(self) -> list[AudioStream]:
|
|
248
255
|
"""
|
|
@@ -1147,6 +1154,13 @@ class MediaFile:
|
|
|
1147
1154
|
cmd.extend([f"-c:a:{output_audio_idx}", "copy"])
|
|
1148
1155
|
output_audio_idx += 1
|
|
1149
1156
|
|
|
1157
|
+
# filter outputs carry no disposition, so without this the muxer would
|
|
1158
|
+
# mark the first audio stream as default instead of the input's default
|
|
1159
|
+
if any(stream.is_default for stream in all_audio_streams):
|
|
1160
|
+
for idx, audio_stream in enumerate(streams_to_normalize):
|
|
1161
|
+
disposition = "default" if audio_stream.is_default else "0"
|
|
1162
|
+
cmd.extend([f"-disposition:a:{idx}", disposition])
|
|
1163
|
+
|
|
1150
1164
|
# other audio options (if any) - only apply to normalized streams
|
|
1151
1165
|
if self.ffmpeg_normalize.audio_bitrate:
|
|
1152
1166
|
if audio_codec == "libvorbis":
|
|
@@ -1197,11 +1211,24 @@ class MediaFile:
|
|
|
1197
1211
|
# copy subtitles
|
|
1198
1212
|
cmd.extend(["-c:s", "copy"])
|
|
1199
1213
|
|
|
1214
|
+
# ... and attachments, which only Matroska can hold
|
|
1215
|
+
if self.attachment_streams and self.output_ext.lower() in ("mkv", "mka"):
|
|
1216
|
+
for idx, s in enumerate(self.attachment_streams):
|
|
1217
|
+
# the muxer needs each attachment's filename and mimetype tags
|
|
1218
|
+
cmd.extend(
|
|
1219
|
+
["-map", f"0:{s}", f"-map_metadata:s:t:{idx}", f"0:s:t:{idx}"]
|
|
1220
|
+
)
|
|
1221
|
+
cmd.extend(["-c:t", "copy"])
|
|
1222
|
+
|
|
1200
1223
|
if self.ffmpeg_normalize.keep_original_audio:
|
|
1201
1224
|
# Map all original audio streams after normalized and passthrough streams
|
|
1202
1225
|
for index, _ in enumerate(self.streams["audio"].items()):
|
|
1203
1226
|
cmd.extend(["-map", f"0:a:{index}"])
|
|
1204
1227
|
cmd.extend([f"-c:a:{output_audio_idx}", "copy"])
|
|
1228
|
+
# the normalized stream already carries the default flag, so
|
|
1229
|
+
# drop it from the copy (keeping any other flags, e.g. comment)
|
|
1230
|
+
# to avoid players picking the un-normalized original
|
|
1231
|
+
cmd.extend([f"-disposition:a:{output_audio_idx}", "-default"])
|
|
1205
1232
|
output_audio_idx += 1
|
|
1206
1233
|
|
|
1207
1234
|
# extra options (if any)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/_ffmpeg_normalize.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/data/presets/music.json
RENAMED
|
File without changes
|
{ffmpeg_normalize-1.45.3 → ffmpeg_normalize-1.45.4}/src/ffmpeg_normalize/data/presets/podcast.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|