foxws/laravel-ab-av1

A Laravel package for encoding videos to AV1 format using ab-av1.

Fund package maintenance!
Foxws

Installs: 268

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/foxws/laravel-ab-av1

0.4.0 2026-02-21 20:13 UTC

This package is auto-updated.

Last update: 2026-02-21 20:16:04 UTC


README

A Laravel wrapper for ab-av1, the AV1 video encoder with automatic CRF calculation and VMAF quality targeting.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Features

  • Automatic CRF Discovery: Find the optimal CRF value to achieve target VMAF quality
  • Multiple Encoders: Support for av1_svtenc, av1_vaapi, libx264, libx265, and other ffmpeg encoders
  • Quick Sampling: Test encode quality before full encoding
  • Hardware Acceleration: Support for VAAPI and other hardware acceleration methods
  • VMAF/XPSNR Comparison: Calculate quality scores between original and encoded files
  • Event Dispatching: Listen to encoding events (started, completed, failed)
  • Fluent Interface: Chainable configuration API

Installation

Ensure ab-av1 is installed:

# macOS
brew install ab-av1

# Linux (Arch)
sudo pacman -S ab-av1

Install the Laravel package:

composer require foxws/laravel-ab-av1

Publish the config:

php artisan vendor:publish --provider="Foxws\AbAv1\AbAv1ServiceProvider"

Configuration

Binary Path

By default, the package expects ab-av1 to be in your system PATH. If you need to use a specific binary path or version, configure it in config/ab-av1.php or via environment variable:

# .env
AB_AV1_BINARY=/usr/local/bin/ab-av1
# Or use a specific cargo installation
AB_AV1_BINARY=/home/user/.cargo/bin/ab-av1

Verify your installation:

php artisan ab-av1:info

Quick Start

use Foxws\AbAv1\Facades\AbAv1;

$result = AbAv1::encode()
    ->withInput('/path/to/video.mp4')
    ->withPreset('medium')
    ->withMinVMAF(95)
    ->autoEncode();

echo "VMAF: {$result->getVMAFScore()}";
echo "CRF: {$result->getCRFUsed()}";

Usage Examples

Auto-encode (Recommended)

Automatically find the best CRF for your target VMAF quality:

$result = AbAv1::encode()
    ->withInput('video.mp4')
    ->withPreset('medium')
    ->withMinVMAF(95)
    ->withOutput('output.mp4')
    ->autoEncode();

Direct Encode

Encode with a specific CRF value:

$result = AbAv1::encode()
    ->withInput('video.mp4')
    ->withCRF(30)
    ->withPreset('slow')
    ->encode();

Sample Encode

Quick test to preview quality:

$result = AbAv1::encode()
    ->withInput('video.mp4')
    ->withCRF(28)
    ->sampleEncode();

Hardware Acceleration

Enable VAAPI for faster encoding:

$result = AbAv1::encode()
    ->withInput('video.mp4')
    ->withPreset('medium')
    ->withMinVMAF(95)
    ->withFFmpegOptions([
        'hwaccel' => 'vaapi',
        'hwaccel_output_format' => 'vaapi',
    ])
    ->autoEncode();

Testing

composer test

Documentation

See examples/basic-usage.php for comprehensive usage examples.

For detailed documentation, see the generated docs.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.