From 32cad0faa495d4c6058ca75c4aee74b95b73b08e Mon Sep 17 00:00:00 2001 From: dakriy Date: Mon, 7 Oct 2024 12:55:18 -0700 Subject: [PATCH] fix(analyzer): make ffmpeg filters less aggressive (#3086) ### Description FFMPEG filters for silence detection are too aggressive. **This is a new feature**: No **I have updated the documentation to reflect these changes**: No ### Testing Notes **What I did:** Ran tests and made sure they passed **How you can replicate my testing:** Upload files that start out quiet or end quiet and see that the cue-in/cue-out points don't cut off the track. Or just run tests as there are files that do that ### **Links** Closes: #2629 --- .../libretime_analyzer/pipeline/_ffmpeg.py | 3 +- analyzer/tests/fixtures/__init__.py | 42 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/analyzer/libretime_analyzer/pipeline/_ffmpeg.py b/analyzer/libretime_analyzer/pipeline/_ffmpeg.py index b9f5471c6..611e74fc9 100644 --- a/analyzer/libretime_analyzer/pipeline/_ffmpeg.py +++ b/analyzer/libretime_analyzer/pipeline/_ffmpeg.py @@ -75,8 +75,7 @@ def compute_silences(filepath: Path) -> List[Tuple[float, float]]: cmd = _ffmpeg( *("-i", filepath), "-vn", - *("-filter", "highpass=frequency=1000"), - *("-filter", "silencedetect=noise=0.15:duration=1"), + *("-filter", "highpass=frequency=80,silencedetect=noise=-60dB:duration=0.9"), ) starts, ends = [], [] diff --git a/analyzer/tests/fixtures/__init__.py b/analyzer/tests/fixtures/__init__.py index b6265a371..a778930dc 100644 --- a/analyzer/tests/fixtures/__init__.py +++ b/analyzer/tests/fixtures/__init__.py @@ -23,28 +23,28 @@ FILES = [ # 8s -> 9s: silence # 9s -> 12s: musik # 12s -> 15s: pink noise fade out -Fixture(here / "s1-jointstereo.mp3", 15.0, 6.0, 13.0, -5.9 ), -Fixture(here / "s1-mono.mp3", 15.0, 6.0, 13.0, -2.0 ), -Fixture(here / "s1-stereo.mp3", 15.0, 6.0, 13.0, -5.9 ), -Fixture(here / "s1-mono-12.mp3", 15.0, 9.0, 12.0, +7.0 ), -Fixture(here / "s1-stereo-12.mp3", 15.0, 9.0, 12.0, +6.1 ), -Fixture(here / "s1-mono+12.mp3", 15.0, 3.5, 13.0, -17.0 ), -Fixture(here / "s1-stereo+12.mp3", 15.0, 3.5, 13.0, -17.8 ), -Fixture(here / "s1-mono.flac", 15.0, 6.0, 13.0, -2.3 ), -Fixture(here / "s1-stereo.flac", 15.0, 6.0, 13.0, -6.0 ), -Fixture(here / "s1-mono-12.flac", 15.0, 9.0, 12.0, +10.0 ), -Fixture(here / "s1-stereo-12.flac", 15.0, 9.0, 12.0, +5.9 ), -Fixture(here / "s1-mono+12.flac", 15.0, 3.5, 13.0, -12.0 ), -Fixture(here / "s1-stereo+12.flac", 15.0, 3.5, 13.0, -14.9 ), -Fixture(here / "s1-mono.m4a", 15.0, 6.0, 13.0, -4.5 ), -Fixture(here / "s1-stereo.m4a", 15.0, 6.0, 13.0, -5.8 ), -Fixture(here / "s1-mono.ogg", 15.0, 6.0, 13.0, -4.9 ), -Fixture(here / "s1-stereo.ogg", 15.0, 6.0, 13.0, -5.7 ), -Fixture(here / "s1-stereo", 15.0, 6.0, 13.0, -5.7 ), -Fixture(here / "s1-mono.wav", 15.0, 6.0, 13.0, -2.3 ), -Fixture(here / "s1-stereo.wav", 15.0, 6.0, 13.0, -6.0 ), +Fixture(here / "s1-jointstereo.mp3", 15.0, 1.4, 15.0, -5.9 ), +Fixture(here / "s1-mono.mp3", 15.0, 1.5, 15.0, -2.0 ), +Fixture(here / "s1-stereo.mp3", 15.0, 1.4, 15.0, -5.9 ), +Fixture(here / "s1-mono-12.mp3", 15.0, 1.2, 15.0, +7.0 ), +Fixture(here / "s1-stereo-12.mp3", 15.0, 1.2, 15.0, +6.1 ), +Fixture(here / "s1-mono+12.mp3", 15.0, 1.2, 15.0, -17.0 ), +Fixture(here / "s1-stereo+12.mp3", 15.0, 1.2, 15.0, -17.8 ), +Fixture(here / "s1-mono.flac", 15.0, 1.4, 15.0, -2.3 ), +Fixture(here / "s1-stereo.flac", 15.0, 1.4, 15.0, -6.0 ), +Fixture(here / "s1-mono-12.flac", 15.0, 2.0, 15.0, +10.0 ), +Fixture(here / "s1-stereo-12.flac", 15.0, 1.8, 15.0, +5.9 ), +Fixture(here / "s1-mono+12.flac", 15.0, 0.0, 15.0, -12.0 ), +Fixture(here / "s1-stereo+12.flac", 15.0, 0.0, 15.0, -14.9 ), +Fixture(here / "s1-mono.m4a", 15.0, 1.4, 15.0, -4.5 ), +Fixture(here / "s1-stereo.m4a", 15.0, 1.4, 15.0, -5.8 ), +Fixture(here / "s1-mono.ogg", 15.0, 1.4, 15.0, -4.9 ), +Fixture(here / "s1-stereo.ogg", 15.0, 1.4, 15.0, -5.7 ), +Fixture(here / "s1-stereo", 15.0, 1.4, 15.0, -5.7 ), +Fixture(here / "s1-mono.wav", 15.0, 1.5, 15.0, -2.3 ), +Fixture(here / "s1-stereo.wav", 15.0, 1.4, 15.0, -6.0 ), # sample 1 large (looped for 2 hours) -Fixture(here / "s1-large.flac", 7200, 6.0, 7198, -6.0 ), +Fixture(here / "s1-large.flac", 7200, 1.4, 7200, -6.0 ), # sample 2 # 0s -> 1.8s: silence # 1.8s : noise