Skip to content

Linux Setup

Install and configure FFmpeg on Linux

Table of Contents


Installation

Ubuntu/Debian

sudo apt update
sudo apt install ffmpeg

Fedora

sudo dnf install ffmpeg

Arch Linux

sudo pacman -S ffmpeg

Verify Installation

ffmpeg -version

Bundling FFmpeg with Your App

For distribution, you can bundle FFmpeg with your application:

Using CMakeLists.txt

Add to linux/CMakeLists.txt:

# Copy FFmpeg binary to bundle
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg"
        DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
                    GROUP_EXECUTE GROUP_READ)

Configure Fluvie to Use Bundled FFmpeg

import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:fluvie/fluvie.dart';

void main() {
  // Get the directory where the executable is located
  final execDir = path.dirname(Platform.resolvedExecutable);
  final ffmpegPath = path.join(execDir, 'lib', 'ffmpeg');

  if (File(ffmpegPath).existsSync()) {
    FluvieConfig.configure(ffmpegPath: ffmpegPath);
  }

  runApp(MyApp());
}

Snap/Flatpak Considerations

If distributing via Snap or Flatpak, FFmpeg may need to be included in your package or accessed via a plug/portal.

Snap

Add to snap/snapcraft.yaml:

parts:
  my-app:
    stage-packages:
      - ffmpeg

Flatpak

Add to your manifest:

{
  "modules": [
    {
      "name": "ffmpeg",
      "buildsystem": "autotools",
      "sources": [
        {
          "type": "archive",
          "url": "https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz"
        }
      ]
    }
  ]
}

Troubleshooting

FFmpeg Not Found

  1. Check if FFmpeg is in PATH:

    which ffmpeg
    

  2. If installed but not in PATH, configure the path:

    FluvieConfig.configure(ffmpegPath: '/usr/local/bin/ffmpeg');
    

Permission Denied

Ensure the FFmpeg binary has execute permissions:

chmod +x /path/to/ffmpeg

Missing Codecs

Some distributions ship FFmpeg without proprietary codecs. Install the full version:

# Ubuntu with restricted codecs
sudo apt install ffmpeg ubuntu-restricted-extras