nas: investigate enabling Dolby Atmos (spatial audio) downloads in Libation #363

Open
opened 2026-08-16 10:26:45 +02:00 by dominik.polakovics · 0 comments

Follow-up to #360 / !362. The Libation sync on nas downloads the standard AAC-LC version of every book, including titles Audible flags as Dolby Atmos. Investigate whether spatial-audio downloads can be enabled.

Confirmed current behaviour

Verified against libation 13.3.6 as packaged in nixos-26.05 (decompiled LibationFileManager.dll / FileLiberator.dll, cross-checked against the tagged upstream source and a live libationcli get-setting run).

ffprobe on a title that Libation badges with the Dolby Atmos logo on nb reports channels=2 — i.e. the standard stereo AAC download, not the spatial stream. This is not a nas-specific regression; it is what Libation does everywhere today.

Why it does not work

Two independent blockers, either one sufficient on its own:

1. RequestSpatial is stubbed out upstream in 13.3.6.

Source/LibationFileManager/Configuration.PersistentSettings.cs:311:

//[Description("Request Spatial Audio")]
public bool RequestSpatial { get => false; set { } } // { get => GetNonString(defaultValue: true); set => SetNonString(value); }

Hardcoded false, setter a no-op, real implementation commented out. Because it carries no [Description] attribute it is not even exposed as a setting — libationcli get-setting RequestSpatial returns Unknown Setting Name, and adding it to our generated Settings.json would be silently ignored. The matching checkbox and codec dropdown are likewise commented out in Source/LibationAvalonia/Controls/Settings/Audio.axaml:66-90.

SpatialAudioCodec (EC_3 | AC_4, default EC_3) is still readable, but it is dead config — it is only consumed inside the RequestSpatial license request.

2. Spatial only exists on the Widevine codepath, which we do not enable.

Source/FileLiberator/DownloadOptions.Factory.cs:112:

bool canUseWidevine = api.SupportsWidevine();
if (!config.UseWidevine || !canUseWidevine || await Cdm.GetCdmAsync() is not Cdm cdm)
{
    ...
    var license = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId, dlQuality);
    return LicenseInfo.Create(license);   // classic ADRM/AAX path — spatial never requested
}

RequestSpatial and SpatialAudioCodec are read only below that early return. hosts/nas/modules/libation.nix leaves UseWidevine at its default of false, so we always take the ADRM branch.

The Atmos logo and the "Is Spatial" grid column (ProductsDisplay.axaml:268, BookDetailsDialog.axaml:25) come from Book.IsSpatial, imported from the Audible catalogue API in DtoImporterService/BookImporter.cs:196. They describe the title, not the downloaded file — which is why this is easy to misread as working.

What triage needs to decide

  1. Has upstream re-enabled it? Check Libation releases after 13.3.6 for line 311 becoming live again. This is the gating question — nothing else matters until it is. Note the commented-out default is defaultValue: true, so a version bump that re-enables it makes spatial opt-out; if we do not want it, we would need to pin RequestSpatial = false explicitly at that point.
  2. Are we willing to turn on Widevine? UseWidevine = true additionally requires the Audible account to be registered as an Android device — otherwise Libation logs Account {account} is not registered as an android device and silently falls back to ADRM. Our account is currently seeded via libation-cli login-external; whether that registers as an Android device is unverified. Re-adding the account is a manual, interactive step on nas.
  3. Do we actually want the files? Spatial downloads are E-AC-3 or AC-4. E-AC-3 is much larger than AAC-LC (a real cost on nas), and Audiobookshelf clients transcoding either codec is its own question. AC-4 in particular has thin player support. Possibly worth a spike on one book before committing.
  4. Does Libation's post-processing survive it? AllowLibationFixup / chapter splitting / m4b muxing are all exercised against AAC today; the EC-3 path is untested here. FindBetterQualityBooksViewModel.cs:71 explicitly skips spatial books ("when querying the /metadata endpoint, it will only show ac-4 data for spatial audiobooks"), which hints the spatial path is not fully wired through upstream either.

If it is enabled

Changes would be confined to the settingsFile template in hosts/nas/modules/libation.nix: add UseWidevine = true; and RequestSpatial = true; (plus SpatialAudioCodec if we prefer AC_4), followed by a one-off re-login on nas to register the account as an Android device.

Worth noting while debugging: the module sets Serilog MinimumLevel = "Warning", which suppresses the one line that reports what was actually requested —

Log.Logger.Information("Download Settings {@Settings}", new { config.FileDownloadQuality, config.UseWidevine, config.Request_xHE_AAC, config.RequestSpatial, config.SpatialAudioCodec });

Temporarily dropping to Information is the quickest way to confirm the request Libation sends. Beware that at Information Libation double-emits plain console lines.

Acceptance

A book Audible flags as spatial, downloaded by libation-sync on nas, reports codec_name=eac3 (or ac4) and channels > 2 under ffprobe, plays in Audiobookshelf, and the size increase is judged acceptable — or the issue is closed wontfix with the reason recorded.

Follow-up to #360 / !362. The Libation sync on `nas` downloads the **standard AAC-LC** version of every book, including titles Audible flags as Dolby Atmos. Investigate whether spatial-audio downloads can be enabled. ## Confirmed current behaviour Verified against `libation` 13.3.6 as packaged in nixos-26.05 (decompiled `LibationFileManager.dll` / `FileLiberator.dll`, cross-checked against the tagged upstream source and a live `libationcli get-setting` run). `ffprobe` on a title that Libation badges with the Dolby Atmos logo on `nb` reports `channels=2` — i.e. the standard stereo AAC download, not the spatial stream. This is not a `nas`-specific regression; it is what Libation does everywhere today. ## Why it does not work Two independent blockers, either one sufficient on its own: **1. `RequestSpatial` is stubbed out upstream in 13.3.6.** `Source/LibationFileManager/Configuration.PersistentSettings.cs:311`: ```csharp //[Description("Request Spatial Audio")] public bool RequestSpatial { get => false; set { } } // { get => GetNonString(defaultValue: true); set => SetNonString(value); } ``` Hardcoded `false`, setter a no-op, real implementation commented out. Because it carries no `[Description]` attribute it is not even exposed as a setting — `libationcli get-setting RequestSpatial` returns `Unknown Setting Name`, and adding it to our generated `Settings.json` would be silently ignored. The matching checkbox and codec dropdown are likewise commented out in `Source/LibationAvalonia/Controls/Settings/Audio.axaml:66-90`. `SpatialAudioCodec` (`EC_3` | `AC_4`, default `EC_3`) *is* still readable, but it is dead config — it is only consumed inside the `RequestSpatial` license request. **2. Spatial only exists on the Widevine codepath, which we do not enable.** `Source/FileLiberator/DownloadOptions.Factory.cs:112`: ```csharp bool canUseWidevine = api.SupportsWidevine(); if (!config.UseWidevine || !canUseWidevine || await Cdm.GetCdmAsync() is not Cdm cdm) { ... var license = await api.GetDownloadLicenseAsync(libraryBook.Book.AudibleProductId, dlQuality); return LicenseInfo.Create(license); // classic ADRM/AAX path — spatial never requested } ``` `RequestSpatial` and `SpatialAudioCodec` are read only *below* that early return. `hosts/nas/modules/libation.nix` leaves `UseWidevine` at its default of `false`, so we always take the ADRM branch. The Atmos logo and the "Is Spatial" grid column (`ProductsDisplay.axaml:268`, `BookDetailsDialog.axaml:25`) come from `Book.IsSpatial`, imported from the Audible catalogue API in `DtoImporterService/BookImporter.cs:196`. They describe the *title*, not the downloaded file — which is why this is easy to misread as working. ## What triage needs to decide 1. **Has upstream re-enabled it?** Check Libation releases after 13.3.6 for line 311 becoming live again. This is the gating question — nothing else matters until it is. Note the commented-out default is `defaultValue: true`, so a version bump that re-enables it makes spatial **opt-out**; if we do not want it, we would need to pin `RequestSpatial = false` explicitly at that point. 2. **Are we willing to turn on Widevine?** `UseWidevine = true` additionally requires the Audible account to be registered as an Android device — otherwise Libation logs `Account {account} is not registered as an android device` and silently falls back to ADRM. Our account is currently seeded via `libation-cli login-external`; whether that registers as an Android device is unverified. Re-adding the account is a manual, interactive step on `nas`. 3. **Do we actually want the files?** Spatial downloads are E-AC-3 or AC-4. E-AC-3 is much larger than AAC-LC (a real cost on `nas`), and Audiobookshelf clients transcoding either codec is its own question. AC-4 in particular has thin player support. Possibly worth a spike on one book before committing. 4. **Does Libation's post-processing survive it?** `AllowLibationFixup` / chapter splitting / m4b muxing are all exercised against AAC today; the EC-3 path is untested here. `FindBetterQualityBooksViewModel.cs:71` explicitly skips spatial books ("when querying the /metadata endpoint, it will only show ac-4 data for spatial audiobooks"), which hints the spatial path is not fully wired through upstream either. ## If it is enabled Changes would be confined to the `settingsFile` template in `hosts/nas/modules/libation.nix`: add `UseWidevine = true;` and `RequestSpatial = true;` (plus `SpatialAudioCodec` if we prefer `AC_4`), followed by a one-off re-login on `nas` to register the account as an Android device. Worth noting while debugging: the module sets Serilog `MinimumLevel = "Warning"`, which suppresses the one line that reports what was actually requested — ```csharp Log.Logger.Information("Download Settings {@Settings}", new { config.FileDownloadQuality, config.UseWidevine, config.Request_xHE_AAC, config.RequestSpatial, config.SpatialAudioCodec }); ``` Temporarily dropping to `Information` is the quickest way to confirm the request Libation sends. Beware that at `Information` Libation double-emits plain console lines. ## Acceptance A book Audible flags as spatial, downloaded by `libation-sync` on `nas`, reports `codec_name=eac3` (or `ac4`) and `channels > 2` under `ffprobe`, plays in Audiobookshelf, and the size increase is judged acceptable — **or** the issue is closed `wontfix` with the reason recorded.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos#363
No description provided.