Resource icon

FFmpeg Encoders for OBS Studio 0.4.0

Who needs lower CPU and GPU usage? Everyone! And that's why the new (Hardware) integration now shares the graphics context with OBS Studio, which should result in an even further reduced CPU and GPU usage for everyone. This change requires that you are using OBS Studio 24.0.x, and ideally you are using 24.0.3 or newer.

However due to a problem with Mixer streaming, I had to rename the unique id for each encoder so that Mixer streaming works again. Due to that you will lose all your previous settings for the encoders added by the plugin unless you backed them up in some form (screenshots, text copies) and restore them afterwards.

To make up for this, I've spent a lot of time fixing the NVENC integration. Lookahead, Spatial AQ and Temporal AQ are now correctly set instead of being ignored, which should result in an immediately noticable increase in stream quality, but at the cost of some GPU usage which should be expected. Additionally many of the checkboxes are now dropdowns to allow staying at the default setting given by the FFmpeg encoder.

Also thanks to two kind souls, kryztoval and UserNaem, the plugin now has a user friendly way to select the GPU for (Software) encoders and more settings have a proper description tooltip. Huge thanks for doing this as it made the investigation into NVENC problems easier.
Changelog

0.4.0

  • OBS Studio dependencies were updated! The minimum OBS Studio is now 24.0.3, so make sure that you are using the most up to date OBS Studio there is, otherwise the plugin might behave weird or not even launch.
  • All encoders have been renamed to fix name collisions. Due to this you will lose all encoder configurations, make sure to back them up using screenshots or similar before installing the new version.
  • NVENC Settings are no longer being ignored! Lookahead, Spatial AQ and Temporal AQ should now be properly applied instead of being ignored like they were before. You might see an increase in GPU usage with an identical increase in stream quality due to this.
  • Single Graphics Context Mode is here! The plugin no longer spawns a graphics context per encoder and instead reuses the one that OBS Studio creates, which allows us to work much more efficiently at much lower cost. It is now the default mode for encoders marked with (Hardware).
  • GPU Selection for (Software) encoders! A kind soul called kryztoval has added support for easily changing the GPU on which the encoding will actually happen.
  • Additional setting descriptions were added by another kind soul under the name UserNaem.
  • Error messages should now be more descriptive, instead of just being Not Translated Yet all the time.
  • Various settings were converted to a Tristate option instead of a checkbox, to allow staying at the default value given by the FFmpeg encoder.
  • Custom Settings now take a string in the format -key=value -key=value. This is to be more in line with how you would use FFmpeg, and at a future point -key value might become possible, but right now it is not. However quotes and escaping is fully supported, so there should be no issues for now. You can even do weird stuff like quote stacking.
  • NVENC now logs additonal options and relies on the final values stored in the FFmpeg context instead of OBS settings, which means that overrides done using Custom Settings actually show up.
Changelog

0.3.1

  • Rescaling on the Output tab will now be used instead of only using the rescaling of the Video tab.
0.3.0

  • Updated the libOBS dependency to 24.0.0. You will need to use OBS Studio 24.0.0 or newer in order to run the plugin.
  • Implemented full hardware encoding for all GPU capable encoders (NVENC H264, NVENC H265). This should be perform identical to the OBS included full hardware encoders.
  • Reduced the latency for some encoders to be as low as 1 frame, if settings allow. For NVENC, latency is tied to (B-Frames + 1) and Lookahead Frames, whichever is bigger.
  • Further improved performance by throwing even less memory away every frame. Almost all memory is now re-used if possible and only released when the encoding is stopped by any means.
  • Apple ProRes encoded files should now be remuxable when stored in Matroska (MKV) and survive at least one remuxing. This bug was already fixed in current master FFmpeg, and thanks for discovering this bug go to FRANKIEonPC.
  • All color metadata is now set for encoders that support this, such as NVENC. Video players and editors that support this kind of metadata should see an improvement in color quality, especially with 10-bit or higher output.
  • Framerate is now set to be fixed, further improving compatibility with players. It was previously left to be guessed by the video player through the timing information.
  • Settings are now output to the log file for easier debugging. Please remember to send a log file with any issue you have with the plugin.
Make way, because it's time for full hardware encoding! OBS Studio added this to their built in NVENC a while ago, and today I'm fully releasing it for this plugin. With full hardware encoding, your rendered frame never leaves the GPU, unlike with pseudo hardware encoding where it is first transferred to RAM and then back to the GPU. The benefits of this are much lower GPU usage, reduced game impact, and much lower CPU usage. However due to OBS Studio limitations this restricts you to NV12 without any rescaling except for rescaling set up in the Video tab.

Not only do we have full hardware encoding now, both NVENC encoders now support ultra low latency encoding (as low as 1 frame). This can be enabled by setting B-Frames to 0 and Lookahead Frames to 0, which both control the latency of the encoder (though B-Frames affect latency less than Lookahead Frames). The obvious downside is that it affects quality a lot, which can only be fixed by increasing the bitrate.

Additionally the plugin now sets all color metadata and sets a constant framerate. This should ensure that video editing software can better deal with the footage from the plugin, if they support this kind of metadata. Apple ProRes was also modified to include a workaround for a bug in the FFmpeg version that OBS Studio currently ships with. ProRes content recorded to Matroska (MKV) should now survive one MKV to MKV/MP4/... remux.
Changelog
0.3.0
  • Updated the libOBS dependency to 24.0.0. You will need to use OBS Studio 24.0.0 or newer in order to run the plugin.
  • Implemented full hardware encoding for all GPU capable encoders (NVENC H264, NVENC H265). This should be perform identical to the OBS included full hardware encoders.
  • Reduced the latency for some encoders to be as low as 1 frame, if settings allow. For NVENC, latency is tied to (B-Frames + 1) and Lookahead Frames, whichever is bigger.
  • Further improved performance by throwing even less memory away every frame. Almost all memory is now re-used if possible and only released when the encoding is stopped by any means.
  • Apple ProRes encoded files should now be remuxable when stored in Matroska (MKV) and survive at least one remuxing. This bug was already fixed in current master FFmpeg, and thanks for discovering this bug go to FRANKIEonPC.
  • All color metadata is now set for encoders that support this, such as NVENC. Video players and editors that support this kind of metadata should see an improvement in color quality, especially with 10-bit or higher output.
  • Framerate is now set to be fixed, further improving compatibility with players. It was previously left to be guessed by the video player through the timing information.
  • Settings are now output to the log file for easier debugging. Please remember to send a log file with any issue you have with the plugin.
Changelog
0.3.0pre6
  • Implemented Frame Caching for all types of encoders, which further reduces CPU and GPU usage. On a RTX 2080 Ti, a 1080p60 NV12 hardware encode now only takes 2% GPU and 0.004% CPU.
  • Fixed an issue where too many frames would be allocated and never deallocated, such as during a full OBS freeze. This is unfortunately not an easy problem to fix as OBS does not have a push/pull (sink/faucet) system and instead expects us to always have a 1:1 relationship between send and receive for encoding.
  • Added a feature to allow Codec handlers to override the lag in frames value, which is used to delay querying for packets. Due to this, NVENC can now achieve a latency as low as 1 frame if B-Frames are set to 0.
0.3.0pre5
  • Implemented support for true hardware encoding on Windows when using the Direct3D 11 renderer. This is supported out of the box by all D3D11VA capable FFmpeg encoder, for example with NVENC.
0.3.0pre4
  • Added the ability for packet processing by codec handlers.
  • The ProRes handler now has a packet processing hook to add a workaround for a FFmpeg bug with ProRes content in Matroska/MKV. An FFmpeg patch has not yet been included in OBS Studio, but is available.
  • Temporarily removed packet buffer caching, slightly higher CPU usage should be expected.
0.3.0pre3
  • Improved color space behavior by setting all possible settings, ensuring that standard compliant players and editors (for example DaVinci Resolve) can properly represent color.
  • Default color range is now partial, which matches OBS Studio behavior.
  • Framerate is now being set in addition to the timing base, which should result in better playback.
  • Fixed automatic color format selection again as I forgot to actually have it use the calculated score.
  • NVENC and ProRes now print all settings to the log file.
0.3.0pre2
  • Fixed automatic color format selection always attempting to use hardware formats in libobs 24.x.
  • Actually fixed crashing with software scaling (Output tab) by reading the correct information, thus reverting the previous change.
  • Added some log information when encoders are started and updated.
  • UI Handlers now have the capability to override or enhance a lot of behavior.
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
All Release Files: On GitHub

Changelog
0.3.0pre5
  • Implemented support for true hardware encoding on Windows when using the Direct3D 11 renderer. This is supported out of the box by all D3D11VA capable FFmpeg encoder, for example with NVENC.
0.3.0pre4
  • Added the ability for packet processing by codec handlers.
  • The ProRes handler now has a packet processing hook to add a workaround for a FFmpeg bug with ProRes content in Matroska/MKV. An FFmpeg patch has not yet been included in OBS Studio, but is available.
  • Temporarily removed packet buffer caching, slightly higher CPU usage should be expected.
0.3.0pre3
  • Improved color space behavior by setting all possible settings, ensuring that standard compliant players and editors (for example DaVinci Resolve) can properly represent color.
  • Default color range is now partial, which matches OBS Studio behavior.
  • Framerate is now being set in addition to the timing base, which should result in better playback.
  • Fixed automatic color format selection again as I forgot to actually have it use the calculated score.
  • NVENC and ProRes now print all settings to the log file.
0.3.0pre2
  • Fixed automatic color format selection always attempting to use hardware formats in libobs 24.x.
  • Actually fixed crashing with software scaling (Output tab) by reading the correct information, thus reverting the previous change.
  • Added some log information when encoders are started and updated.
  • UI Handlers now have the capability to override or enhance a lot of behavior.
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
All Release Files: On GitHub

Changelog
0.3.0pre4
  • Added the ability for packet processing by codec handlers.
  • The ProRes handler now has a packet processing hook to add a workaround for a FFmpeg bug with ProRes content in Matroska/MKV. An FFmpeg patch has not yet been included in OBS Studio, but is available.
  • Temporarily removed packet buffer caching, slightly higher CPU usage should be expected.
0.3.0pre3
  • Improved color space behavior by setting all possible settings, ensuring that standard compliant players and editors (for example DaVinci Resolve) can properly represent color.
  • Default color range is now partial, which matches OBS Studio behavior.
  • Framerate is now being set in addition to the timing base, which should result in better playback.
  • Fixed automatic color format selection again as I forgot to actually have it use the calculated score.
  • NVENC and ProRes now print all settings to the log file.
0.3.0pre2
  • Fixed automatic color format selection always attempting to use hardware formats in libobs 24.x.
  • Actually fixed crashing with software scaling (Output tab) by reading the correct information, thus reverting the previous change.
  • Added some log information when encoders are started and updated.
  • UI Handlers now have the capability to override or enhance a lot of behavior.
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
More Download Links: On GitHub

Changelog
0.3.0pre3
  • Improved color space behavior by setting all possible settings, ensuring that standard compliant players and editors (for example DaVinci Resolve) can properly represent color.
  • Default color range is now partial, which matches OBS Studio behavior.
  • Framerate is now being set in addition to the timing base, which should result in better playback.
  • Fixed automatic color format selection again as I forgot to actually have it use the calculated score.
  • NVENC and ProRes now print all settings to the log file.
0.3.0pre2
  • Fixed automatic color format selection always attempting to use hardware formats in libobs 24.x.
  • Actually fixed crashing with software scaling (Output tab) by reading the correct information, thus reverting the previous change.
  • Added some log information when encoders are started and updated.
  • UI Handlers now have the capability to override or enhance a lot of behavior.
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
Changelog
0.3.0pre2
  • Fixed automatic color format selection always attempting to use hardware formats in libobs 24.x.
  • Actually fixed crashing with software scaling (Output tab) by reading the correct information, thus reverting the previous change.
  • Added some log information when encoders are started and updated.
  • UI Handlers now have the capability to override or enhance a lot of behavior.
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
Changelog
0.3.0pre1
  • Updated libobs to v24.0.0-rc2.
  • Fixed a crash when using software rescaling by moving initialization to the encode call.
Changelog
0.2.0
  • The old Apple ProRes encoder has been completely replaced by the new implementation, which is up to 50% faster on various CPUs.
  • Fixed support for BT.601 color format on some players that do not understand both BT.601 color format values.
  • Implemented flushing for delayed encoders to fix issues when stopping streaming/recording.
  • Fixed support for OBS Studio v24.x and newer.
  • Reduced upper limit for NVENC lookahead option to 32 from 60 to match actual hardware capability.
  • Added option to set the Quality Target for NVENC VBR.
  • Added HEVC NAL parsing for better playback in some players that rely on muxer information.
0.2.0pre3
  • Added support for NVidia's NVENC H.264/AVC Encoder. This encoder is on average ~0.1-0.2% less CPU expensive than the OBS Studio included version, however will still affect performance more than the included hardware version.
  • Fixed a bug that caused the "Constant Quantization Parameter" (CQP) rate control mode to not work in NVidia's NVENC encoder.
  • Quantization Parameters in NVidia's NVENC encoders should now work correctly and have proper text.
  • The NV12 video format is now correctly supported and should result in a not-always-green encoded video output.
  • The plugin will now prefer formats that require zero conversion when the color format is set to Automatic.
  • Fixed an issue where the main encoding loop would throw away AVFrame's instead of storing them for re-use.
  • Fixed a memory leak with AVPacket which results in slowly increasing memory usage for every encoding session.
0.2.0pre2
  • Improved frame conversion/copy speed by increasing the memory alignment to 32 bytes. On AMD Ryzen this results in halved CPU usage, while on Intel this had no effect, essentially making any AMD Ryzen CPU faster than the Intel equivalent CPU.
  • Added NVidia's NVENC HEVC Encoder with all settings available to change and toy with.
  • Fixed threading for all threading models and thread counts.
  • Fixed a memory leak with the debug handler that resulted in an eventual out of memory situation.
  • Fixed a bug that incorrectly set the time base inverted, resulting in 60 fps being 1 frame every 60 seconds instead of 60 frames per second.
  • Encoders without a dedicated UI handler are now considered deprecated, but they can still be used through other means.
  • Reduced the extensive use of the currently broken Property Groups until they are hopefully fixed in 24.x and above.
  • Removed "Requires Flush", "Frame-Threading", "Slice-Threading", "Automatic Threading" and "I-Frames only" from the visible encoder name.
  • Deprecated old Apple ProRes encoder, please use the new implementation from now on.
0.2.0pre1
  • Implemented a generic encoder that allows code re-use across many encoders, allowing all available encoders to be used out of the box.
  • Implemented a way to override the generated UI for specific encoders.
  • Implemented prores_aw UI override.
  • Fixed a few memory leaks that happened with lost references to AVFrames, resulting in eventual out of memory situations.
Top