Releases whose only audio file is `.mp4` are rejected with "No audio files were registered"

Aperta
#995 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend, databases

Direzione di ricerca

Start with listenarr.domain/Common/FileUtils.cs:44-56 and the scanner call sites named in the issue, then read listenarr.infrastructure/Ffmpeg/Installation/FfmpegService.Probing.cs. Compare the import and scanning paths before choosing among the listed options; the issue leaves that behavior as a product decision. Done means .mp4 audio imports without causing video files to be scanned as audiobooks, or the limitation is explicitly retained.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

p3

Summary

A release whose payload is a single .mp4 file registers zero audio files and lands in Import Blocked with "No audio files were registered after file import" on the first attempt. The cause is that .mp4 is not in the recognized audio extension set, even though .m4a and .m4b (which are also MP4 containers) are and import cleanly.

This came up in the discussion on #890; I am splitting it out as its own issue so a fix has a home and the case is trackable. There is a real design tradeoff here, which is why I am filing it as an issue rather than opening a PR straight away.

Where it comes from

AudioExtensions in listenarr.domain/Common/FileUtils.cs:44-48 is a fixed 14-entry set:

.aac .aif .aiff .alac .ape .flac .m4a .m4b .mp3 .ogg .opus .wav .wma .wv

.mp4 is not present. IsAudioFile (same file, line 55) is a pure extension check against that set, so a .mp4 file is treated as a non-audio file everywhere IsAudioFile is consulted. (Read: FileUtils.cs:44-56.)

Because .m4a and .m4b are themselves MP4 containers and both import fine, the thing that rejects the file is the extension string, not the container format. (Measured on stock ghcr.io/listenarrs/listenarr:canary at a630572e: a release carrying only a .mp4 went straight to Import Blocked with "No audio files were registered after file import"; the same content renamed to .m4a imported.)

Why this is not just "add .mp4 to the set"

The same FileUtils.AudioExtensions / IsAudioFile set also feeds the library scanner, not only the download import path. For example:

  • listenarr.infrastructure/Library/Scanning/ScanFileDiscovery.Enumeration.cs:76 collects scan candidates with FileUtils.IsAudioFile.
  • listenarr.infrastructure/Library/Scanning/AudiobookScanService.ExistingRegistration.cs:24 filters existing registrations the same way.
  • listenarr.infrastructure/Metadata/Jobs/MetadataRescanService.cs:100 gates rescans on it (also :201).

(Read: the three call sites above.)

So adding a bare .mp4 to the set outright would also mean any stray video .mp4 sitting under a library folder gets discovered and scanned as an audiobook. That is the reason a blind addition is risky: .mp4 genuinely is ambiguous in a way .m4a/.m4b are not.

Worth noting: Readarr (the closest lineage for this) makes exactly this distinction. Its audio extension map recognizes .m4a, .m4b, .m4p, and .mp4a but deliberately omits bare .mp4 (src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs, the _audioExtensions dictionary). (Read.)

Options

  1. Accept .mp4 only when the file actually carries an audio stream, probed by content. The tree already bundles ffprobe and calls it with -show_streams (listenarr.infrastructure/Ffmpeg/Installation/FfmpegService.Probing.cs), so the audio/video question can be answered from the file rather than from its name. This keeps the extension-only fast path honest for the scanner while letting genuine audio-in-mp4 releases import. It is more code, and the current probe helper itself gates on IsAudioFile first (Probing.cs:44), so that gate would need to allow .mp4 through to the probe. (Read.)
  2. Add .mp4 to AudioExtensions outright. Smallest change, but it inherits the scanner consequence above: stray video files scan as audio.
  3. Document the limitation and do nothing; users rename to .m4a/.m4b as a workaround.

If it were my call I would build option 1, since it is the only one that fixes import without teaching the scanner to swallow video, and it matches the Readarr precedent of keeping the ambiguous extension out of a name-only set. But the scanner tradeoff is a product decision, so I would rather ask than assume.

I have a tentative branch for option 1 in progress (fix/mp4-audio-import) and am happy to open it as a PR if that is the direction you want. It is not finished, so I am not claiming it is ready.

The retry-and-exception-logging behavior around this same "no audio files" failure is a separate matter already covered in #930 and #933; I am not re-reporting it here.

Environment

Reproduced on stock ghcr.io/listenarrs/listenarr:canary at commit a630572e.


Disclosure: drafted with Claude Code at my direction; I read the cited code at the stated commit and reviewed this before posting.

Lingua principale
C#
Stelle
901
Fork
70
Merge medio
16h 27m
PR unite (30g)
60

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Listenarrs/Listenarr

Tutte le issue di Listenarrs/Listenarr

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.