Commit Graph

683 Commits

Author SHA1 Message Date
PatTheMav
19c131c981 obs-ffmpeg: Remove unused variables 2023-02-18 15:22:33 -08:00
PatTheMav
6e0d802874 obs-ffmpeg: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
pkv
e355a32066 obs-ffmpeg: Relax 'lookahead' constraint when bitrate is updated
When bitrate is updated, a check against 'lookahead' setting is done.
If 'lookahead' is enabled, the bitrate update is disabled.
We indeed used to observe crashes with nvenc when frequent bitrate
resettings were effected while lookahead option was enabled.
But recent tests have shown that the issue is gone.
As a result this commit allows 'lookahead' with bitrate live update.

Signed-off-by: pkv <pkv@obsproject.com>
2023-02-17 15:41:43 -05:00
Richard Stanway
e280fd6cd0 obs-ffmpeg: Add GeForce MX350 variant to unsupported NVENC list 2023-02-17 11:19:08 -05:00
Richard Stanway
25f01357e6 obs-ffmpeg: Handle NV_ENC_ERR_NO_ENCODE_DEVICE error 2023-02-17 11:19:08 -05:00
Richard Stanway
7dae8d307c obs-ffmpeg: Restore bad GPU index NVENC error message
FFmpeg wipes priv_data if the encoder fails to start, so we need some
way of knowing if the GPU index was non-zero. This is a bit ugly but the
best way to do it for now.
2023-02-17 11:19:08 -05:00
Richard Stanway
e593335086 obs-ffmpeg: NVENC error logging improvements
This writes the result of nvEncGetLastErrorString to the last encoder
error instead of just the log file. This makes it user-visible, which
should help users diagnose and solve the problem.

Also strips off leading colons from NVENC error strings as these can
look odd given our format string. An example of such an error:

::NV_ENC_TWO_PASS_FULL_RESOLUTION is only supported multipass encoding
on this architecture.
2023-02-17 11:19:08 -05:00
Roman Huts
c5a06d3cf2 obs-ffmpeg: Update AMF SDK to v1.4.29 2023-02-13 14:38:18 -05:00
pkv
ad3df88fe3 obs-ffmpeg: Fix encoding of 2.1 with FFmpeg aac encoder
The aac spec has a list of default channel layouts that are implemented
by all aac encoders / decoders.
Unfortunately 2.1 is not in that list. When I wrote the surround sound
support into OBS, as a workaround I decided to encode 2.1 as
AV_CH_LAYOUT_SURROUND = FL+FR+FC.
The LFE channel is encoded as a regular audio channel which uses more
bits but this allows compatibility with all aac decoders.
Recently we updated to the new channel layout API of FFmpeg, but the
mapping of 2.1 to AV_CH_LAYOUT_SURROUND was forgotten in the FFmpeg
native aac encoder. This is remedied here.

Signed-off-by: pkv <pkv@obsproject.com>
2023-02-11 15:06:47 -08:00
tt2468
b2375a0660 obs-ffmpeg: Initialize SRT stats object before requesting stats
The `srt_bstats()` function is not guaranteed to zero the stats object
before filling in stats. If a socket was connected, then disconnected,
without any data being sent over it, the stats object would remain
uninitialized, and weird results could occur.
2023-02-08 11:13:41 -08:00
Jim
4488202247 obs-ffmpeg: Remove unused variables 2023-02-05 02:55:24 -08:00
Norihiro Kamae
e7c40a1d29 obs-ffmpeg: Remove unused macro 2023-01-28 19:03:55 -08:00
Richard Stanway
668775f4f0 obs-ffmpeg: Use gai_strerrorA for error logging on Windows
Avoids wide characters in the format string which cause truncation.
2023-01-27 23:41:07 +01:00
tytan652
ee144377dc cmake,obs-ffmpeg: Refactor Libva finder
This refactor adds Libva DRM, required for obs-ffmpeg
2023-01-25 13:14:41 -05:00
jpark37
3462ea3fda obs-ffmpeg: Tell FFmpeg that BGRA uses alpha
Prevents alpha from getting dropped with custom encoders.
2023-01-24 18:39:12 -08:00
tytan652
c648222332 libobs,libobs-opengl,obs-ffmpeg-mux: Calm deprecation warnings on *nix
Calm libobs-opengl deprecation warnings on macOS.

Calm FFmpeg deprecation warning with LIBAVFORMAT_VERSION_MAJOR < 59.
2023-01-19 13:08:46 -05:00
tytan652
d473c9416f obs-ffmpeg: Fix compilation warnings on Clang and GCC
- Fix format warnings
- Fix unused-parameter warnings
2023-01-19 13:08:46 -05:00
tytan652
b0c1c9c86c libobs,plugins: Remove individual -Wno-switch 2023-01-19 13:08:46 -05:00
tytan652
cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
Chris (Flaeri)
1166e504bb obs-ffmpeg: Remove forced x264 and aac for RTMP
Remove code forcing x264 and ffmpeg aac encoder. People using custom
ffmpeg output should be able to use other video and audio encoders when
streaming with RTMP, given its h264 or aac.
2023-01-13 09:42:41 -08:00
Translation Updater
783bd52197 Update translations from Crowdin 2023-01-08 04:10:37 +00:00
jp9000
122e864c38 obs-ffmpeg, obs-qsv11: Ensure adapter order in encoder tests
On systems with multiple graphics adapters, one card can be configured
as power saving, and another card can be configured as performance.
Sometimes, OBS and the encoder test subprocesses will not be configured
the same way, so it's necessary to provide adapter order to the encoder
test subprocesses.

This change ensures the adapter order by passing the LUIDs to the test
subprocesses. The adapter indexes will then be updated accordingly.
2022-12-19 12:17:30 -08:00
jp9000
2396c4a01c obs-ffmpeg: Remove EnumOutputs from encoder tests
This call will fail on multi-adapter systems, and isn't used anyway, so
just remove it. Not sure why it was called in the first place; pretty
sure it was unintended and was likely just copied over from the D3D11
subsystem code.
2022-12-19 12:03:01 -08:00
jpark37
b7b7f0ae88 obs-ffmpeg: Set chroma location for VA-API 2022-12-11 14:12:36 -08:00
Jim
c84fae52e8 obs-ffmpeg: Fix AMF default CQP value
Was 7 for some reason, was supposed to be 20
2022-12-10 19:03:15 -08:00
Roman Huts
4ba6b8b6ee obs-ffmpeg: Add new rate control method mappings for AVC/HEVC 2022-12-09 15:37:09 -08:00
Jim
ddba05c36c obs-ffmpeg: Use enum for av1 encoders
Allows us to add rav1e later
2022-12-05 19:19:20 -08:00
Roman Huts
ad407eccab obs-ffmpeg: Bump AMF version to v1.4.29 2022-12-03 15:39:38 -08:00
Roman Huts
72a2c3baaa obs-ffmpeg: Add new rate control methods for AMD AVC/HEVC 2022-12-03 15:39:38 -08:00
jpark37
e8792ac791 obs-ffmpeg: Improve chroma location decision
The chroma location doesn't just depend on pixel format, but we're just
trying to pick something reasonable for now.
2022-12-03 15:24:18 -08:00
pkv
ece4d1e90e obs-ffmpeg: Allow srt stream to disconnect after timeout
Fixes #7848
Currently OBS_OUTPUT_INVALID_STREAM is emitted when a wrong password is
used. This commit expands the signal emission to case of timeouts.

Signed-off-by: pkv <pkv@obsproject.com>
2022-12-03 15:02:03 -08:00
Chris
3d87b3b948 obs-ffmpeg: Disable VBAQ for H264 CQP rate control
Checks if rate control is CQP, if not, enable VBAQ. As per AMD, VBAQ
should not be used with CQP.
2022-11-30 17:42:59 -05:00
Chris
c4a8364b8c obs-ffmpeg: Disable VBAQ for HEVC CQP rate control
Check rate control, if cqp (0), dont use vbaq
2022-11-22 04:13:56 -08:00
Matt Gajownik
0716e8b482 obs-ffmpeg: Fix building without HEVC on Windows 2022-11-21 18:54:09 +11:00
tt2468
24d7bea41f obs-ffmpeg: Improve RIST/SRT log messages
Overall improvements to match behavior of other log sources.
2022-11-19 18:16:05 -08:00
Chris
a463326e37 ffmpeg: fix cqp rate control on svtav1
global_quality does not get respected. Specifying via priv_data does
work however
2022-11-19 20:55:42 -05:00
Chris
777a8f8c47 ffmpeg: fix "cqp" mode for libaom
change from global_quality to setting crf via priv_data, as
global_quality does not get respect. There is no cqp param in
ffmpeg 5.0.1
2022-11-19 20:55:42 -05:00
tytan652
74b245431c obs-ffmpeg: Use Libva in FFmpeg VA-API
Libva is directly used to check if DRI devices support H264 encoding.
2022-11-20 11:30:40 +11:00
Jim
572407a928 Merge pull request #7809 from obsproject/amf-av1-rebased
Add Hardware AMD AV1 Encoder
2022-11-19 15:52:16 -08:00
Ryan Foster
46e17a1160 obs-ffmpeg: Fix SVT-AV1 rate control mode selection
In updated versions of FFmpeg (5.1.x) and SVT-AV1 (1.2.0/1.3.0), the
rate contol mode selection mechanism has changed, causing CBR to throw
an "Invalid Parameter" error and the encoder will fail to start. This
appears to be caused by us specifying rc_max_rate, which will also fail
on FFmpeg CLI. Adjust how we manage rate control methods, appropriately
version-gated, to work with both our current dependency versions and the
versions that we'd like to use.
2022-11-19 15:44:12 -08:00
Roman Huts
341f288b57 obs-ffmpeg: Fix encoder preset quality fallbacks for AVC/HEVC/AV1
(Jim note: The missing description of this commit is that basically, the
CAP_MAX_THROUGHPUT value returns a different result based upon what the
other settings are currently set to. It didn't operate the way it was
originally programmed.)
2022-11-18 18:18:08 -08:00
Roman Huts
49e5f7783f obs-ffmpeg: Suggest docs to reference for AMF/FFmpeg options 2022-11-18 18:18:08 -08:00
Roman Huts
927733240c obs-ffmpeg: Add AMF AV1 encoder 2022-11-18 18:18:08 -08:00
Roman Huts
a8fc9226f8 obs-ffmpeg: Use codec enum for AMF texture encode check 2022-11-18 18:18:08 -08:00
Roman Huts
8b386a6417 obs-ffmpeg: Make AMF AVC encoder name consistent w/ others 2022-11-18 18:18:08 -08:00
Roman Huts
ef1a9c46e3 obs-ffmpeg: Only show b-frames AMF property for AVC 2022-11-18 18:18:08 -08:00
Roman Huts
1948ddf2fa obs-ffmpeg: Only allow AMF high/baseline profiles for AVC 2022-11-18 18:18:08 -08:00
Roman Huts
535ced04d5 obs-ffmpeg: Allow 0-51 for CQP property
0-51 makes it consistent with other encoder implementations (At least
for AVC/HEVC)
2022-11-18 18:18:08 -08:00
Roman Huts
21d079fdcc obs-ffmpeg: Use codec enum for amf_properties_internal 2022-11-18 18:18:08 -08:00
Roman Huts
acfad45ead obs-ffmpeg: Fix transcoding API typo 2022-11-18 18:18:08 -08:00