Jump to content

FFmpeg

From Pulsed Media Wiki

FFmpeg

FFmpeg is a free and open-source software suite for handling multimedia data. It is widely used for recording, converting, streaming, and processing audio and video content. FFmpeg supports a vast range of codecs, formats, and filters, making it one of the most powerful and versatile tools in multimedia production and post-processing.

The project was started in 2000 by Fabrice Bellard and is actively maintained by a global community of developers. FFmpeg is available on most major platforms, including Linux, Windows, and macOS.

Features

  • Format conversion — Convert between nearly all audio and video formats (e.g., MP4, MKV, AVI, MOV, MP3, FLAC, etc.).
  • Codec support — Built-in support for popular video/audio codecs like H.264, H.265 (HEVC), VP9, AV1, AAC, MP3, Opus, and more.
  • Streaming — Transmit live audio and video over protocols like RTMP, RTP, HTTP, HLS, and DASH.
  • Transcoding — Compress or re-encode media to reduce file size or match device requirements.
  • Filtering — Apply visual filters, effects, cropping, scaling, subtitles, watermarks, and more.
  • Recording — Capture video from webcams, screens, or network streams.
  • Metadata editing — View and modify media file metadata.
  • Batch processing — Automate media processing tasks via scripts or cron jobs.

Command-Line Syntax

FFmpeg operates via the command line. A basic conversion command:

ffmpeg -i input.mp4 output.avi

This command converts an MP4 video to AVI format using default codecs.

Extract audio from a video:

ffmpeg -i input.mp4 -vn -acodec copy audio.aac

Resize a video:

ffmpeg -i input.mp4 -vf "scale=1280:720" output.mp4

Convert video to H.265 with CRF quality control:

ffmpeg -i input.mp4 -c:v libx265 -crf 28 output.mp4

Hardware Acceleration

FFmpeg supports hardware-accelerated encoding and decoding, which offloads video processing from the CPU to fixed-function hardware on the GPU or processor. This reduces transcoding time and CPU load substantially, especially for high-resolution content like 4K HEVC.

Intel Quick Sync Video (VAAPI)

On Linux, Intel CPUs with integrated graphics (HD Graphics, UHD Graphics, or Iris) expose hardware encode/decode through VAAPI (Video Acceleration API). FFmpeg supports VAAPI natively.

To transcode a video using VAAPI hardware acceleration:

ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mkv \
  -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 23 output.mp4

Hardware-accelerated H.265 (HEVC) encoding:

ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mkv \
  -vf 'format=nv12,hwupload' -c:v hevc_vaapi -qp 25 output.mp4

Check if VAAPI is available on your system:

ls /dev/dri/renderD128
vainfo

If renderD128 exists and vainfo lists supported profiles, hardware transcoding is ready.

Other hardware backends

FFmpeg also supports NVENC/NVDEC (NVIDIA GPUs), AMF (AMD GPUs), and VideoToolbox (macOS). The -hwaccel flag selects the backend:

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mkv -c:v h264_vaapi output.mp4

Hardware transcoding on a seedbox

Media servers like Jellyfin and Plex use FFmpeg internally for real-time transcoding when a client device cannot play the original format. On a seedbox with an Intel iGPU, FFmpeg's VAAPI support enables hardware transcoding directly.

On shared seedbox plans, the iGPU is shared between users. For dedicated hardware transcoding — multiple simultaneous streams, 4K HEVC, or a family media library — a Minidedi dedicated server gives you the full Intel Quick Sync iGPU with no resource sharing. See Seedbox for Plex and Jellyfin for a complete guide to media server setup.

Use Cases

  • Encoding media for streaming platforms
  • Compressing large video files
  • Converting between file types
  • Editing or trimming media content
  • Embedding subtitles or watermarks
  • Processing surveillance or dashcam footage
  • Automating media workflows in seedboxes and servers

Integration

FFmpeg is often integrated into other software and platforms, including:

  • OBS Studio (for live streaming)
  • VLC media player (internal decoding/encoding)
  • HandBrake (video conversion GUI)
  • Media servers like Jellyfin, Plex, and Emby
  • Server automation and seedboxes (e.g., for transcoding, preview generation)

Licensing

FFmpeg is primarily licensed under the LGPLv2.1 or GPLv2, depending on compilation options and external libraries included.

See also