Files
tdarr-plugs/agent_notes/implementation_plan.md
Tdarr Plugin Developer aa71eb96d7 Initial commit: Tdarr plugin stack
Plugins:
- misc_fixes v2.8: Pre-processing, container remux, stream conforming
- stream_organizer v4.8: English priority, subtitle extraction, SRT conversion
- combined_audio_standardizer v1.13: AAC/Opus encoding, downmix creation
- av1_svt_converter v2.22: AV1 video encoding via SVT-AV1

Structure:
- Local/ - Plugin .js files (mount in Tdarr)
- agent_notes/ - Development documentation
- Latest-Reports/ - Error logs for analysis
2025-12-15 11:33:36 -08:00

2.4 KiB

Implementation Plan - Misc Fixes "Megamix"

Goal

Integrate functionality from Migz1Remux, MigzImageRemoval, and lmg1_Reorder_Streams into Tdarr_Plugin_misc_fixes.js.

Proposed Changes

1. New Inputs

Name Type Default Description
target_container String mkv Output container (mkv/mp4)
force_conform Boolean true Drop incompatible streams (e.g. mov_text in MKV)
remove_image_streams Boolean true Remove MJPEG/PNG/GIF video streams
ensure_video_first Boolean true Reorder streams: Video → Audio → Subtitles
fix_ts_timestamps Boolean true (Existing) Fix TS timestamp issues

2. Logic Flow

  1. Load Inputs & Defaults.
  2. Determine Action Needed:
    • Compare file.container vs inputs.target_container.
    • Check fix_ts_timestamps (TS/AVI/MPG).
  3. Stream Analysis Loop:
    • Image Removal: IF remove_image_streams:
      • Check codec_name (mjpeg, png, gif).
      • Add -map -0:idx to drop list.
    • Conform: IF force_conform:
      • MKV: Drop mov_text, eia_608, timed_id3, data streams.
      • MP4: Drop hdmv_pgs_subtitle, eia_608, subrip (srt?), timed_id3.
      • Note: Migz drops srt (subrip) for MP4? FFmpeg supports tx3g, maybe not srt in mp4 in older versions? I'll stick to Migz logic but allow srt if modern. -> Migz explicitly drops 'subrip' for MP4. I will follow Migz logic for safety but might note it.
  4. Construct Command:
    • Pre-input args:
      • If TS/AVI/MPG: -fflags +genpts.
      • If TS & fix_ts_timestamps: -fflags +genpts+igndts -avoid_negative_ts make_zero.
    • Mapping:
      • If ensure_video_first: -map 0:v? -map 0:a? -map 0:s? -map 0:d? -map 0:t?
      • Else: -map 0
    • Drops: Append -map -0:idx for all dropped streams.
    • Container: Set output container to target_container.

3. Execution

  • Execute if:
    • Container mismatch.
    • Dropping streams (extraArguments > 0).
    • Fixing timestamps (TS/AVI).
    • Reordering needed? (Maybe always run if "Video First" is on and we want to enforce it).

Verification Plan

  • Check TS files (ensure flags still apply).
  • Check MKV targets (ensure mov_text dropped).
  • Check MP4 targets (ensure pgs dropped).
  • Check image removal.