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>
64 lines
1.8 KiB
Go
64 lines
1.8 KiB
Go
package modules
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.leaktechnologies.dev/stu/VideoTools/internal/logging"
|
|
)
|
|
|
|
// Module handlers - each handles the logic for a specific module
|
|
|
|
// HandleConvert handles the convert module
|
|
func HandleConvert(files []string) {
|
|
logging.Debug(logging.CatFFMPEG, "convert handler invoked with %v", files)
|
|
fmt.Println("convert", files)
|
|
}
|
|
|
|
// HandleMerge handles the merge module
|
|
func HandleMerge(files []string) {
|
|
logging.Debug(logging.CatFFMPEG, "merge handler invoked with %v", files)
|
|
fmt.Println("merge", files)
|
|
}
|
|
|
|
// HandleTrim handles the trim module
|
|
func HandleTrim(files []string) {
|
|
logging.Debug(logging.CatModule, "trim handler invoked with %v", files)
|
|
fmt.Println("trim", files)
|
|
}
|
|
|
|
// HandleFilters handles the filters module
|
|
func HandleFilters(files []string) {
|
|
logging.Debug(logging.CatModule, "filters handler invoked with %v", files)
|
|
fmt.Println("filters", files)
|
|
}
|
|
|
|
// HandleUpscale handles the upscale module
|
|
func HandleUpscale(files []string) {
|
|
logging.Debug(logging.CatModule, "upscale handler invoked with %v", files)
|
|
fmt.Println("upscale", files)
|
|
}
|
|
|
|
// HandleAudio handles the audio module
|
|
func HandleAudio(files []string) {
|
|
logging.Debug(logging.CatModule, "audio handler invoked with %v", files)
|
|
fmt.Println("audio", files)
|
|
}
|
|
|
|
// HandleThumb handles the thumb module
|
|
func HandleThumb(files []string) {
|
|
logging.Debug(logging.CatModule, "thumb handler invoked with %v", files)
|
|
fmt.Println("thumb", files)
|
|
}
|
|
|
|
// HandleInspect handles the inspect module
|
|
func HandleInspect(files []string) {
|
|
logging.Debug(logging.CatModule, "inspect handler invoked with %v", files)
|
|
fmt.Println("inspect", files)
|
|
}
|
|
|
|
// HandleCompare handles the compare module (side-by-side comparison of two videos)
|
|
func HandleCompare(files []string) {
|
|
logging.Debug(logging.CatModule, "compare handler invoked with %v", files)
|
|
fmt.Println("compare", files)
|
|
}
|