Commit Graph

22 Commits

Author SHA1 Message Date
Stu
5e2c07ad21 Create custom timeline widget with keyframe markers (Commit 6)
Implements visual timeline with smooth interaction and keyframe visualization:

Timeline Widget Features:
- Custom Fyne widget in internal/ui/timeline.go
- Visual keyframe markers (yellow 1px vertical lines)
- Current position scrubber (white 2px line with circle handle)
- Progress fill showing played portion (gray)
- Mouse click/drag for smooth seeking
- In/out point marker support (for future cut functionality)

Rendering Performance:
- Cached rendering objects to minimize redraws
- Only scrubber position updates on playback
- Full redraw only on resize or keyframe data change
- Optimized for 1000+ keyframes without lag

UI Integration:
- Timeline replaces slider when keyframing mode is enabled
- Automatically loads keyframe timestamps from Index
- Integrates with existing updateProgress callback
- Maintains current time/total time labels

Technical Implementation:
- TimelineWidget extends widget.BaseWidget
- Custom renderer implements fyne.WidgetRenderer
- SetOnChange() for seek callback
- SetPosition() for playback updates
- SetKeyframes() for keyframe marker display
- Desktop mouse events for hover and drag

Visual Design:
- Dark gray background (#282828)
- Lighter gray progress fill (#3C3C3C)
- Yellow keyframe markers (#FFDC00 with transparency)
- White scrubber with circular handle
- Blue in-point marker for cuts
- Red out-point marker for cuts

References: DEV_SPEC lines 192-241

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:07:45 -05:00
1618558314 Implement keyframe detection system (Commit 4)
Core implementation:
- Create internal/keyframe package with detector.go
- Implement DetectKeyframes() using ffprobe packet flags
- Use 'K' flag in packet data to identify I-frames
- Binary search for FindNearestKeyframe() (before/after/nearest)
- EstimateFrameNumber() for frame calculations

Caching system:
- Save/load keyframe index to ~/.cache/vt_player/keyframes/
- Binary format: ~12 bytes per keyframe (~3KB for 4min video)
- Cache key based on file path + modification time
- Auto-invalidation when file changes
- DetectKeyframesWithCache() for automatic cache management

Performance:
- 265 keyframes detected in 0.60s for 4min video (441 kf/sec)
- FindNearestKeyframe: 67ns per lookup (binary search)
- Memory: ~3KB cache per video
- Exceeds target: <5s for 1-hour video

Integration:
- Add KeyframeIndex field to videoSource
- EnsureKeyframeIndex() method for lazy loading
- Ready for frame-accurate navigation features

Testing:
- Comprehensive unit tests (all passing)
- Benchmark tests for search performance
- cmd/test_keyframes utility for validation
- Tested on real video files

Prepares for Commits 5-10:
- Frame-by-frame navigation (Commit 5)
- Keyframe jump controls (Commit 5)
- Timeline with keyframe markers (Commit 6-7)
- In/out point marking (Commit 8)
- Lossless cut export (Commit 9-10)

References: DEV_SPEC Phase 2 (lines 54-119)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 14:11:45 -05:00
3f47da4ddf Integrate Google Material Icons for clean UI
Icon system:
- Create internal/ui/icons.go with Material Symbols unicode constants
- Add 50+ icon constants for all player features
- Implement NewIconButton() and helper functions
- Add GetVolumeIcon() and GetPlayPauseIcon() dynamic icon helpers

UI updates:
- Replace emoji icons (▶/⏸ 🔊 ☰) with Material Icons
- Use play_arrow/pause for play button with state toggle
- Use volume_up/down/mute/off for volume with dynamic updates
- Use menu icon for playlist toggle
- Use skip_previous/skip_next for track navigation

Documentation:
- Add MATERIAL_ICONS_MAPPING.md with complete icon reference
- Document 50+ Material Icon unicode mappings
- Include download instructions for Material Symbols font
- Map all planned features to appropriate icons

Benefits:
- Professional, consistent icon design
- Industry-standard Material Design language
- Better rendering than emoji (no font fallback issues)
- Scalable unicode characters (works immediately)
- Ready for font enhancement (optional Material Symbols font)

Prepares for:
- Frame navigation icons (navigate_before/next)
- Keyframe jump icons (first_page/last_page)
- Cut tool icons (content_cut, markers)
- All features in FEATURE_ROADMAP.md

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 10:06:43 -05:00
Stu
d5458f7050 Simplify player view and enable drop-to-play 2025-12-04 06:04:35 -05:00
Stu
eaea93e0e6 Initial import for VT Player 2025-12-04 05:03:02 -05:00
71a282b828 Add Compare module and Target File Size encoding feature
This commit implements two new features:

1. Compare Module:
   - New UI module for side-by-side video comparison
   - Loads two video files and displays detailed metadata comparison
   - Shows format, resolution, codecs, bitrates, frame rate, color info, etc.
   - Accessible via GUI module button or CLI: videotools compare <file1> <file2>
   - Added formatBitrate() helper function for consistent bitrate display

2. Target File Size Encoding Mode:
   - New bitrate mode "Target Size" for convert module
   - Allows users to specify desired output file size (e.g., "25MB", "100MB", "8MB")
   - Automatically calculates required video bitrate based on:
     * Target file size
     * Video duration
     * Audio bitrate
     * Container overhead (3% reserved)
   - Implemented ParseFileSize() to parse size strings (KB, MB, GB)
   - Implemented CalculateBitrateForTargetSize() for bitrate calculation
   - Works in both GUI convert view and job queue execution

Additional changes:
- Updated printUsage() to include compare command
- Added compare button to module grid with pink color
- Added compareFile1 and compareFile2 to appState
- Consistent "Target Size" naming throughout (UI and code)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 20:14:31 -05:00
6a2f1fff3f Add target file size feature and fix multiple encoding issues
- Add TargetFileSize mode with automatic bitrate calculation
- Add CalculateBitrateForTargetSize and ParseFileSize utility functions
- Fix NVENC hardware encoding (remove incorrect -hwaccel cuda flag)
- Fix auto-detection override when hardware accel set to none
- Fix 10-bit pixel format incompatibility (change to 8-bit yuv420p)
- Add enhanced video metadata display (PAR, color space, GOP size, audio bitrate, chapters)
- Improve error reporting with FFmpeg stderr capture and exit code interpretation
- Add interpretFFmpegError function for human-readable error messages
2025-12-03 10:00:14 -05:00
e0e7c33445 Preserve queue scroll and show active conversion inline 2025-11-30 00:48:56 -05:00
c237cb8a8e Fix queue scroll jump and DVD format codec selection 2025-11-30 00:15:04 -05:00
1187a77f43 Fix convert layout stacking and cgo build 2025-11-30 00:01:06 -05:00
b3db00c533 Auto-start queue when adding jobs from Convert module
Implements automatic queue processing when jobs are added from the Convert
module via the 'Add to Queue' button:

Features:
- IsRunning() method added to queue package to check processing status
- 'Add to Queue' button now auto-starts queue if not already running
- Eliminates need to manually open Queue view and click 'Start Queue'
- Seamless workflow: Add video → Queue → Auto-starts conversion

Before:
1. Load video
2. Click 'Add to Queue'
3. Click 'View Queue'
4. Click 'Start Queue'

After:
1. Load video
2. Click 'Add to Queue' (auto-starts!)
3. Load next video
4. Click 'Add to Queue' (already running)

Perfect for batch operations where user loads multiple videos and expects
them to start encoding immediately.
2025-11-29 20:31:52 -05:00
d327d7f65e Improve queue system reliability and add auto-resolution for DVD formats
This commit includes several improvements:

Queue System Enhancements:
- Improved thread-safety in Add, Remove, Pause, Resume, Cancel operations
- Added PauseAll and ResumeAll methods for batch control
- Added MoveUp and MoveDown methods to reorder queue items
- Better handling of running job cancellation with proper state management
- Improved Copy strategy in List() to prevent race conditions

Convert Module Enhancement:
- Auto-set resolution to 720×480 when NTSC DVD format selected
- Auto-set resolution to 720×576 when PAL DVD format selected
- Auto-set framerate to 29.97fps (30) for NTSC, 25fps for PAL
- Added DVD resolution options to resolution selector dropdown

Display Server Improvements:
- Auto-detect Wayland vs X11 display servers in player controller
- Conditionally apply xdotool window placement (X11 only)

UI Improvements:
- Added Pause All, Resume All, and queue reordering buttons
- Fixed queue counter labeling (completed count display)
2025-11-29 20:07:35 -05:00
d45d16f89b Implement DVD-NTSC encoding support with multi-region capabilities
Add comprehensive DVD-Video encoding functionality:

- New internal/convert package with modular architecture
  - types.go: Core types (VideoSource, ConvertConfig, FormatOption)
  - ffmpeg.go: FFmpeg codec mapping and video probing
  - presets.go: Output format definitions
  - dvd.go: NTSC-specific DVD encoding and validation
  - dvd_regions.go: PAL, SECAM, and multi-region support

- New internal/app/dvd_adapter.go for main.go integration

Features implemented:
✓ DVD-NTSC preset (720×480@29.97fps, MPEG-2/AC-3)
✓ Multi-region support (NTSC, PAL, SECAM - all region-free)
✓ Comprehensive validation system with actionable warnings
✓ Automatic framerate conversion (23.976p, 24p, 30p, 60p)
✓ Audio resampling to 48 kHz
✓ Aspect ratio handling (4:3, 16:9, letterboxing)
✓ Interlacing detection and preservation
✓ DVDStyler-compatible output (no re-encoding)
✓ PS2-safe bitrate limits (max 9000 kbps)

Complete technical specifications and integration guide in:
- DVD_IMPLEMENTATION_SUMMARY.md

All packages compile without errors or warnings.
Ready for integration with existing queue and UI systems.

🤖 Generated with Claude Code
2025-11-29 19:30:05 -05:00
fa4f4119b5 Simplify threading solution and add Clear All button
Simplified the approach by removing complex callback logic and using a
simple 500ms timer-based update for the stats bar instead. This eliminates
threading errors completely while keeping the code straightforward.

Changes:
1. Removed queue change callback entirely
2. Added background timer that updates stats bar every 500ms
3. Removed initComplete flag (no longer needed)
4. Simplified setContent() to direct calls
5. Added onClearAll parameter to BuildQueueView()
6. Added ClearAll() method to Queue (removes all jobs)
7. Added Clear All button with DangerImportance styling in queue view
8. Clear Completed button now has LowImportance styling

This approach is much simpler: the UI just polls the queue state
periodically instead of trying to handle callbacks from goroutines.
No more threading errors, less code, easier to understand.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:25:03 -05:00
813c0fd17d Revert "Fix Fyne threading error and queue persistence issues"
This reverts commit cfb608e191.
2025-11-27 00:12:00 -05:00
cfb608e191 Fix Fyne threading error and queue persistence issues
This commit resolves three critical issues:

1. **Fyne Threading Error on Startup**: Fixed by improving setContent() to
   check the initComplete flag. During initialization, setContent() calls
   SetContent() directly since we're on the main thread. After initialization,
   it safely marshals calls via app.Driver().DoFromGoroutine().

2. **Queue Persisting Between Sessions**: Fixed by removing queue persistence.
   The shutdown() function no longer saves the queue to disk, ensuring a
   clean slate for each new app session.

3. **Queue Auto-Processing**: Fixed by making the queue start in 'paused'
   state. Users must explicitly click 'Process Queue' to start batch
   conversion. Queue methods PauseProcessing() and ResumeProcessing()
   control the paused state.

Changes:
- main.go: Added initComplete flag to appState, improved setContent()
  logic, disabled queue persistence in shutdown()
- queue/queue.go: Added paused field to Queue struct, initialize paused=true,
  added PauseProcessing()/ResumeProcessing() methods
- ui/queueview.go: Added UI controls for queue processing and clearing

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:06:19 -05:00
43ed677838 Add persistent conversion stats, multi-video navigation, and error debugging
Features:
- Add persistent conversion stats bar visible on all screens
  - Shows running job progress with live updates
  - Displays pending/completed/failed job counts
  - Clickable to open queue view
- Add multi-video navigation with Prev/Next buttons
  - Load multiple videos for batch queue setup
  - Switch between loaded videos to review settings
- Add install script with animated loading spinner
- Add error dialogs with "Copy Error" button for debugging

Improvements:
- Update queue tile to show active/total jobs instead of completed/total
- Fix deadlock in queue callback system (run callbacks in goroutines)
- Improve batch file handling with detailed error reporting
- Fix queue status to always show progress percentage (even at 0%)
- Better error messages for failed video analysis

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 18:44:54 -05:00
b09ab8d8b4 Add job queue system with batch processing support
Implements a comprehensive job queue system for batch video processing:
- Job queue with priority-based processing
- Queue persistence (saves/restores across app restarts)
- Pause/resume/cancel individual jobs
- Real-time progress tracking
- Queue viewer UI with job management controls
- Clickable queue tile on main menu showing completed/total
- "View Queue" button in convert module

Batch processing features:
- Drag multiple video files to convert tile → auto-add to queue
- Drag folders → recursively scans and adds all videos
- Batch add confirmation dialog
- Supports 14 common video formats

Convert module improvements:
- "Add to Queue" button for queuing single conversions
- "CONVERT NOW" button (renamed for clarity)
- "View Queue" button for quick queue access

Technical implementation:
- internal/queue package with job management
- Job executor with FFmpeg integration
- Progress callbacks for live updates
- Tappable widget component for clickable UI elements

WIP: Queue system functional, tabs feature pending

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 17:19:40 -05:00
Stu
103d8ded83 Add comprehensive encoder settings and fix window layout (v0.1.0-dev10)
Advanced Mode Encoder Settings:
- Added full video encoding controls: codec (H.264/H.265/VP9/AV1), encoder preset,
  manual CRF, bitrate modes (CRF/CBR/VBR), target resolution, frame rate,
  pixel format, hardware acceleration (nvenc/vaapi/qsv/videotoolbox), two-pass
- Added audio encoding controls: codec (AAC/Opus/MP3/FLAC), bitrate, channels
- Created organized UI sections in Advanced tab with 13 new control widgets
- Simple mode remains minimal with just Format, Output Name, and Quality preset

Snippet Generation Improvements:
- Optimized snippet generation to use stream copy for fast 2-second processing
- Added WMV detection to force re-encoding (WMV codecs can't stream-copy to MP4)
- Fixed FFmpeg argument order: moved `-t 20` after codec/mapping options
- Added progress dialog for snippets requiring re-encoding (WMV files)
- Snippets now skip deinterlacing for speed (full conversions still apply filters)

Window Layout Fixes:
- Fixed window jumping to second screen when loading videos
- Increased window size from 920x540 to 1120x640 to accommodate content
- Removed hardcoded background minimum size that conflicted with window size
- Wrapped main content in scroll container to prevent content from forcing resize
- Changed left column from VBox to VSplit (65/35 split) for proper vertical expansion
- Reduced panel minimum sizes from 520px to 400px to reduce layout pressure
- UI now fills workspace properly whether video is loaded or not
- Window allows manual resizing while preventing auto-resize from content changes

Technical Changes:
- Extended convertConfig struct with 14 new encoding fields
- Added determineVideoCodec() and determineAudioCodec() helper functions
- Updated buildConversionCommand() to use new encoder settings
- Updated generateSnippet() with WMV handling and optimized stream copy logic
- Modified buildConvertView() to use VSplit for flexible vertical layout

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:17:17 -05:00
Stu
183602a302 Add drag-and-drop, fix cover art encoding, extract embedded thumbnails (v0.1.0-dev9)
Drag-and-Drop on Main Menu:
- Implemented position-based drop detection on main menu module tiles
- Added detectModuleTileAtPosition() to calculate which tile receives the drop
- Modified window drop handler to pass position and route to appropriate module
- Bypasses Fyne's drop event hierarchy limitation where window-level handlers
  intercept drops before widgets can receive them
- Only enabled tiles (currently Convert) respond to drops
- Loads video and switches to module automatically

Cover Art Embedding Fixes:
- Fixed FFmpeg exit code 234 error when embedding cover art
- Added explicit PNG codec specification for cover art streams
- Snippet generation: Added `-c✌️1 png` after mapping cover art stream
- Full conversion: Added `-c✌️1 png` for proper MP4 thumbnail encoding
- MP4 containers require attached pictures to be PNG or MJPEG encoded

Embedded Cover Art Extraction:
- Added EmbeddedCoverArt field to videoSource struct
- Extended ffprobe parsing to detect attached_pic disposition
- Automatically extracts embedded thumbnails when loading videos
- Extracted cover art displays in metadata section (168x168)
- Enables round-trip workflow: generate snippet with thumbnail, load snippet
  and see the embedded thumbnail displayed

Technical Details:
- Modified handleDrop to accept position parameter
- Added Index and Disposition fields to ffprobe stream parsing
- Cover art streams now excluded from main video stream detection
- Grid layout: 3 columns, ~302px per column, ~122px per row, starts at y=100
- Embedded thumbnails extracted to /tmp/videotools-embedded-cover-*.png

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 18:46:51 -05:00
Stu
18a14c6020 Refactor to modular architecture with rainbow UI (v0.1.0-dev8)
Major refactoring to improve code organization and enhance UI:

Architecture:
- Split monolithic main.go into modular internal/ package structure
- Created internal/logging for centralized logging system
- Created internal/modules for module handler functions
- Created internal/ui for UI components and layouts
- Created internal/utils for shared utility functions

UI Enhancements:
- Implemented rainbow gradient across 8 module buttons (violet→red)
- Increased module button text size to 20 for better readability
- Fixed text centering on module tiles
- Converted Simple/Advanced mode toggle to tabs to save vertical space
- Added vertical scrollbars to prevent UI overflow
- Added metadata copy button (📋) to copy all metadata to clipboard

Video Processing:
- Fixed aspect ratio conversion to default to center-crop behavior
- Added 6 aspect handling modes: Auto, Crop, Letterbox, Pillarbox, Blur Fill, Stretch
- Fixed blur fill to maintain source resolution with padding (no scaling)
- Ensured all FFmpeg filters produce even-numbered dimensions for H.264

Known Issues:
- WMV files still produce FFmpeg error 234 during aspect conversions
  (requires codec-specific handling in future update)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 14:56:37 -05:00
Stu
b4f8135fa3 Checkpoint media player playback 2025-11-21 16:08:38 -05:00