Fix ab-av1 detection in Docker environments (v2.31)

- Fixed: Binary exists but X_OK check fails on Docker mounts
- Added: 'which ab-av1' fallback detection
- Added: Better debug logging when X_OK check fails
- Binary will now be found even with permission issues
This commit is contained in:
Tdarr Plugin Developer
2025-12-15 21:12:56 -08:00
parent 4be3310d7e
commit 2b40a8451b
3 changed files with 741 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -10,7 +10,7 @@ const details = () => ({
Features resolution-aware CRF, source-relative bitrate strategies, ab-av1 auto-CRF, and performance optimizations.
**Balanced defaults**: Preset 6, CRF 26, tune 0 (VQ), 10-bit, SCD 1, AQ 2, lookahead -1, TF on, keyint -2, fast-decode 0.
`,
Version: '2.30',
Version: '2.31',
Tags: 'video,av1,svt,quality,performance,speed-optimized,vbr,crf,vmaf',
Inputs: [
{
@@ -440,12 +440,21 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
// Detect ab-av1 binary path with multi-level fallback
const getAbAv1Path = () => {
const fs = require('fs');
const { execSync } = require('child_process');
// Try environment variable first
const envPath = (process.env.ABAV1_PATH || '').trim();
if (envPath) {
try {
if (require('fs').existsSync(envPath)) {
require('fs').accessSync(envPath, require('fs').constants.X_OK);
if (fs.existsSync(envPath)) {
// Try to check executable, but don't fail if check errors
try {
fs.accessSync(envPath, fs.constants.X_OK);
} catch (accessErr) {
// File exists but X_OK check failed - try anyway (Docker mount issue)
response.infoLog += `Note: ab-av1 at ${envPath} exists but X_OK check failed, trying anyway.\n`;
}
return envPath;
}
} catch (e) {
@@ -459,17 +468,34 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
'/usr/bin/ab-av1',
];
for (const path of commonPaths) {
for (const checkPath of commonPaths) {
try {
if (require('fs').existsSync(path)) {
require('fs').accessSync(path, require('fs').constants.X_OK);
return path;
if (fs.existsSync(checkPath)) {
// Try to check executable, but don't fail if check errors
try {
fs.accessSync(checkPath, fs.constants.X_OK);
} catch (accessErr) {
// File exists but X_OK check failed - try anyway (Docker mount issue)
response.infoLog += `Note: ab-av1 at ${checkPath} exists but X_OK check failed, trying anyway.\n`;
}
return checkPath;
}
} catch (e) {
// Continue to next path
}
}
// Fallback: Try 'which' command to find ab-av1 in PATH
try {
const whichResult = execSync('which ab-av1', { encoding: 'utf8', timeout: 5000 }).trim();
if (whichResult && fs.existsSync(whichResult)) {
response.infoLog += `Found ab-av1 via 'which': ${whichResult}\n`;
return whichResult;
}
} catch (e) {
// which failed or ab-av1 not in PATH
}
// Not found in any known location
return null;
};

View File

@@ -1,7 +1,7 @@
# Tdarr Plugin Suite Documentation
> **Version**: 2025-12-15
> **Plugins**: misc_fixes v2.8 | stream_organizer v4.10 | audio_standardizer v1.15 | av1_converter v2.30
> **Version**: 2025-12-16
> **Plugins**: misc_fixes v2.8 | stream_organizer v4.10 | audio_standardizer v1.15 | av1_converter v2.31
---