Skip to content

Add Linux support (Avalonia): FFmpeg discovery, packaging & docs #1

@Hangell

Description

@Hangell

Add Linux support (Avalonia): FFmpeg discovery, packaging & docs

Summary

ScreenForge currently builds and runs on Windows. We want to add Linux (x64) support next. If you have experience running Avalonia on Linux (X11/Wayland) and handling FFmpeg on Linux, your help would be greatly appreciated.

Why

The goal of ScreenForge is to be cross-platform. Linux support unblocks a large part of our users and contributors and keeps the codebase portable from day one.

Scope (Linux first)

  • Target: linux-x64, .NET 8, Avalonia (Skia).
  • Out of scope for this issue: macOS packaging. (We’ll file a separate issue later.)

Proposed approach

  1. FFmpeg discovery (cross-platform)
    • Resolve path in this order:
      1. SCREENFORGE_FFMPEG env var (absolute path to ffmpeg),
      2. user tools dir (e.g., ~/.local/share/ScreenForge/tools/ffmpeg/bin/ffmpeg),
      3. app-local tools/ffmpeg/bin/ffmpeg (if we add optional tooling later),
      4. system PATH (via which ffmpeg).
    • Throw a clear error with instructions if not found.
  2. Process execution
    • Use UseShellExecute=false, capture stderr/stdout, and ensure UTF-8 compatibility.
  3. Build tweaks
    • Ensure ScreenForge.App builds with -r linux-x64 on .NET 8.
    • Remove/guard any Windows-only assumptions (e.g., path separators, Win32 specifics).
  4. Packaging (first step)
    • Start with a portable publish (no FFmpeg bundled):
      dotnet publish ScreenForge.App -c Release -r linux-x64 --self-contained false
    • Document how to install FFmpeg via distro package manager.
  5. Docs
    • Add a new README › Linux section (install .NET SDK 8 + FFmpeg, run instructions).
  6. CI (nice to have)
    • Add a Linux job to GitHub Actions that builds linux-x64 and runs a smoke test (launch and exit).

Getting started (suggested)

  • Prereqs on Linux:
    • .NET 8 SDK (dotnet --list-sdks should include 8.x).
    • FFmpeg available on PATH (ffmpeg -version).
  • Install examples:
    • Debian/Ubuntu: sudo apt update && sudo apt install ffmpeg
    • Fedora: sudo dnf install ffmpeg
    • Arch: sudo pacman -S ffmpeg
  • Build:
    dotnet restore
    dotnet publish ScreenForge.App -c Release -r linux-x64 --self-contained false
    

Acceptance criteria

  • ✅ App builds on linux-x64 (.NET 8) without code changes to Windows-only bits.
  • ✅ When FFmpeg is installed on the system PATH, recording works (manual smoke test: select region, start/stop, output file created).
  • ✅ FFmpeg path resolution covers:
    • SCREENFORGE_FFMPEG pointing to a valid binary,
    • user tools dir fallback,
    • system PATH via which.
  • README updated with Linux instructions (install, build, run, troubleshooting).
  • ✅ No binary artifacts committed (keep **/bin, **/obj, **/runtimes ignored).

Nice-to-haves (future follow-ups)

  • Optional downloader that offers to fetch FFmpeg on first run (e.g., using SharpCompress).
  • Packaging as AppImage or Flatpak/Snap once basic linux-x64 runtime is solid.
  • Wayland vs X11 notes (overlays, screen capture APIs, permissions).

Where to look in the codebase

  • FFmpeg path resolution: ScreenForge.FFmpeg/FFmpegLocator.cs (or equivalent place in App startup).
  • App services: ScreenForge.App/Services/*.
  • UI/ViewModels: ScreenForge.App/ViewModels/* and Views/*.

How to contribute

  • Please comment below if you’re familiar with Avalonia on Linux and FFmpeg.
  • Open a Draft PR early if you start implementing this.
  • Suggested labels: help wanted, platform:linux, avalonia.

Thanks in advance to anyone who can help us bring ScreenForge to Linux!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions