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
This commit is contained in:
dakriy 2024-10-07 12:55:18 -07:00 committed by GitHub
parent 2643813fb7
commit 32cad0faa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 23 deletions

View File

@ -75,8 +75,7 @@ def compute_silences(filepath: Path) -> List[Tuple[float, float]]:
cmd = _ffmpeg( cmd = _ffmpeg(
*("-i", filepath), *("-i", filepath),
"-vn", "-vn",
*("-filter", "highpass=frequency=1000"), *("-filter", "highpass=frequency=80,silencedetect=noise=-60dB:duration=0.9"),
*("-filter", "silencedetect=noise=0.15:duration=1"),
) )
starts, ends = [], [] starts, ends = [], []

View File

@ -23,28 +23,28 @@ FILES = [
# 8s -> 9s: silence # 8s -> 9s: silence
# 9s -> 12s: musik # 9s -> 12s: musik
# 12s -> 15s: pink noise fade out # 12s -> 15s: pink noise fade out
Fixture(here / "s1-jointstereo.mp3", 15.0, 6.0, 13.0, -5.9 ), Fixture(here / "s1-jointstereo.mp3", 15.0, 1.4, 15.0, -5.9 ),
Fixture(here / "s1-mono.mp3", 15.0, 6.0, 13.0, -2.0 ), Fixture(here / "s1-mono.mp3", 15.0, 1.5, 15.0, -2.0 ),
Fixture(here / "s1-stereo.mp3", 15.0, 6.0, 13.0, -5.9 ), Fixture(here / "s1-stereo.mp3", 15.0, 1.4, 15.0, -5.9 ),
Fixture(here / "s1-mono-12.mp3", 15.0, 9.0, 12.0, +7.0 ), Fixture(here / "s1-mono-12.mp3", 15.0, 1.2, 15.0, +7.0 ),
Fixture(here / "s1-stereo-12.mp3", 15.0, 9.0, 12.0, +6.1 ), Fixture(here / "s1-stereo-12.mp3", 15.0, 1.2, 15.0, +6.1 ),
Fixture(here / "s1-mono+12.mp3", 15.0, 3.5, 13.0, -17.0 ), Fixture(here / "s1-mono+12.mp3", 15.0, 1.2, 15.0, -17.0 ),
Fixture(here / "s1-stereo+12.mp3", 15.0, 3.5, 13.0, -17.8 ), Fixture(here / "s1-stereo+12.mp3", 15.0, 1.2, 15.0, -17.8 ),
Fixture(here / "s1-mono.flac", 15.0, 6.0, 13.0, -2.3 ), Fixture(here / "s1-mono.flac", 15.0, 1.4, 15.0, -2.3 ),
Fixture(here / "s1-stereo.flac", 15.0, 6.0, 13.0, -6.0 ), Fixture(here / "s1-stereo.flac", 15.0, 1.4, 15.0, -6.0 ),
Fixture(here / "s1-mono-12.flac", 15.0, 9.0, 12.0, +10.0 ), Fixture(here / "s1-mono-12.flac", 15.0, 2.0, 15.0, +10.0 ),
Fixture(here / "s1-stereo-12.flac", 15.0, 9.0, 12.0, +5.9 ), Fixture(here / "s1-stereo-12.flac", 15.0, 1.8, 15.0, +5.9 ),
Fixture(here / "s1-mono+12.flac", 15.0, 3.5, 13.0, -12.0 ), Fixture(here / "s1-mono+12.flac", 15.0, 0.0, 15.0, -12.0 ),
Fixture(here / "s1-stereo+12.flac", 15.0, 3.5, 13.0, -14.9 ), Fixture(here / "s1-stereo+12.flac", 15.0, 0.0, 15.0, -14.9 ),
Fixture(here / "s1-mono.m4a", 15.0, 6.0, 13.0, -4.5 ), Fixture(here / "s1-mono.m4a", 15.0, 1.4, 15.0, -4.5 ),
Fixture(here / "s1-stereo.m4a", 15.0, 6.0, 13.0, -5.8 ), Fixture(here / "s1-stereo.m4a", 15.0, 1.4, 15.0, -5.8 ),
Fixture(here / "s1-mono.ogg", 15.0, 6.0, 13.0, -4.9 ), Fixture(here / "s1-mono.ogg", 15.0, 1.4, 15.0, -4.9 ),
Fixture(here / "s1-stereo.ogg", 15.0, 6.0, 13.0, -5.7 ), Fixture(here / "s1-stereo.ogg", 15.0, 1.4, 15.0, -5.7 ),
Fixture(here / "s1-stereo", 15.0, 6.0, 13.0, -5.7 ), Fixture(here / "s1-stereo", 15.0, 1.4, 15.0, -5.7 ),
Fixture(here / "s1-mono.wav", 15.0, 6.0, 13.0, -2.3 ), Fixture(here / "s1-mono.wav", 15.0, 1.5, 15.0, -2.3 ),
Fixture(here / "s1-stereo.wav", 15.0, 6.0, 13.0, -6.0 ), Fixture(here / "s1-stereo.wav", 15.0, 1.4, 15.0, -6.0 ),
# sample 1 large (looped for 2 hours) # 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 # sample 2
# 0s -> 1.8s: silence # 0s -> 1.8s: silence
# 1.8s : noise # 1.8s : noise