0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00
Commit Graph

90 Commits

Author SHA1 Message Date
derrod
af555b9372 obs-ffmpeg: Remove native/disable FFmpeg NVENC 2024-08-08 22:52:40 +02:00
derrod
2f55f046fe obs-ffmpeg: Add native non-texture NVENC implementation 2024-03-31 02:05:40 -07:00
Ruwen Hahn
8fb32c37ee obs-ffmpeg: Add disable_scenecut option for NVENC
This is functionally the same as x264's `scenecut=0` option
2024-01-13 17:49:34 -06:00
Rodney
3594017fac obs-ffmpeg: Remove Ubuntu 20.04 NVENC fallback
Effectively reverts dd26fe4f8a
2024-01-06 17:20:26 -06:00
derrod
578dc46a79 obs-ffmpeg: Remove legacy FFmpeg compatibility 2023-07-12 15:57:43 -04:00
Lain
106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
Ryan Foster
19cec08494 obs-ffmpeg: Set error message for NVENC with P216/P416
If P216 or P416 color formats are selected with NVENC, OBS will fall
back from the native implementation to the FFmpeg implementation. Here,
P216 and P416 were not explicitly handled, so the switch statements
would end up in the default case. If the user had also selected a Rec.
2100 color space, this would result in the strange error message:
"OBS does not support 8-bit output of Rec. 2100."

This message is confusing and does not correctly reflect the chosen
settings. Let's explicitly handle the P216/P416 cases and provide a more
accurate error message.
2023-05-01 18:45:32 -04:00
tt2468
d2902c1316 obs-ffmpeg: Compensate for invalid NVENC DTS when using b-frames
When using FFmpeg-based NVENC, with b-frames, and a non-1 framerate
numerator (eg. `1001/60000` aka 59.94fps), the DTS values outputted
by FFmpeg result in invalid DTS values.

Detect when using an unpatched FFmpeg build and correct the values
accordingly.
2023-04-03 16:42:31 -04:00
Matt Gajownik
b620dd4c50 obs-ffmpeg: Don't use standard newlines in HTML error messages
Qt by default will render strings that contain new line characters as
plain text, bypassing the HTML renderer.
2023-04-02 04:09:54 +02:00
PatTheMav
6e0d802874 obs-ffmpeg: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08: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
Jim
8806738a04 obs-ffmpeg: Change default nvenc preset to P5
P6 seems to invoke lookahead, which causes lag for some older GPUs and
interferes with game performance. So let's just use P5 by default for
now. Shouldn't really affect recording anyway.
2022-11-18 12:38:54 -08:00
Jim
dd26fe4f8a obs-ffmpeg: Fix FFmpeg NVENC presets on Ubuntu 20.04
Ubuntu 20.04 and 22.04 both have the same FFmpeg versions, but FFmpeg on
20.04 was built with version 9 of NVENC headers, whereas 22.04 was built
with 11.

Unfortunately, that means we have to revert back to the old presets when
Ubuntu 20.04 is detected. The way this detection is done is a bit hacky,
but it's the only way to preserve startup performance. Otherwise we'd
have to write yet another startup subprocess test program to detect
whether the FFmpeg being used was built with older or newer NVENC, which
is both slow to start up and annoying to write. So instead, just get the
distro name/version strings and detect Ubuntu 20.04 that way.
2022-10-27 14:35:51 -07:00
jp9000
53f4627b0c obs-ffmpeg: Add NVENC AV1 support 2022-10-07 14:34:39 -07:00
jp9000
b9f562729a obs-ffmpeg: Refactor NVENC defaults/properties
Removes unnecessarily duplicated code
2022-09-22 02:42:32 -07:00
jp9000
d7c7180a8c obs-ffmpeg: Update NVENC to new presets
(This commit also modifies the UI)
2022-09-22 02:42:32 -07:00
jp9000
21da0b0462 obs-ffmpeg: NVENC "(new)" begone
It's about time to get rid of this being labeled as "(new)".

Also rename the FFmpeg variant. And make it more explicit when the
FFmpeg encoder is being used in the log file.
2022-08-30 17:05:36 -07:00
Richard Stanway
894bc4078b obs-ffmpeg: Log codec when creating NVENC encoders
With HEVC and H264 settings being near-identical, it was impossible to
figure out which codec was being used by context alone. This applies to
both ffmpeg output and jim-nvenc.

Fixes #6976.
2022-08-29 21:43:04 -07:00
jpark37
7e6a2ccdec obs-ffmpeg: Prevent invalid NVENC combinations
Don't want to silently generate lossy video.
2022-08-16 21:14:36 -07:00
derrod
9c20ad9046 obs-ffmpeg: Set NVENC CQP maximum to 51
51 is the actual maximum and especially with HEVC values higher than 30
are actually pretty usable.
2022-08-08 09:24:08 +02:00
Vainock
eb06594381 Use property suffixes for units everywhere 2022-07-22 08:24:51 -04:00
tytan652
fcc94634d9 obs-ffmpeg: Remove unused parameter 2022-07-20 08:22:04 +02:00
PatTheMav
62c6a6d223 obs_ffmpeg: Explicitly mark variables as unused 2022-07-10 09:59:55 +10:00
jpark37
e74dc0dfe3 obs-ffmpeg: Default NVENC HEVC Max B-frames to 0
All NVENC cards support H.264 B-frames, but Turing is the first
generation to support HEVC B-frames.
2022-05-07 01:33:05 -07:00
jpark37
79059153e8 obs-ffmpeg: Fix old NVENC ignoring Max B-frames 2022-05-07 01:33:05 -07:00
tytan652
ce62240530 obs-ffmpeg: Fix compiler warnings
* obs-ffmpeg: Fix format-overflow warning

* obs-ffmpeg: Fix unused-parameter warnings
2022-05-04 01:37:10 -07:00
jpark37
9677ad1876 obs-ffmpeg: Add I010/P010 as formats for old NVENC
Avoids fallback to NV12, crushing 10-bit into 8-bit.
2022-04-29 12:34:56 -07:00
jpark37
01a806cb53 obs-ffmpeg: Add HEVC support to NVENC 2022-04-28 08:59:53 -07:00
jp9000
c5e328e359 obs-ffmpeg: Refactor FFmpeg video encoders
This reduces code duplication between the different FFmpeg-based video
encoder implementations
2022-04-22 12:51:38 -07:00
jpark37
59dbc3eb81 libobs: Rename Rec. 2020 to Rec. 2100
Rec. 2020 is really an SDR spec, but I think HDR10 made it okay to slap
PQ on it, call it an HDR spec. Rec. 2100 came along after and formally
allowed the use of PQ/HLG, so we should use 2100 instead.
2022-04-10 00:13:52 -07:00
wangshaohui
db8145e8a2 obs-ffmpeg, win-dshow, deps/media-playback: Use recommended API for AVCodecContext 2022-04-07 01:59:30 -07:00
jpark37
4c2aa58dbe obs-ffmpeg: Support Rec. 2020, I010/P010 formats
Also remove unused function, ffmpeg_to_obs_video_format.
2022-04-03 00:03:34 -07:00
Norihiro Kamae
ba68eda590 obs-ffmpeg: Use av_packet_alloc instead of av_init_packet
sizeof(AVPacket) being a part of the public ABI is deprecated. once
av_init_packet() is removed, new packets will only be able to be
allocated with av_packet_alloc().
In ffmpeg-mux, ffmpeg-vaapi, and obs-ffmpeg-nvenc, AVPacket is allocated
at the initialization to avoid frequent allocation of AVPacket.

Includes changes to win-dshow.
2022-03-24 17:19:40 -07:00
Ryan Foster
08547a1696 obs-ffmpeg: Include avcodec header for AVCodecContext
FFmpeg commit e67e02d15672 [1] drops avcodec.h from avformat.h includes.
Therefore we need to include it explicitly.

[1]: e67e02d156
     lavf/avformat.h: drop the avcodec.h include
2021-11-21 11:30:02 -05:00
Clayton Groeneveld
af6c719139 UI, libobs, obs-plugins: Fix compiler warnings
Found warnings when compiling OBS.
2021-11-04 06:25:52 -07:00
Richard Stanway
1444ead812 Revert "obs-ffmpeg, obs-qsv11: Disable dynamic bitrate support"
This reverts commit 1b29bfc884.
2021-08-23 18:26:37 -07:00
Richard Stanway
1b29bfc884 obs-ffmpeg, obs-qsv11: Disable dynamic bitrate support
Unfortunately these encoders tend to crash or freeze after after
multiple bitrate changes. Users with dynamic bitrate enabled
experience a random encoder freeze which manifests as OBS dropping to
0kb/sec and disconnecting and it's not at all obvious that dynamic
bitrate is the cause. Disable it for now until we can figure out if
there is any workaround or bug on our end.
2021-08-20 14:51:16 -07:00
jpark37
ba3eb46bf9 obs-ffmpeg: Add missing return statement 2021-06-07 22:14:38 -07:00
jpark37
a8414a09cc obs-ffmpeg: NVENC usage fixes
Only use lossless encode if the capability is supported.

Set qpPrimeYZeroTransformBypassFlag to 1 for lossless.

Do not set profileGUID for lossless.

For both NVENC implementations, retry with a heavier reset because both
are unable to recover from failure lightly.
2021-06-07 21:43:58 -07:00
jpark37
07084de805 obs-ffmpeg: Support lack of Psycho Visual Tuning
For new NVENC, warn if PVT is requested, but unsupported by the GPU.
Also retry without PVT on failure to try to catch bad cominbations.

For old NVENC, if PVT is enabled when FFmpeg failure occurs, retry
without PVT.
2021-06-06 11:05:04 -07:00
Kurt Kartaltepe
1064cd26f1 obs-ffmpeg: Expose psycho-aq setting
This was changed to default on but is not exposed for ffmpeg nvenc.
Where cards without temporal AQ support will fail to initialize and we
cannot do checks beforehand. This exposes the parameter to allow users
to disable this feature when using the ffmpeg implementation.
2021-04-10 14:49:40 -07:00
jpark37
4404422082 obs-ffmpeg: Replace cast with numeric literal 2021-03-20 12:35:49 -07:00
jpark37
7b983f00e3 obs-ffmpeg: Static analysis warnings
Fix various warnings about variable size.
2021-03-16 20:03:45 -07:00
jpark37
eca916527d obs-ffmpeg: PVT for NVENC fallback
Plumb Psycho Visual Tuning setting into fallback encoder.
2021-03-16 19:05:36 -07:00
Jim
b32abbe33f
Merge pull request #3083 from pkviet/srtfix4
UI: Enable sps/pps (video headers) repetition (for srt/mpegts)
2020-10-30 23:25:24 -07:00
jpark37
b6afaceeae Update VIDEO_CS_DEFAULT to mean 709 instead of 601
Consistent with modified default UI setting.
2020-09-06 20:51:28 -07:00
pkv
73ac96ac7c obs-ffmpeg: Allow video headers repetition in IDR and bitstream for jim-nvenc
This commit adds a repeat_headers setting which will allow sps/pps
repetition and AUDs(access unit delimiters) .
Repetition is ensured by h264config->repeatSPSPPS &
h264config->disableSPSPPS;
the two parameters are set by nvenc to true on default.
When video headers repetition is required, we set the second in
jim-nvenc to false so that SPS/PPS are written into bitstream.
The first parameter could be omitted but is exposed since repetition of
video headers might not be required.
When headers repetition is enabled, we also enable AUD to facilitate
decoding.
Typically the video headers repetition will be useful for mpegts and
DVB broadcast decoders.
2020-08-23 11:10:10 +02:00
jpark37
37f01b35f6 obs-ffmpeg: Improve color space handling
Add support for VIDEO_CS_SRGB.

Use SMPTE 170M for 601 instead of undef/BT470BG. This is the
American/Chromium way of handling 601.

Add color metadata to the container file as well via ffmpeg-mux.
2020-07-18 19:44:13 -07:00
Richard Stanway
6fac77b69f obs-ffmpeg: Add error message for non-zero GPU 2020-04-27 01:22:34 +02:00
Richard Stanway
35e218e05b obs-ffmpeg: Add localization for NVENC error messages 2020-04-27 01:22:05 +02:00