Commit Graph

315 Commits

Author SHA1 Message Date
c8f4eec0d1 feat(author): Implement real-time progress, add to queue, clear title
This commit introduces several enhancements to the Author module:
- **Real-time Progress Reporting:** Implemented granular, real-time progress updates for FFmpeg encoding steps during DVD authoring. The progress bar now updates smoothly, reflecting the actual video processing. Progress calculation is weighted by video durations for accuracy.
- **Add to Queue Functionality:** Added an 'Add to Queue' button to the Author module, allowing users to queue authoring jobs for later execution without immediate start. The authoring workflow was refactored to accept a 'startNow' parameter for this purpose.
- **Clear Output Title:** Modified the 'Clear All' functionality to also reset the DVD Output Title, preventing accidental naming conflicts for new projects.

Additionally, this commit includes a UI enhancement:
- **Main Menu Categorization:** Relocated 'Author', 'Rip', and 'Blu-Ray' modules to a new 'Disc' category on the main menu, improving logical grouping.

Fixes:
- Corrected a missing argument error in a call to .
- Added missing  import in .

Updates:
-  and  have been updated to reflect these changes.
2025-12-27 01:34:57 -05:00
18209240f2 Add drag and drop enhancements and timing offset controls to subtitle module 2025-12-26 19:44:38 -05:00
d781ce2d58 Optimize author log viewer performance with tail behavior
Problem: Author log was causing severe UI lag and memory issues
- Unbounded string growth (entire log kept in RAM)
- Full widget rebuild on every line append
- O(n²) string concatenation performance

Solutions implemented:
1. Tail behavior - Keep only last 100 lines in UI
   - Uses circular buffer (authorLogLines slice)
   - Prevents unbounded memory growth
   - Rebuilds text from buffer on each append

2. Copy Log button
   - Copies full log from file (accurate)
   - Falls back to in-memory log if file unavailable

3. View Full Log button
   - Opens full log in dedicated log viewer
   - No UI lag from large logs

4. Track log file path
   - authorLogFilePath stored when log created
   - Used by copy and view buttons

Performance improvements:
- Memory: O(1) instead of O(n) - fixed 100 line buffer
- CPU: One SetText() per line instead of concatenation
- UI responsiveness: Dramatically improved with tail behavior

UI changes:
- Label shows "Authoring Log (last 100 lines)"
- Copy/View buttons for accessing full log
2025-12-26 19:33:51 -05:00
e919339e3d Stabilize queue back navigation 2025-12-24 16:22:24 -05:00
7226da0970 Add persistent configs for author/subtitles/merge/rip 2025-12-24 15:39:22 -05:00
9237bae4ff Make log viewer responsive on large files 2025-12-24 08:32:19 -05:00
0e74f28379 Stop split layout from expanding window 2025-12-24 03:14:31 -05:00
804d27a0b5 Disable auto-name on manual output edit 2025-12-24 03:07:54 -05:00
d566a085d1 Use per-file output base for batch convert 2025-12-24 03:05:35 -05:00
e22eae8207 Avoid batch remux output collisions 2025-12-24 03:02:24 -05:00
aa659b80f5 Return to last module after clear all 2025-12-24 02:53:24 -05:00
63804f7475 Prevent clear completed from wiping active project 2025-12-24 02:51:02 -05:00
e84dfd5eed Add chapter removal option in Convert 2025-12-24 02:47:55 -05:00
ff612b547c Fix remux build variables 2025-12-24 02:40:37 -05:00
de70448897 Harden remux timestamp handling 2025-12-24 02:38:41 -05:00
1491d0b0c0 Skip filters during remux 2025-12-24 02:33:28 -05:00
fe5d0f7f87 Lock remux aspect controls to Source 2025-12-24 02:31:34 -05:00
0779016616 Hide encode controls for remux 2025-12-24 02:29:15 -05:00
a821f59668 Add remux option to Convert 2025-12-24 02:22:07 -05:00
b7e9157324 Show benchmark apply status in Convert header 2025-12-24 01:55:37 -05:00
6729e98fae 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 01:44:08 -05:00
a91a3e60d7 Reset merge output on clear 2025-12-24 01:38:57 -05:00
a7b3452312 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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 01:36:50 -05:00
4a09626e28 Drop unsupported reset_timestamps flag 2025-12-24 01:31:33 -05:00
14712f7785 Fix mkv copy merge timestamps 2025-12-24 01:10:30 -05:00
ff9071902e Simplify merge format list 2025-12-24 01:05:16 -05:00
b0bd1cf179 Add AV1 merge option 2025-12-24 01:02:46 -05:00
6e13a53569 Add WebM merge option 2025-12-24 00:53:07 -05:00
a7bffb63ee Group DVD modules and add responsive menu 2025-12-24 00:08:56 -05:00
01af1b8cf2 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
165480cf8c 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
b02cd844c4 Finish thumb module extraction fixes 2025-12-23 22:05:54 -05:00
81773c46a1 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
1a268ce983 Auto-refresh queue view 2025-12-23 21:36:19 -05:00
c98c1aa924 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
c883a92155 Handle nil values in toString 2025-12-23 21:25:41 -05:00
faef905f18 Add Rip module for DVD/ISO/VIDEO_TS 2025-12-23 21:19:44 -05:00
0d5670f34b 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:16:38 -05:00
ee67bffbd9 Support VIDEO_TS drop to ISO 2025-12-23 21:10:46 -05:00
68ce3c2168 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:09:21 -05:00
960def5730 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 20:51:42 -05:00
588fc586a1 Add authoring log/progress and queue job 2025-12-23 20:47:10 -05:00
16140e2e12 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 20:27:59 -05:00
77ff859575 Add DVD5/DVD9 disc size guidance 2025-12-23 20:20:15 -05:00
056df2ec25 Add subtitles module with offline STT 2025-12-23 18:30:27 -05:00
f3f4ee0f3a Show clip-based chapters in author chapters tab 2025-12-23 17:58:45 -05:00
71021f5585 Add chapter naming per clip in author videos tab 2025-12-23 17:56:39 -05:00
595b1603ee Add author chapter sources and scene detection 2025-12-23 17:54:01 -05:00
bff07bd746 Improve author subtitles layout and summary refresh 2025-12-23 17:39:47 -05:00
9b4fedc181 Handle drag-and-drop in author module 2025-12-23 17:33:17 -05:00