Skip to content

Encoder FFmpeg

Xaymar edited this page Jan 19, 2024 · 21 revisions

FFmpeg Encoders 🟢Windows Linux MacOS

Originally released as a separate plugin, the FFmpeg Encoder feature allows you to use any FFmpeg video or audio encoder directly in the Streaming or Recording tab of OBS Studio. It implements interfaces to both software and hardware encoders and attempts to minimize the overhead FFmpeg has where possible.

Version Information
Status Version
🔴Added 0.8.0a2
🟠Unstable 0.9
🟢Stable 0.10
⚠️Deprecated N/A
❌Removed N/A

Notes

FFmpeg Encoders support OBS Studio's definition of "Zero"-Copy!

As FFmpeg encoder implementations vary in quality and stability, it was decided to separate OBS Studio from the effects of the encoder. This results in a single copy being made on the chosen device itself, allowing faster encoding performance and a more stable experience overall. The resulting behavior and performance is identical to the current "Zero"-Copy implementations in OBS Studio.

Settings

All FFmpeg Encoder options have a default value that just accepts whatever FFmpeg thinks the default should be. For number fields, the default value can either be achieved with -1 or 0. This is a libOBS limitation and we can do nothing about it.

FFmpeg Options

Custom Settings

Override some (or all) FFmpeg settings available in the AVCodecContext and currently chosen encoder specific in any supported format. This can be used to set options that are not present in the UI, or are only available in specific versions of FFmpeg. Supports a limited set of escape sequences, and can handle quoted strings.

  • The assigned style: -key=value -key=value.
  • The command style: -key value -key value. (v1.0.0b439 and beyond)

GPU (-gpu)

If the encoder is Hardware Accelerated and supports multi-GPU encoding, allows choosing which GPU the encoder will run on. The default of -1 will pick the GPU that OBS Studio is running on and shares the DirectX or OpenGL context with the encoder, thus allowing for zero-copy encoding. Anything else will pick GPUs in an undeterminable order, usually set by either the Operating System or the Drivers.

Number of Threads (-threads)

The ideal number of threads to use for an encoder if the encoder support this feature. As this is a soft limit, encoders may opt to exceed the set value at will.

Framerate Override

Override at which Framerate the encoder will encode at, which may improve quality or provide other benefits. The underlying implementation does this by skipping every X framerates, where X is the integer fraction of the framerate. This settings may not be compatible with all services and outputs, so the usual Trial & Error method should be applied.

Update 2023-06-24: A pull request exists which makes this feature available to all encoders, though support in OBS Studio will likely take a while longer.

Clone this wiki locally