replaygain: add metaflac backend#6800
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6800 +/- ##
==========================================
+ Coverage 74.88% 75.47% +0.58%
==========================================
Files 163 163
Lines 20998 21054 +56
Branches 3307 3312 +5
==========================================
+ Hits 15725 15890 +165
+ Misses 4519 4393 -126
- Partials 754 771 +17
🚀 New features to boost your workflow:
|
5b41a28 to
345b72f
Compare
|
Pushed some updates, this is ready for review whenever you have a chance. Thanks. |
345b72f to
680227a
Compare
snejus
left a comment
There was a problem hiding this comment.
Looks good, have you tested it yourself?
| for item in task.items: | ||
| if self.format_supported(item): |
There was a problem hiding this comment.
| for item in task.items: | |
| if self.format_supported(item): | |
| for item in filter(self.format_supported, task.items): |
There was a problem hiding this comment.
Yes. I ran it locally on a FLAC file with the metaflac backend and it wrote the correct ReplayGain tags (track gain got arund -11.5 dB, peak close to 1.0). The metaflac tests also pass on my machine.
|
|
||
|
|
||
| class MetaflacBackendMixin(BackendMixin): | ||
| plugin_config: ClassVar[dict[str, Any]] = {"backend": "metaflac"} |
There was a problem hiding this comment.
Would you mind installing flac in this part of the workflow, in ci.yaml?
- name: Install system dependencies on UbuntuThere was a problem hiding this comment.
Thanks @snejus for the review. I updated the track loop to use filter like you suggested and also added flac to the Ubuntu deps so the metaflac tests run on CI. All clear now, both pushed.
Add a MetaflacBackend that computes ReplayGain for FLAC files with metaflac --add-replay-gain and reads the values back with --show-tag. Only FLAC is supported. Includes docs, a changelog entry, and tests.
4c55afc to
2d354c2
Compare
Closes #1203
The replaygain plugin can't compute ReplayGain when metaflac is the only tool available. The existing backends (command, gstreamer, audiotools, ffmpeg) each need something heavier installed, which doesn't work on minimal setups like a NAS where those won't install. Issue #1203 asks for a metaflac based option so FLAC users on those setups can still tag ReplayGain.
This adds a metaflac backend for that case. It runs
metaflac --add-replay-gainto compute the gain and reads the values back withmetaflac --show-tag. I modeled it on the existingCommandBackendsince both wrap an external tool. It only handles FLAC, skips other formats, and shifts the gain to the configuredtargetlevellike the other backends.One limitation: metaflac scans a whole album in one pass, so the files of an album need the same sample rate and channel layout.
Before, selecting the metaflac backend failed:
After, the backend works and the plugin tests pass:
The 4 skipped are the Opus R128 cases, which don't apply to the metaflac path.
To Do