158 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 9f23ffc009 plugin: Don't add audio encoders
This is a temporary workaround until OBS supports selecting audio format for each stream.
2020-01-02 12:31:38 +01:00
Michael Fabian 'Xaymar' Dirks d21687e348 ui/prores_aw: Fix support for future FFmpeg versions
The encoder changes profile names in an update to FFmpeg which makes it completely incompatible with the current plugin.
2019-12-14 00:22:23 +01:00
Michael Fabian 'Xaymar' Dirks 0d574b81ff ui/nvenc: Export bitrate for OBS Studio to use
This should improve Replay Buffer and Low Latency Networking code, which may result in drastically better streaming with less dropped frames. I don't know why OBS Studio does it this way instead of just calculating the true kbit/sec bitrate by itself, but I guess this is just another case of "it works so it stayed in".
2019-11-17 12:21:02 +01:00
Michael Fabian 'Xaymar' Dirks 815152d024 encoder: Actually fix parsing this time 2019-11-16 23:46:20 +01:00
Michael Fabian 'Xaymar' Dirks e4474c29c4 ui/nvenc: Improve and fix some options and logging
Some of the options shown to the user were never actually being applied, which resulted in encoding that looked worse than it could have. With this these options are now applied and users may experience a sudden increase or decrease in quality if they had these options changed.

In addition to that, some options now use a triple state field, which allows them to also have a default/middle state instead of being On or Off.

Furthermore, log output is now read from the actual AVCodecContext, which contains the actual values used in the encoding, instead of relying on the OBS settings to be the actual values.
2019-11-16 21:44:03 +01:00
Michael Fabian 'Xaymar' Dirks 2a75d5fabd ffmpeg/tools: Add functions for easy logging 2019-11-16 21:19:30 +01:00
Michael Fabian 'Xaymar' Dirks a0bfac9319 encoder: Fix crash because of missing string parameter 2019-11-16 21:19:17 +01:00
Michael Fabian 'Xaymar' Dirks 65dddb5aa8 utility: Add functions to check the state of tristates 2019-11-16 21:18:58 +01:00
Michael Fabian 'Xaymar' Dirks 59e33a132b ui/nvenc: Remove "Encoder" from name
It's already known that this is an encoder.
2019-11-16 13:04:10 +01:00
Michael Fabian 'Xaymar' Dirks be7b2737b4 encoder, ui/handler: Massive Refactor
This refactor is primarily to make the entire interface more unified and capable of more than before.
2019-11-15 17:29:24 +01:00
Michael Fabian 'Xaymar' Dirks 8f20a45ee8 hwapi/d3d11: Remove unused variables 2019-11-15 17:20:37 +01:00
Michael Fabian 'Xaymar' Dirks 300531ad8a ffmpeg/tools: Extra name functions 2019-11-15 13:31:27 +01:00
Michael Fabian 'Xaymar' Dirks c775ae93b7 utility: Add helper for tristate property 2019-11-15 01:12:32 +01:00
Michael Fabian 'Xaymar' Dirks 18c50b3cbb ui/handler: Refactoring 2019-11-13 11:44:40 +01:00
Michael Fabian 'Xaymar' Dirks 04a22a13dc encoder: Fix incorrect command line parsing code 2019-11-12 13:36:02 +01:00
Michael Fabian 'Xaymar' Dirks d8eb38037b encoder: Improve custom options parsing drastically
Splits the parsing into two steps, one for quotes and escaping, the other for actual option parsing. This drastically lowers the chances of messing up, and makes the entire thing much safer than a really complex monolithic loop.
2019-11-12 01:05:29 +01:00
Michael Fabian 'Xaymar' Dirks 81164d0f43 encoder: Cleanup and refactor for stability 2019-11-11 23:24:19 +01:00
Michael Fabian 'Xaymar' Dirks 05d8e74088 encoder: Use ffmpeg::tools::get_error_description 2019-11-11 21:15:56 +01:00
Michael Fabian 'Xaymar' Dirks d233b52e1f ffmpeg/tools: Rewrite ffmpeg::tools::get_error_description 2019-11-11 21:15:38 +01:00
Cristobal E 2759153b0e encoder: Show proper warning messages for custom options 2019-11-11 20:57:55 +01:00
Cristobal E 629afe3661 encoder: Add field for GPU selection 2019-11-11 20:57:53 +01:00
Michael Fabian 'Xaymar' Dirks 80d104bdeb encoder: Use new graphics lock and create_from_obs method 2019-11-07 22:09:58 +01:00
Michael Fabian 'Xaymar' Dirks ffb348b6c8 hwapi/d3d11: Implement create_from_obs
Allows zero-copy with zero-overhead hardware encoders in OBS Studio.
2019-11-07 22:09:34 +01:00
Michael Fabian 'Xaymar' Dirks b67f51df76 hwapi/base: Create from OBS context 2019-11-07 22:08:46 +01:00
Michael Fabian 'Xaymar' Dirks 24d92e4b92 utility: Managed OBS Graphics Context 2019-11-07 22:08:21 +01:00
Michael Fabian 'Xaymar' Dirks 2184e5bc71 project: Reapply formatting 2019-11-04 18:32:47 +01:00
Michael Fabian 'Xaymar' Dirks ad761834ee encoder: Improve parsing of custom settings
Implements a parsing mechanism similar to that of an FFmpeg on the command line. Instead of separating options by ';' (key=value;key=value) the custom settings now take things as '-key=value -key=value -key="value with space"'.

A partial escaping of characters is also supported, however it does not modify the actual string. Proper support for escaping may land in a future update.

Fixes #5
Related #12
2019-11-04 18:32:36 +01:00
Michael Fabian 'Xaymar' Dirks a0b667c26f encoder: Rename all encoders to fix name collisions
This is a breaking change that will make all previous configuration no longer work.
2019-11-04 15:02:13 +01:00
Michael Fabian 'Xaymar' Dirks b2b5cd8fad encoder: Fix width and height to use rescaled resolution
The function video_output_get_info does not contain rescaling information from the output tab, so by replacing it with obs_encoder_get_width/height we can actually use the scaled resolution.
2019-10-31 06:34:58 +01:00
Michael Fabian 'Xaymar' Dirks f21cbe9aba ui/nvenc_shared: Fix lag calculation for rc-lookahead 2019-10-19 02:40:50 +02:00
Michael Fabian 'Xaymar' Dirks 58d8713369 enocder: Use ffmpeg for pixel format again
Reverts an earlier change as this apparently works now.
2019-10-17 08:16:42 +02:00
Michael Fabian 'Xaymar' Dirks 2f8acc58cf encoder: Separate get_defaults and get_properties for SW/HW encoders 2019-10-04 19:27:45 +02:00
Michael Fabian 'Xaymar' Dirks e4e76dae8f ui/nvenc: Override lag in frames to use Max. B-Frames 2019-10-03 20:10:03 +02:00
Michael Fabian 'Xaymar' Dirks 4cac28a8a3 ui/handler, encoder: Allow overriding lag in frames
The lag in frames is not dictated by the number of threads being used by some encoders. At least for hardware encoders, the expected frame lag in real time encoding is 1 + the number of bframes
2019-10-03 20:09:34 +02:00
Michael Fabian 'Xaymar' Dirks d0dc4be985 encoder: Replace ffmpeg::avframe_queue with integrated implementation 2019-10-03 19:21:54 +02:00
Michael Fabian 'Xaymar' Dirks 4836f9dda6 hwapi/d3d11: Implement new HWAPI code 2019-10-03 19:19:20 +02:00
Michael Fabian 'Xaymar' Dirks 650b397ced hwapi/base: Improve frame allocation method
This allows us to cache existing frames, reducing the CPU and GPU memory load that appears due to constantly recreating frames.
2019-10-03 19:18:44 +02:00
Michael Fabian 'Xaymar' Dirks d3f7b15633 hwapi/base: Add missing #include <memory> 2019-09-29 19:33:51 +02:00
Michael Fabian 'Xaymar' Dirks 545dcd6d50 encoder: Add support for true hardware encoding
This is the last step towards truly efficient encoding on AMD, Nvidia and Intel GPUs. With this we have no software overhead and can directly encode the content that OBS gives us, without going through any intermediate CPU layer. This is effectively what @jp9000 did for the OBS-integrated nvenc, but thanks to FFmpeg it works on all encoders that support D3D11VA acceleration.

With the change, the encoding should now work flawlessly even in very constrained situations (unless OBS itself is being starved of resources). Especially people streaming and recording Ubisoft games will likely see a drastic increase in encoding capability, and thanks to the new options will also be able to get a much higher quality stream and recording with the same hardware.
2019-09-29 19:29:00 +02:00
Michael Fabian 'Xaymar' Dirks 0461b20e1b ui/handler: Allow Codec handlers to select the proper device 2019-09-29 19:16:26 +02:00
Michael Fabian 'Xaymar' Dirks b3a6dbb1b4 hwapi: Add API handlers to deal with some heavy lifting code
Makes our life easier when actually dealing with hardware encoding.
2019-09-29 19:15:45 +02:00
Michael Fabian 'Xaymar' Dirks fe71944199 ui/prores_aw_handler: Workaround for FFmpeg bug with ProRes in Matroska
In current FFmpeg, whenever Matroska with ProRes is demuxed it creates an atom that is just 8 bytes short of the true size necessary.

We can work around this by padding the actual packet by 8 0x00 bytes, which should result in older FFmpeg versions working fine.

An FFmpeg patch is available: http://ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250724.html
2019-09-29 07:27:22 +02:00
Michael Fabian 'Xaymar' Dirks cbd39a8c2a encoder: Cache the UI handler and allow packet processing 2019-09-29 06:58:01 +02:00
Michael Fabian 'Xaymar' Dirks 62eae3827b ui/handler: Add function for packet processing 2019-09-29 06:55:42 +02:00
Michael Fabian 'Xaymar' Dirks 38e7639862 ffmpeg/tools: Actually use the score 2019-09-28 02:10:37 +02:00
Michael Fabian 'Xaymar' Dirks 6bc1cb9c88 ui/nvenc*: Print all settings to the log file 2019-09-28 01:54:28 +02:00
Michael Fabian 'Xaymar' Dirks c63900d575 encoder: Also log custom overrides 2019-09-28 01:48:56 +02:00
Michael Fabian 'Xaymar' Dirks 9efda8af8d ui/prores_aw_handler: Print profile to log 2019-09-27 16:29:01 +02:00
Michael Fabian 'Xaymar' Dirks 0c9764a15c encoder: Use codec name instead of encoder info 2019-09-27 16:28:44 +02:00
Michael Fabian 'Xaymar' Dirks 5c5a235502 ui/handler: Always have a no-op function 2019-09-27 16:16:39 +02:00