Skip to content

Commit

Permalink
constrain input LRA for second pass, addresses #227
Browse files Browse the repository at this point in the history
  • Loading branch information
slhck committed Apr 24, 2023
1 parent c49480c commit 3187a02
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ffmpeg_normalize/_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,15 @@ def get_second_pass_opts_ebu(self) -> str:
_logger.debug(
"Keeping target loudness range in second pass loudnorm filter"
)
self.media_file.ffmpeg_normalize.loudness_range_target = (
self.loudness_statistics["ebu"]["input_lra"]
input_lra = self.loudness_statistics["ebu"]["input_lra"]
if input_lra < 1 or input_lra > 7:
_logger.warning(
"Input file had measured loudness range outside of [1,7] "
f"({input_lra}), capping to allowed range"
)

self.media_file.ffmpeg_normalize.loudness_range_target = self._constrain(
self.loudness_statistics["ebu"]["input_lra"], 1, 7
)

if self.media_file.ffmpeg_normalize.keep_lra_above_loudness_range_target:
Expand Down

0 comments on commit 3187a02

Please sign in to comment.