nilaoda/N_m3u8DL-RE · error · FileNotFoundException

ResString.shakaPackagerNotFound

Error message

ResString.shakaPackagerNotFound

What it means

If the decryption engine is SHAKA_PACKAGER, DoWorkAsync locates the shaka-packager executable via FindShakaPackager(); when it cannot be found it throws FileNotFoundException with the localized 'shaka-packager not found' message. Widevine decryption with the shaka engine cannot proceed without it.

Solutions

  1. Install shaka-packager and ensure it is on PATH (verify with: shaka-packager --help)
  2. Point the tool at it explicitly via --decryption-binary-path
  3. Switch engines: --decryption-engine MP4DECRYPT with mp4decrypt installed (Bento4)
  4. Remove --use-shaka-packager if decryption is not actually needed

Example fix

// before
N_m3u8DL-RE "URL" --use-shaka-packager --key KID:KEY
// after
N_m3u8DL-RE "URL" --decryption-engine MP4DECRYPT --decryption-binary-path /usr/bin/mp4decrypt --key KID:KEY
Defensive patterns

Strategy: validation

Validate before calling

if (decryptionEngine == DecryptEngine.SHAKA_PACKAGER && FindShakaPackager() == null)
    throw new FileNotFoundException("shaka-packager not installed; install it or use MP4DECRYPT engine");

Type guard

static bool ShakaAvailable() => FindShakaPackager() != null;

Try / catch

try { await DoWorkAsync(option); }
catch (FileNotFoundException ex) when (ex.Message.Contains("shakaPackager") || ex.Message.Contains("shaka"))
{
    Console.Error.WriteLine("shaka-packager not found: install it or switch to --decryption-engine MP4DECRYPT");
}

Prevention

When it happens

Trigger: --decryption-engine SHAKA_PACKAGER (or --use-shaka-packager which forces it) combined with content keys, while shaka-packager is absent from PATH and known install locations.

Common situations: Users enabling shaka-packager decryption without installing it (it's a separate Python/Node tool); PATH not updated after install; Windows systems where the binary is named shaka-packager.exe but not on PATH.

Related errors


AI-assisted analysis of nilaoda/N_m3u8DL-RE@e113dee70c (2026-09-13). Data as JSON: /api/errors/59574be348a4d111. Report an issue: GitHub.

Appendix: source

Thrown at src/N_m3u8DL-RE/Program.cs:163

            {
                throw new FileNotFoundException(ResString.mkvmergeNotFound);
            }
            Logger.Extra($"mkvmerge => {option.MkvmergeBinaryPath}");
        }

        // 预先检查
        if (option.Keys is { Length: > 0 } || option.KeyTextFile != null)
        {
            if (!string.IsNullOrEmpty(option.DecryptionBinaryPath) && !File.Exists(option.DecryptionBinaryPath))
            {
                throw new FileNotFoundException(option.DecryptionBinaryPath);
            }
            switch (option.DecryptionEngine)
            {
                case DecryptEngine.SHAKA_PACKAGER:
                {
                    var file = FindShakaPackager();
                    if (file == null) throw new FileNotFoundException(ResString.shakaPackagerNotFound);
                    option.DecryptionBinaryPath = file;
                    Logger.Extra($"shaka-packager => {option.DecryptionBinaryPath}");
                    break;
                }
                case DecryptEngine.MP4DECRYPT:
                {
                    var file = GlobalUtil.FindExecutable("mp4decrypt");
                    if (file == null) throw new FileNotFoundException(ResString.mp4decryptNotFound);
                    option.DecryptionBinaryPath = file;
                    Logger.Extra($"mp4decrypt => {option.DecryptionBinaryPath}");
                    break;
                }
                case DecryptEngine.FFMPEG:
                default:
                    option.DecryptionBinaryPath = option.FFmpegBinaryPath;
                    break;
            }
        }

View on GitHub (pinned to e113dee70c)