Commit Graph

150 Commits

Author SHA1 Message Date
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
Michael Fabian 'Xaymar' Dirks 2ebf90ffd7 encoder, ffmpeg/tools: Fix and improve initialization behavior
Correctly sets all color settings for the context and frames, which should result in better playback in players that support these. Unfortunately it does not fix the bug that VLC and MPC-HC incorrectly assume that the ProRes encoded content is in Partial range, however most editing software does correctly detect it.
2019-09-27 16:16:14 +02:00
Michael Fabian 'Xaymar' Dirks a32f8dd28b ui/prores_aw_handler: Override automatic color format when profile demands it
Certain ProRes profiles require a very specific color format, otherwise the avcodec_open2 will fail with EPERM, which is very confusing.
2019-09-27 12:41:13 +02:00
Michael Fabian 'Xaymar' Dirks d8a692de93 codecs/prores: Add ProRes codec data
There isn't really anything here, just some defines.
2019-09-27 12:36:10 +02:00
Michael Fabian 'Xaymar' Dirks a9f39527f6 handler: Additional functionality for handlers
Allows overriding color format, encoder info, importing and exporting from/to ffmpeg command line and most importantly logging actual settings to the log file.
2019-09-27 12:35:34 +02:00
Michael Fabian 'Xaymar' Dirks 71440ed3c5 encoder: Revert change 5c8939b4a8
Breaks more than intended, and this way is better anyway as the error that used to show up gave no indication as to what went wrong. With this reverted it now shows that starting encoding failed.
2019-09-24 16:00:53 +02:00
Michael Fabian 'Xaymar' Dirks 3bd147e6e7 ffmpeg/tools: Improve format selection functionality 2019-09-24 15:58:12 +02:00
Michael Fabian 'Xaymar' Dirks 8b6af720bf encoder: Add support for full on-GPU encoding
Adds support for the full on-GPU encoding path for texture encoding, which just needs to be actually implemented.

In addition this commit also ensures better stability by catching all C/C++ exceptions that could leak to C code which can't handle this at all.
2019-09-23 21:04:18 +02:00
Michael Fabian 'Xaymar' Dirks 993a4f8110 ffmpeg/tools: Function to check for hardware encoding
Implements a function that can be used to check for hardware texture support, which allows full on-GPU encoding to work for supported encoders.
2019-09-23 20:30:03 +02:00