VideoTools/BUILD.md
Stu Leak 7341cf70ce Add dev14 fixes: progress tracking, AMD AMF support, DVD resolution fix, and Windows build automation
This commit includes three critical bug fixes and Windows build improvements:

**Bug Fixes:**

1. **Queue Conversion Progress Tracking** (main.go:1471-1534)
   - Enhanced executeConvertJob() to parse FPS, speed, and ETA from FFmpeg output
   - Queue jobs now show detailed progress metrics matching direct conversions
   - Stats stored in job.Config for display in the conversion stats bar

2. **AMD AMF Hardware Acceleration** (main.go)
   - Added "amf" to hardware acceleration options
   - Support for h264_amf, hevc_amf, and av1_amf encoders
   - Added AMF-specific error detection in FFmpeg output parsing

3. **DVD Format Resolution Forcing** (main.go:1080-1103, 4504-4517)
   - Removed automatic resolution forcing when DVD format is selected
   - Removed -target parameter usage which was forcing 720×480/720×576
   - Resolution now defaults to "Source" unless explicitly changed
   - DVD compliance maintained through manual bitrate/GOP/codec parameters

**Windows Build Improvements:**

- Updated build.bat to enable CGO (required for Fyne/OpenGL)
- Added automatic GCC/MinGW-w64 detection and installation
- Automated setup via winget for one-command Windows builds
- Improved error messages with fallback manual instructions

**Documentation:**

- Added comprehensive Windows setup guides
- Created platform.go for future platform-specific code
- Updated .gitignore for Windows build artifacts

All changes tested and working. Ready for production use.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:11:15 -05:00

3.9 KiB

Building VideoTools

VideoTools uses a universal build script that automatically detects your platform and builds accordingly.


Quick Start (All Platforms)

./scripts/build.sh

That's it! The script will:

  • Detect your platform (Linux/macOS/Windows)
  • Build the appropriate executable
  • On Windows: Offer to download FFmpeg automatically

Platform-Specific Details

Linux

Prerequisites:

  • Go 1.21+
  • FFmpeg (system package)
  • CGO build dependencies

Install FFmpeg:

# Fedora/RHEL
sudo dnf install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

# Arch Linux
sudo pacman -S ffmpeg

Build:

./scripts/build.sh

Output: VideoTools (native executable)

Run:

./VideoTools

macOS

Prerequisites:

  • Go 1.21+
  • FFmpeg (via Homebrew)
  • Xcode Command Line Tools

Install FFmpeg:

brew install ffmpeg

Build:

./scripts/build.sh

Output: VideoTools (native executable)

Run:

./VideoTools

Windows

Prerequisites:

  • Go 1.21+
  • MinGW-w64 (for CGO)
  • Git Bash or similar (to run shell scripts)

Build:

./scripts/build.sh

The script will:

  1. Build VideoTools.exe
  2. Prompt to download FFmpeg automatically
  3. Set up everything in dist/windows/

Output: VideoTools.exe (Windows GUI executable)

Run:

  • Double-click VideoTools.exe in dist/windows/
  • Or: ./VideoTools.exe from Git Bash

Automatic FFmpeg Setup:

# The build script will offer this automatically, or run manually:
./setup-windows.bat

# Or in PowerShell:
.\scripts\setup-windows.ps1 -Portable

Advanced: Manual Platform-Specific Builds

Linux/macOS Native Build

./scripts/build-linux.sh

Windows Cross-Compile (from Linux)

# Install MinGW first
sudo dnf install mingw64-gcc mingw64-winpthreads-static  # Fedora
# OR
sudo apt install gcc-mingw-w64  # Ubuntu/Debian

# Cross-compile
./scripts/build-windows.sh

# Output: dist/windows/VideoTools.exe (with FFmpeg bundled)

Build Options

Clean Build

# The build script automatically cleans cache
./scripts/build.sh

Debug Build

# Standard build includes debug info by default
CGO_ENABLED=1 go build -o VideoTools

# Run with debug logging
./VideoTools -debug

Release Build (Smaller Binary)

# Strip debug symbols
go build -ldflags="-s -w" -o VideoTools

Troubleshooting

"go: command not found"

Install Go 1.21+ from https://go.dev/dl/

"CGO_ENABLED must be set"

CGO is required for Fyne (GUI framework):

export CGO_ENABLED=1
./scripts/build.sh

"ffmpeg not found" (Linux/macOS)

Install FFmpeg using your package manager (see above).

Windows: "x86_64-w64-mingw32-gcc not found"

Install MinGW-w64:

macOS: "ld: library not found"

Install Xcode Command Line Tools:

xcode-select --install

Build Artifacts

After building, you'll find:

Linux/macOS:

VideoTools/
└── VideoTools          # Native executable

Windows:

VideoTools/
├── VideoTools.exe      # Main executable
└── dist/
    └── windows/
        ├── VideoTools.exe
        ├── ffmpeg.exe      # (after setup)
        └── ffprobe.exe     # (after setup)

Development Builds

For faster iteration during development:

# Quick build (no cleaning)
go build -o VideoTools

# Run directly
./VideoTools

# With debug output
./VideoTools -debug

CI/CD

The build scripts are designed to work in CI/CD environments:

# Example GitHub Actions
- name: Build VideoTools
  run: ./scripts/build.sh

For more details, see:

  • QUICKSTART.md - Simple setup guide
  • WINDOWS_SETUP.md - Windows-specific instructions
  • docs/WINDOWS_COMPATIBILITY.md - Cross-platform implementation details