Because the new NVENC implementation requires texture sharing, if the
user chooses to use a secondary GPU, fall back to the old implementation
instead.
Adds a texture-based NVENC implementation which passes OBS NV12 output
textures directly to NVENC without downloading them off of the GPU,
increasing NVENC performance by a significant margin.
If NV12 textures are unavailable or the new encoder fails to initialize
for whatever reason, it will fall back to the FFmpeg NVENC
implementation safely.
Adds VBR rate control mode, adds a lookahead option, adds psycho visual
tuning option, removes level property (now always set to 'auto'),
removes "2pass" option (replaced by new "Max Quality" preset which uses
2pass by default), modifies a few defaults, and updates their locale
text.
This implements a blacklist of devices that ship with NVENC libraries,
but do not support NVENC, which would cause the plugin to mistakenly
think that NVENC was available when it was not. If these devices are
the only NVIDIA devices on the system, consider NVENC unavailable.
This is much more efficient than spawning an encoder on startup to see
if NVENC is available, which would incur a ~500 millisecond hit on
startup. Additionally, also much less crash-prone.
A bit of a hack, but this is one of the more common errors that users
are encountering, so showing useful information will help cut down on
the number of support issues.
After you call av_frame_alloc(), ffmpeg expects you to fill in certain
fields on the frame, depending on whether it's an audio or video frame.
obs-ffmpeg did this in the two places where it allocates video frames,
but not where it allocates audio frames. On my system, using trunk
ffmpeg and the Opus codec, this causes OBS to crash while calling
avcodec_send_frame, ultimately because av_frame_copy fails due to
'dst->format < 0' (as 'format' stays at the default of -1), causing a
null pointer to be added to a buffer queue, which later gets
dereferenced.
Oddly, the fields in question can just be copied directly from
corresponding fields in the AVCodecContext, but I don't see any ffmpeg
API to automatically copy all relevant fields, and all the examples I've
seen do it by hand. So this patch does the same.
The cutoff hack was added many, many years ago as recommended by
Konverter. Since then, there has been much work on the AAC encoder, so
this hack should no longer be necessary.
(This commit also modifies the obs-ffmpeg module)
The default channel layouts from aac spec are implemented in FFmpeg
native aac encoder as follows:
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND,
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1,
The correspondence of speaker layouts to AV_CH_LAYOUT from FFmpeg is
changed to reflect the previous table.
Although FFmpeg native aac encoder can now encode all the layouts listed
in avutil channel_layout.h (on master), there might be issues with older
FFmpeg binaries.
Note that 2.1 speaker layout will be encoded as AV_CH_LAYOUT_SURROUND
(FL FR FC) because it is not listed as the default layout for three
channels.
This just means some optimizations for LFE channel will not be used by
the encoder which will treat it as an SCE (single channel element).
Closesjp9000/obs-studio#1182
The reason this code is being reverted/removed is because this code is a
risk to startup stability. This check will be added again in the
future, however this code needs to be executed from a secondary piped
process instead of directly in the process to reduce risk of
driver/hardware issues impacting program startup. The same needs to be
accomplished for the AMF plugin as well.
This reverts commit 94b5982216.
Reverting this commit because it had some negative side effects, such as
adding 500 milliseconds to the startup time. NVENC detection should
really be done through its proper API, and not via creating an encoder
on startup.
(also obs, deps/media-playback, libobs/audio-monitoring, decklink,
linux-alsa, linux-pulseaudio, mac-capture, obs-ffmpeg, win-dshow,
win-wasapi)
Default channel layout for 4 channels is 4.0 in FFmpeg.
Replacing quad with 4.0 will improve compatibility since FFmpeg has
better support of its default channel layouts.
(also modifies obs-ffmpeg, audio-monitoring, win-wasapi, decklink,
obs-outputs)
Removes speaker layouts which are not exposed in UI. The speaker
layouts selectable by users in the UI are the most common ones. It is
not necessary to keep other layouts. (This basically removes
5POINT1_SURROUND, 7POINT1_SURROUND, SURROUND =3.0).