Resource icon

FFmpeg Encoders for OBS Studio 0.4.0

Xaymar

Active Member
#1
Xaymar submitted a new resource:

FFmpeg Encoders for OBS Studio - Get all the power of FFmpeg without using a custom output!

This plugin adds all FFmpeg encoders to the normal OBS Studio recording and streaming options, as long as the OBS Studio bundled FFmpeg version was built with them enabled. Record with Apple ProRes, VP9, or any codec that FFmpeg supports!

Encoders with a proper UI:
  • Apple ProRes (prores_aw)
Upcoming Encoders with a proper UI:
  • VP9 (libvpx-vp9)
  • x264 (libx264)
  • x264rgb (libx264rgb)
Read more about this resource...
 

Xaymar

Active Member
#2
Xaymar updated FFmpeg Encoders for OBS Studio with a new update entry:

v0.2.0pre2: NVidia NVENC HEVC Encoder and more

The need to write a class for each encoder is no more, as with this update all encoders now use the new generic encoder implementation! With this, all possible video and audio encoders are now being registered to obs-studio and should be available in Advanced Output Mode.
Changelog
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...
Read the rest of this update entry...
 

Xaymar

Active Member
#3
Xaymar updated FFmpeg Encoders for OBS Studio with a new update entry:

v0.2.0pre3: NVidia H.264 Encoder and more

Changelog
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...
Read the rest of this update entry...
 

Xaymar

Active Member
#4
Xaymar updated FFmpeg Encoders for OBS Studio with a new update entry:

Version 0.2.0: NVENC H.264/AVC Streaming and H.265/HEVC Recording

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...
Read the rest of this update entry...
 
#6
Hello @Xaymar ,

You said the following previously in the changelog:
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.
Can you clarify this? Are you saying that we should continue using "NVIDIA HVENC H.264 (new)" until this is further developed? Do you have any tests of the performance difference on resource usage and/or gameplay? How does the output quality compare to the above preset with similar settings and same bitrate?

Sorry for all the questions; I'm hoping to gain a better understanding of this plugin so I can make an informed decision about usage.
 

Xaymar

Active Member
#7
Can you clarify this? Are you saying that we should continue using "NVIDIA HVENC H.264 (new)" until this is further developed?
It's simple. The current plugin uses the software path for the NVENC encoders, as I don't yet have enough knowledge on FFmpeg to make a full on-Hardware encoder a possibility. Therefore it has the same GPU load cost as using the non "(new)" encoder, although at slightly lower CPU cost.

Do you have any tests of the performance difference on resource usage and/or gameplay? How does the output quality compare to the above preset with similar settings and same bitrate?
The quality primarily depends on the settings you choose, but on Turing this plugin allows the use of settings that rival x264 slow in certain cases and usually is better than x264 medium, at some cost of GPU usage. You can check out my quality tests here, they even include the settings required to get the resulting quality: https://xaymar.com/ves/
 
#8
Hello @Xaymar, thank you for having a workaround for this prores bug report for windows users. Would you also consider a Linux (Ubuntu 18.04/19.04 amd64) version of your gui/extension in the near future?

Have had success with building obs-project 23.x in ubuntu 19.04 before for premature decklink gui support in the past, meaning that I could try to build some git patches if you have any?
 

Xaymar

Active Member
#9
Hello @Xaymar, thank you for having a workaround for this prores bug report for windows users. Would you also consider a Linux (Ubuntu 18.04/19.04 amd64) version of your gui/extension in the near future?
If someone manages to implement Linux support to the AppVeyor build script, then yes. However I personally have no interest in Linux, so I myself will not bother to deal with it for the near future.
 
#10
Its understandable Linux support is not in your interest, however is it possible to abstract your ffmpeg cli syntax/arguments for your optimized prores presets so other multi-platform obs-studio users might benefit from your insights?

If my understanding is right, obs-studio needs to talk to a external ffmpeg binary otherwise bug 1245 spoils the performance?
 

Xaymar

Active Member
#11
Its understandable Linux support is not in your interest, however is it possible to abstract your ffmpeg cli syntax/arguments for your optimized prores presets so other multi-platform obs-studio users might benefit from your insights?

If my understanding is right, obs-studio needs to talk to a external ffmpeg binary otherwise bug 1245 spoils the performance?
A button to import and export things from/to an ffmpeg command line is planned, but not high priority right now. There are also no optimized ProRes presets, the gains and improvements are simply in how the plugin handles the FFmpeg library. The plugin also just uses the "external ffmpeg binary" to do things, it just does things correctly.
 
#12
While not having tried earlier versions of your plugin yet, I installed OBS-Studio 24.0.0rc1 and tried your 0.2.0.0 github .exe installer(also tried manual zip install, which requires 24.x) but no obs-ffmpeg-encoder plugin/export menu option shows up after starting OBS-Studio 24.0.0rc1. I also don't see any "Plugins" dock/toolbar either which is I guess would hold your config panel for setting up your obs-ffmpeg-encoder.

However the OBS log shows "obs-ffmpeg-encoder.dll" loaded, do I miss some config steps, external libs/dependencies or something obvious?

Code:
08:51:29.943: CPU Name: Intel(R) Core(TM) i3-4170 CPU @ 3.70GHz
08:51:29.943: CPU Speed: 3691MHz
08:51:29.943: Physical Cores: 2, Logical Cores: 4
08:51:29.943: Physical Memory: 16230MB Total, 13429MB Free
08:51:29.943: Windows Version: 10.0 Build 18362 (revision: 239; 64-bit)
08:51:29.943: Running as administrator: false
08:51:29.943: Aero is Enabled (Aero is always on for windows 8 and above)
08:51:29.943: Windows 10 Gaming Features:
08:51:29.943:     Game DVR: On
08:51:29.945: Sec. Software Status:
08:51:29.946:     Windows Defender Antivirus: enabled (AV)
08:51:29.946:     Windows Firewall: enabled (FW)
08:51:29.946: Current Date/Time: 2019-08-21, 08:51:29
08:51:29.946: Browser Hardware Acceleration: true
08:51:29.946: Portable mode: false
08:51:30.351: OBS 24.0.0-rc1 (64-bit, windows)
08:51:30.351: ---------------------------------
08:51:30.367: ---------------------------------
08:51:30.367: audio settings reset:
08:51:30.367:     samples per sec: 48000
08:51:30.367:     speakers:        2
08:51:30.368: ---------------------------------
08:51:30.368: Initializing D3D11...
08:51:30.368: Available Video Adapters:
08:51:30.370:     Adapter 0: Intel(R) HD Graphics 4400
08:51:30.370:       Dedicated VRAM: 117964800
08:51:30.370:       Shared VRAM:    2147483648
08:51:30.370:       output 0: pos={0, 0}, size={1680, 1050}, attached=true
08:51:30.370:       output 1: pos={1680, -31}, size={1920, 1080}, attached=true
08:51:30.372: Loading up D3D11 on adapter Intel(R) HD Graphics 4400 (0)
08:51:30.378: D3D11 loaded successfully, feature level used: 45056
08:51:30.973: ---------------------------------
08:51:30.973: video settings reset:
08:51:30.973:     base resolution:   1920x1080
08:51:30.973:     output resolution: 1920x1080
08:51:30.973:     downscale filter:  Lanczos
08:51:30.973:     fps:               50/1
08:51:30.973:     format:            NV12
08:51:30.973:     YUV mode:          709/Partial
08:51:30.973: NV12 texture support not available
08:51:30.974: Audio monitoring device:
08:51:30.974:     name: Default
08:51:30.974:     id: default
08:51:30.975: ---------------------------------
08:51:30.983: [CoreAudio encoder]: CoreAudio AAC encoder not installed on the system or couldn't be loaded
08:51:30.985: Failed to load 'en-US' text for module: 'decklink-ouput-ui.dll'
08:51:31.026: [AMF] AMF Test failed due to one or more errors.
08:51:31.026: Failed to initialize module 'enc-amf.dll'
08:51:31.059: [obs-browser]: Version 2.6.1
08:51:31.059: [obs-browser]: Blacklisted device detected, disabling browser source hardware acceleration.
08:51:31.115: Couldn't find VLC installation, VLC video source disabled
08:51:31.165: ---------------------------------
08:51:31.165:   Loaded Modules:
08:51:31.165:     win-wasapi.dll
08:51:31.165:     win-mf.dll
08:51:31.165:     win-dshow.dll
08:51:31.165:     win-decklink.dll
08:51:31.165:     win-capture.dll
08:51:31.165:     vlc-video.dll
08:51:31.165:     text-freetype2.dll
08:51:31.165:     rtmp-services.dll
08:51:31.165:     obs-x264.dll
08:51:31.165:     obs-vst.dll
08:51:31.165:     obs-transitions.dll
08:51:31.165:     obs-text.dll
08:51:31.165:     obs-qsv11.dll
08:51:31.165:     obs-outputs.dll
08:51:31.165:     obs-filters.dll
08:51:31.165:     obs-ffmpeg.dll
08:51:31.165:     obs-ffmpeg-encoder.dll
08:51:31.165:     obs-browser.dll
08:51:31.165:     image-source.dll
08:51:31.165:     frontend-tools.dll
08:51:31.165:     enc-amf.dll
08:51:31.165:     decklink-ouput-ui.dll
08:51:31.165:     coreaudio-encoder.dll
08:51:31.165: ---------------------------------
08:51:31.166: ==== Startup complete ===============================================
08:51:31.166: Service '' not found
08:51:31.169: All scene data cleared
08:51:31.169: ------------------------------------------------
08:51:31.222: WASAPI: Device 'Luidsprekers (Blackmagic DeckLink Duo 2 (3) Audio)' initialized
08:51:31.251: WASAPI: Device 'Lijningang (Blackmagic DeckLink Duo 2 (3) Audio)' initialized
08:51:31.252: Switched to scene 'Scène'
08:51:31.252: ------------------------------------------------
08:51:31.252: Loaded scenes:
08:51:31.252: - scene 'Scène':
08:51:31.252:     - source: 'Color Source' (color_source)
08:51:31.252: ------------------------------------------------
08:51:31.268: adding 21 milliseconds of audio buffering, total audio buffering is now 21 milliseconds (source: Mic/Aux)
08:51:31.268:
 

Xaymar

Active Member
#13
While not having tried earlier versions of your plugin yet, I installed OBS-Studio 24.0.0rc1 and tried your 0.2.0.0 github .exe installer(also tried manual zip install, which requires 24.x) but no obs-ffmpeg-encoder plugin/export menu option shows up after starting OBS-Studio 24.0.0rc1. I also don't see any "Plugins" dock/toolbar either which is I guess would hold your config panel for setting up your obs-ffmpeg-encoder.

However the OBS log shows "obs-ffmpeg-encoder.dll" loaded, do I miss some config steps, external libs/dependencies or something obvious?
The encoders are part of the the encoder drop down in OBS and do not add anything other than that. Take a look at Settings -> Output.
 
#14
Found it! So for others make sure the advanced recording -Type is set to "Standard" instead of "Custom Output(FFmpeg)" otherwise you won't see Xaymar's extra encoders!

OBS-Studio: Settings > Output -Output Mode "Advanced" > Recording -Type "Standard" -Encoder "Apple ProRes (prores_aw)" .

Thanks
 
#17
In short, lags in the preview could be a number of things, but my eye has been on the Desktop Composite and the GPU has to work to scale a copy of the video over to OBS. In the past, I used SLi to improve performance, but it's not preferred.
 
#19
Testing with the 0.2 version on a older Intel i3 I noticed the CPU load would almost triple when going 1080i25 to 1080p50. Altering the preset from prores HQ to prores Standard or LT can also save another 10/20%.

@Xaymar would it possible to record the audio in your prores preset to LPCM and not AAC codec to prevent more CPU load?
For example a default final cut x prores master export shows the following audio properties.

ffprobe:
pcm_s24le (lpcm / 0x6D63706C), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)

quicktime:
lpcm 24bit little endian signed 48000 stereo LR

vlc:
DVD LPCM Audio (lpcm) 32bit
 

Xaymar

Active Member
#20
Testing with the 0.2 version on a older Intel i3 I noticed the CPU load would almost triple when going 1080i25 to 1080p50. Altering the preset from prores HQ to prores Standard or LT can also save another 10/20%.
Going from 1080 Interlaced 25fps to 1080p50 is equivalent to going from 540p25 to 1080p50, which is roughly quadruple the workload. Though I'm not sure how you managed Interlaced output in OBS.

@Xaymar would it possible to record the audio in your prores preset to LPCM and not AAC codec to prevent more CPU load? For example a default final cut x prores master export shows the following audio properties.
No, this would be an OBS feature that needs to be implemented.
 
Top