Open WinterPhoenix opened 3 years ago
This affects any encoder that trusts the preferred video format to be correct. For streaming, the preferred video format is set to NV12, unless the color format is set to I420/NV12 already. To my knowledge, only obs-x264 and obs-ffmpeg-nvenc actually use this. jim_nvenc doesn't specify a get_video_info function, and enc-amf uses whatever is in the video info (but it can only do NV12 anyway due to hardware restrictions).
I ran into this issue on Linux, and made a small hacky workaround using LD_PRELOAD
:
// Compile with: gcc -std=c11 obs-override-forced-nv12.c -shared -fPIC -o obs-override-forced-nv12.so
// Activate with: LD_PRELOAD=/path/to/obs-override-forced-nv12.so obs
#define _GNU_SOURCE
#include <dlfcn.h>
#include <threads.h>
void obs_encoder_set_preferred_video_format(void* encoder, int format) {
static thread_local void *(*orig)(void*, int) = NULL;
if (!orig)
orig = dlsym(RTLD_NEXT, "obs_encoder_set_preferred_video_format");
#define VIDEO_FORMAT_NV12 2
if (format == VIDEO_FORMAT_NV12)
return;
orig(encoder, format);
}
Of course a proper fix would be to have some checkbox in the UI, but this is good enough for me
Since we have native handlers for SRT and RIST and can stream h265, it would be logical to remove forced subsampling for those protocols.
We use OBS to stream the image to the director's computer and the forced subsampling causes colors lost. It would be great if we could stream on SRT in an honest 4:4:4 and Full-color range.
Platform
Operating system and version: Windows 10 1909 (Build 18363.1082) OBS Studio version: 26.0.0
Expected Behavior
With a Custom Stream Service set, OBS should respect the Color Format setting (in this case, I444). Recording is not affected by this.
Current Behavior
4:2:0 Chroma Subsampling is forced no matter what Stream service is selected, even a Custom one that supports 4:4:4.
Log File:
Steps to Reproduce
Additional information
Not respecting user-selected Video Color settings is confusing to users, and particularly non-helpful to those in this scenario who are expecting to be able to accurately reproduce colors through streaming video.
I understand the motivations behind wanting to maintain the widest amount of support possible, however this is not something that should extend to scenarios where the user is deliberately trying to utilize OBS to its fullest potential.