Commit Graph

443 Commits

Author SHA1 Message Date
d630cea8d6 Skip filters during remux 2025-12-24 02:33:28 -05:00
47975ac0f5 Lock remux aspect controls to Source 2025-12-24 02:31:34 -05:00
be4ef2303b Hide encode controls for remux 2025-12-24 02:29:15 -05:00
2490cb4970 Add remux option to Convert 2025-12-24 02:22:07 -05:00
8c12ae059d Show benchmark apply status in Convert header 2025-12-24 01:55:37 -05:00
0d7fd09ac1 Add player robustness improvements and A/V sync logging
Improvements:
1. Track audio active state with atomic.Bool flag
2. Handle videos without audio track gracefully
   - If audio fails to start, video plays at natural frame rate
   - Clear error messages indicate "video-only playback"
3. Better A/V sync logging for debugging
   - Log when video ahead/behind and actions taken
   - Log good sync status periodically (every ~6 seconds at 30fps)
   - More granular logging for different sync states
4. Proper cleanup when audio stream ends or fails

How it works:
- audioActive flag set to true when audio starts successfully
- Set to false when audio fails to start or ends
- Video checks audioActive before syncing to audio clock
- If no audio: video just paces at natural frame rate (no sync)
- If audio active: full A/V sync with adaptive timing

Expected improvements:
- Video-only files (GIFs, silent videos) play smoothly
- Better debugging info for sync quality
- Graceful degradation when audio missing
2025-12-24 01:44:08 -05:00
eb5db177d6 Fix merge badge color 2025-12-24 01:42:57 -05:00
615581b4a3 Reset merge output on clear 2025-12-24 01:38:57 -05:00
e0982109ba Implement audio master clock for A/V synchronization
Priority 3 fix from PLAYER_PERFORMANCE_ISSUES.md - addresses the root
cause of A/V desync in player module.

Changes:
- Audio loop now tracks bytes written and updates master clock (audioTime)
- Audio clock calculation: bytesWritten / (sampleRate × channels × bytesPerSample)
- Video loop already syncs to audio master clock (from previous commit)
- Master clock updates happen after each audio chunk write

How it works:
- Audio is the timing master, plays at natural rate
- Video reads audio clock and adapts timing to stay in sync
- If video >3 frames behind: drop frame and resync
- If video >3 frames ahead: wait longer
- Otherwise: adjust sleep duration for gradual sync

Expected improvements:
- Rock-solid A/V sync maintained over extended playback
- No more drift between audio and video
- Adaptive recovery from temporary slowdowns

Combined with Priority 1 (larger audio buffers) and Priority 2 (FFmpeg
volume control), this completes the core A/V sync architecture.
2025-12-24 01:36:50 -05:00
c94fdb403f Drop unsupported reset_timestamps flag 2025-12-24 01:31:33 -05:00
f648fb4303 Fix mkv copy merge timestamps 2025-12-24 01:10:30 -05:00
1ca5810bad Simplify merge format list 2025-12-24 01:05:16 -05:00
499be5ef98 Add AV1 merge option 2025-12-24 01:02:46 -05:00
98f8273cb7 Add WebM merge option 2025-12-24 00:53:07 -05:00
e7f1c15723 Make main menu vertically resizable 2025-12-24 00:30:18 -05:00
3cc2124a10 Group DVD modules and add responsive menu 2025-12-24 00:08:56 -05:00
ca95f7ffca Fix build blockers and continue refactoring
- Fixed Fyne API issue: app.Driver() → fyne.CurrentApp().Driver()
- Fixed unused import: removed strconv from upscale_module.go
- Build now passes successfully 
- Ready to continue module extraction

Current progress:
 filters_module.go (257 lines)
 thumb_module.go (406 lines)
 upscale_module.go partial (173 lines + showUpscaleView + AI helpers)
📊 main.go reduced by ~800+ lines
2025-12-23 23:50:51 -05:00
b76e0c5114 Fix queue UI refresh 2025-12-23 22:42:45 -05:00
ed9939905b Commit incremental progress
- Current state: 3 modules partially/fully extracted
- upscale_module.go: showUpscaleView + AI helpers migrated successfully
- Build syntax:  Clean
- Build failing due to unrelated Fyne API issue in internal/ui/queueview.go
- Ready for next incremental extraction steps
2025-12-23 22:39:33 -05:00
8834a05b8f Extract showUpscaleView and AI helper functions to upscale_module.go
- Move showUpscaleView() from main.go to upscale_module.go
- Remove AI helper functions (detectAIUpscaleBackend, checkAIFaceEnhanceAvailable, etc.)
- Syntax passes, ready for further migration
- Build error is unrelated Fyne API issue in internal/ui
2025-12-23 22:35:06 -05:00
5577468ea2 Restore main.go + upscale_module.go preparation
- main.go restored from corruption (13,664 lines)
- upscale_module.go created with AI helper functions
- Ready for safer incremental extraction approach
2025-12-23 22:29:42 -05:00
4ae45647c2 Update rip documentation 2025-12-23 22:13:54 -05:00
2f9a5960a0 Finish thumb module extraction fixes 2025-12-23 22:05:54 -05:00
24ce1c7837 Add thumb module files
- thumb_module.go: Complete thumb module implementation
- main.go.backup-before-inspect-extraction: Backup before refactoring
- Successfully extracted showThumbView() from main.go
2025-12-23 21:57:41 -05:00
f0db050d30 Format cleanup and minor fixes
- Apply go formatting across internal packages
- Clean up imports and code style
2025-12-23 21:56:47 -05:00
2e1faacea7 Extract thumb module from main.go (partial)
- Create thumb_module.go with showThumbView(), buildThumbView(), executeThumbJob()
- Remove showThumbView() from main.go
- buildThumbView() and executeThumbJob() still in main.go to be removed
- Syntax check passes
- Working on large function extraction
2025-12-23 21:47:14 -05:00
f108a40ac3 Auto-refresh queue view 2025-12-23 21:36:19 -05:00
bc4f7e5cce Extract filters module from main.go
- Create filters_module.go (257 lines)
- Move showFiltersView() and buildFiltersView()
- Reduce main.go by ~257 lines (from 14245 to 13988)
- All syntax checks pass, module ready for testing
2025-12-23 21:35:06 -05:00
bfc1898204 Label author/rip jobs in queue 2025-12-23 21:30:56 -05:00
4fc143ad2b Add comprehensive refactoring guide for opencode
Created step-by-step guide for modularizing main.go:
- 9 modules to extract in priority order (least → most important)
- Filters first (easiest), Convert last (most critical)
- Clear instructions for each extraction
- Reference patterns from existing modules
- Success criteria and testing steps
- Emergency rollback procedures

Module extraction order:
1. filters_module.go (~236 lines) - Simple UI
2. upscale_module.go (~1200 lines) - AI integration
3. thumb_module.go (~400 lines) - Thumbnail generation
4. player_module.go (~800 lines) - Playback system
5. compare_module.go (~550 lines) - File comparison
6. merge_module.go (~700 lines) - File merging
7. benchmark_module.go (~400 lines) - Encoder benchmarks
8. queue_module.go (~500 lines) - Job queue
9. convert_module.go (~6400 lines) - Most critical, do last

Goal: Reduce main.go from 14,116 → ~4,000 lines
Expected: Windows build time 5+ min → <2 min

Each module extraction is independent and testable.
Pattern established with inspect_module.go (already done).
2025-12-23 21:30:17 -05:00
627cb541a1 Handle nil values in toString 2025-12-23 21:25:41 -05:00
a3d9f868c1 Add rip job type 2025-12-23 21:22:37 -05:00
992114ce1c Add Rip module for DVD/ISO/VIDEO_TS 2025-12-23 21:19:44 -05:00
eb74a9f2b6 Implement major player performance improvements (Priority 2 & 5)
Priority 2: FFmpeg Volume Control
- Moved volume processing from Go to FFmpeg -af volume filter
- Eliminated CPU-intensive per-sample processing loop
- Removed ~40 lines of hot-path audio processing code
- Reduced CPU usage during playback significantly
- Dynamic volume changes restart audio seamlessly

Changes:
- Build FFmpeg command with volume filter
- Remove per-sample int16 processing loop
- Remove encoding/binary import (no longer needed)
- Add restartAudio() for dynamic volume changes
- Volume changes >5% trigger audio restart with new filter

Priority 5: Adaptive Frame Timing
- Implemented drift correction for smooth video playback
- Frame dropping when >3 frames behind schedule
- Gradual catchup when moderately behind
- Maintains smooth playback under system load

Frame Timing Logic:
- Behind < 0: Sleep until next frame (ahead of schedule)
- Behind > 3 frames: Drop frame and resync (way behind)
- Behind > 0.5 frames: Catch up gradually (moderately behind)
- Otherwise: Maintain normal pace

Performance Improvements:
- Audio: No more per-chunk volume processing overhead
- Video: Adaptive timing handles temporary slowdowns
- CPU: Significant reduction in audio processing load
- Smoothness: Better handling of system hiccups

Testing Notes:
- Audio stuttering should be greatly reduced
- Volume changes have ~200ms glitch during restart
- Frame drops logged every 30 frames to avoid spam
- Works with all frame rates (24/30/60 fps)

Still TODO (Priority 3):
- Single FFmpeg process for perfect A/V sync
- Currently separate video/audio processes can drift
2025-12-23 21:16:38 -05:00
df1ff0c605 Support VIDEO_TS drop to ISO 2025-12-23 21:10:46 -05:00
d5fcd1730a Document and fix player module stuttering issues
Performance Analysis:
- Created PLAYER_PERFORMANCE_ISSUES.md with root cause analysis
- Identified 6 major issues causing stuttering
- Provided priority-ordered fix recommendations

Quick Fixes Implemented (Priority 1):
- Increase audio buffer: 2048 → 8192 samples (42ms → 170ms)
- Increase audio chunk size: 4096 → 16384 bytes (21ms → 85ms)
- Reduces audio underruns and stuttering significantly

Root Causes Documented:
1. Separate video/audio FFmpeg processes (no A/V sync)
2. Tiny audio buffers causing underruns
3. CPU waste on per-sample volume processing
4. Frame timing drift with no correction mechanism
5. UI thread blocking every frame update
6. Memory allocation on every frame (GC pressure)

Remaining Work (Requires More Time):
- Priority 2: Move volume control to FFmpeg (remove hot path processing)
- Priority 3: Single FFmpeg process for perfect A/V sync
- Priority 4: Frame buffer pooling to reduce GC pressure
- Priority 5: Adaptive frame timing with drift correction

Testing Checklist Provided:
- Frame rate support (24/30/60 fps)
- A/V sync validation
- Codec compatibility
- CPU usage benchmarking
2025-12-23 21:09:21 -05:00
57c43882cb Default author output path without dialogs 2025-12-23 21:06:49 -05:00
05087a0fe8 Update Windows build guide for Git Bash users
Git Bash Optimizations:
- Create add-defender-exclusions.ps1 automated script
- Update guide with Git Bash-first instructions
- Add command for running PowerShell from Git Bash
- Document how to run Git Bash as Administrator

New Helper Script:
- scripts/add-defender-exclusions.ps1
- Automatically adds all necessary Defender exclusions
- Shows clear success/failure messages
- Can be run from Git Bash using powershell.exe

Documentation Updates:
- Prioritize Git Bash commands (Jake's workflow)
- Add "Quick Start for Git Bash Users" section
- Provide step-by-step Git Bash instructions
- Keep PowerShell/CMD options as alternatives

For Jake:
```bash
# From Git Bash as Administrator:
powershell.exe -ExecutionPolicy Bypass -File ./scripts/add-defender-exclusions.ps1
```
2025-12-23 20:55:47 -05:00
fe75a7310e Add Windows build performance optimizations
Build Script Improvements:
- Add -p flag for parallel compilation (use all CPU cores)
- Add -trimpath for faster builds and smaller binaries
- Detect CPU core count automatically
- Show parallel process count during build

Performance Guide:
- Create WINDOWS_BUILD_PERFORMANCE.md with troubleshooting steps
- Document Windows Defender exclusion fix (saves 2-5 minutes)
- Provide PowerShell commands for adding exclusions
- Include benchmarking and troubleshooting commands

Expected Improvements:
- With Defender exclusions: 5+ min → 30-90 sec
- Parallel compilation: 30-50% faster on multi-core CPUs
- Trimpath flag: 10-20% faster linking

Scripts Updated:
- build.ps1: Added core detection and optimization flags
- build.bat: Added parallel build support

Addresses Jake's 5+ minute Windows build issue.
2025-12-23 20:53:43 -05:00
5f2d2c888b Extract inspect module from main.go
Refactoring:
- Create inspect_module.go (292 lines)
- Move showInspectView() and buildInspectView()
- Reduce main.go from 14,329 to 14,116 lines (-213 lines)
- Reduce main.go from 426KB to 420KB

This is the first step in modularizing main.go to improve:
- Windows build performance (currently 5+ minutes)
- Code maintainability and organization
- Following established pattern from author_module.go and subtitles_module.go

Remaining modules to extract:
- player, compare, thumb, filters, upscale, merge, convert, queue, benchmark
2025-12-23 20:51:42 -05:00
0c4af03fb5 Fix author warnings dialog thread 2025-12-23 20:49:34 -05:00
c28a0ea91e Simplify authoring error messaging 2025-12-23 20:48:45 -05:00
269a0209d3 Add authoring log/progress and queue job 2025-12-23 20:47:10 -05:00
07609406eb Link author subtitles to subtitles tool 2025-12-23 20:38:05 -05:00
179abbe8c5 Move chapter buttons to bottom 2025-12-23 20:36:58 -05:00
df83bc334a Add batch queue feature to Convert module
Convert Module:
- Add "Add All to Queue" button when multiple videos loaded
- Batch-add all loaded videos to queue with one click
- Remove confirmation dialogs for faster workflow
- Queue button updates immediately to show new count
- Button only visible when 2+ videos are loaded

Workflow improvements:
- No more clicking through videos one by one to queue
- No "OK" confirmation clicks required
- Queue count updates instantly in View Queue button
- Auto-starts queue after adding jobs
2025-12-23 20:27:59 -05:00
1294c7f156 Add DVD5/DVD9 disc size guidance 2025-12-23 20:20:15 -05:00
3a02cfcae1 Allow local DVDStyler ZIP install 2025-12-23 20:00:54 -05:00
8f34ee1f92 Add more DVDStyler mirrors 2025-12-23 20:00:54 -05:00
df23fee585 Add manual DVDStyler download hint 2025-12-23 20:00:54 -05:00