- Added VMAF quality-targeted mode to av1_svt_converter (v2.25) - Fixed documentation version mismatch (misc_fixes v2.8, stream_organizer v4.10, audio_standardizer v1.15) - Updated rate control documentation with VMAF mode details - Added vmaf_target and vmaf_samples input options - Added ab-av1 binary detection with ABAV1_PATH env var support
118 lines
4.4 KiB
Markdown
118 lines
4.4 KiB
Markdown
# Plugin Code Review
|
||
|
||
## Tdarr_Plugin_combined_audio_standardizer.js
|
||
|
||
### Critical Bug: Unnecessary Downmix Creation
|
||
|
||
**Location**: Lines 760-786
|
||
|
||
**Problem**: The downmix logic runs if `create_downmix === 'true'`, but then checks if stereo tracks exist. If none exist, it tries to create a downmix from `channels === 6 || channels === 8` tracks. However, if the file **only** has stereo tracks and no 5.1/7.1 tracks, nothing happens - but this is handled correctly.
|
||
|
||
**The ACTUAL bug** is in the log outputs from your logs. Looking at the code more carefully:
|
||
```javascript
|
||
if (existing2chTracks.length > 0) {
|
||
response.infoLog += `Skipping 2ch downmix - ${existing2chTracks.length} stereo track(s) already exist.`;
|
||
} else {
|
||
// Only create downmix from 6ch or 8ch sources
|
||
for (const stream of audioStreams) {
|
||
if ((stream.channels === 6 || stream.channels === 8) && ...)
|
||
```
|
||
|
||
This logic is **correct** - it only downmixes from 6ch/8ch. If the file has only stereo, no downmix will be created.
|
||
|
||
**But wait** - the user says it's creating downmixes when only stereo exists. Let me re-check: The condition `existing2chTracks.length > 0` should skip the downmix block entirely. If it's still creating downmixes, there might be a different issue.
|
||
|
||
**Possible causes:**
|
||
1. The codec conversion loop (lines 703-753) might be triggering `processNeeded = true` independently
|
||
2. The `downmix_single_track` setting might be causing unexpected behavior
|
||
3. Race condition with the `is2channelAdded` flag
|
||
|
||
---
|
||
|
||
### Confirmed Issues
|
||
|
||
#### 1. Duplicate Description Line (Line 10-11)
|
||
```javascript
|
||
downmixed tracks (8ch->6ch, 6ch/8ch->2ch) when they don't exist.
|
||
downmixed tracks (8ch->6ch, 6ch/8ch->2ch) when they don't exist. // DUPLICATE
|
||
```
|
||
|
||
#### 2. Missing Default Markers on Some Options
|
||
The following options are missing the `*` marker to indicate default values:
|
||
- `channel_mode`: `'preserve'` should be `'preserve*'`
|
||
- `opus_application`: `'audio'` should be `'audio*'`
|
||
- `opus_vbr`: `'on'` should be `'on*'`
|
||
- `quality_preset`: `'custom'` should be `'custom*'`
|
||
|
||
#### 3. Tooltip Improvements Needed
|
||
- `create_downmix` tooltip says "Create additional stereo (2ch) downmix tracks from multichannel audio (5.1/7.1)" but should clarify: **"Only creates downmix if no stereo tracks exist. Requires 5.1 (6ch) or 7.1 (8ch) source."**
|
||
|
||
#### 4. Naming Inconsistency: "2.0 Downmix" Title
|
||
Line 457 uses `${channels}.0 Downmix` which produces "2.0 Downmix" for stereo. This is correct standard notation (2.0 = stereo), but consider if "Stereo Downmix" would be clearer.
|
||
|
||
---
|
||
|
||
### Logic Flow Issue: `processNeeded` and `needsTranscode`
|
||
|
||
**Location**: Lines 665-671
|
||
|
||
```javascript
|
||
if (!needsTranscode && inputs.create_downmix !== 'true') {
|
||
response.infoLog += '✅ File already meets all requirements.\n';
|
||
return response;
|
||
}
|
||
```
|
||
|
||
This early return happens if:
|
||
- No audio needs transcoding AND
|
||
- `create_downmix` is not enabled
|
||
|
||
**Problem**: If `create_downmix === 'true'` but no multichannel audio exists, the plugin continues processing but `processNeeded` may never become true, leading to:
|
||
1. Extra processing cycles
|
||
2. Misleading log messages
|
||
|
||
**Fix**: Add an early check for multichannel audio availability when `create_downmix === 'true'`.
|
||
|
||
---
|
||
|
||
## Tdarr_Plugin_stream_organizer.js
|
||
|
||
### No Critical Bugs Found
|
||
|
||
The stream organizer code appears well-structured after the v4.10 fix.
|
||
|
||
### Minor Issues
|
||
|
||
#### 1. customEnglishCodes Naming
|
||
The variable `customEnglishCodes` is used for priority language codes, but the setting allows any language codes (not just English). Consider renaming to `priorityLanguageCodes`.
|
||
|
||
#### 2. Unused Parameter in `needsSubtitleExtraction`
|
||
```javascript
|
||
const needsSubtitleExtraction = (subsFile, sourceFile, fs) => {
|
||
```
|
||
The `sourceFile` parameter is never used inside the function.
|
||
|
||
---
|
||
|
||
## Recommended Changes
|
||
|
||
### 1. Fix Duplicate Description
|
||
Remove line 11 (duplicate of line 10).
|
||
|
||
### 2. Add Missing Default Markers
|
||
Update dropdowns to show `*` on default options.
|
||
|
||
### 3. Improve Downmix Logic Guard
|
||
Add early exit when `create_downmix === 'true'` but no multichannel sources exist:
|
||
```javascript
|
||
if (inputs.create_downmix === 'true') {
|
||
const hasMultichannel = audioStreams.some(s => s.channels >= 6);
|
||
if (!hasMultichannel && existing2chTracks.length > 0) {
|
||
response.infoLog += 'ℹ️ Downmix skipped - only stereo tracks present.\n';
|
||
}
|
||
}
|
||
```
|
||
|
||
### 4. Improve Tooltips
|
||
Update `create_downmix` tooltip to clarify behavior.
|