Commit Graph
489 Commits
Author SHA1 Message Date
Norihiro KamaeandJim 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
PatTheMav 49e9d49943 plugins: Update CMakeLists.txt for included plugins 2022-03-16 23:11:08 +01:00
Florian ZwochandJim 8886091793 obs-ffmpeg: add NVENC blacklist check for Linux
Similar to the Windows counter part. Check the PCI bus for
installed cards. When found at least one VGA compatible adapter
from NVIDIA that is not in the blacklist we pass the check.
2022-03-08 12:16:07 -08:00
Ryan FosterandJim ebc514e8db obs-ffmpeg: Update nv-codec-header files
Update the in-tree nv-codec-header files (nvEncodeAPI.h and
dynlink_cuda.h) to n11.1.5.1, which is the version currently used in the
OBS Studio dependencies, to keep the in-tree version in sync with the
version in our dependencies.
2022-02-26 15:08:03 -08:00
pkvandJim 5b0c09a9f4 obs-ffmpeg: Force mpegts format & disable restart on activate for srt & rist
This fixes crashes in media Source when :
- the user forgets to set the input format for srt or rist URLs;
- disabling / enabling / disabling etc Media source with a rist URL.

Signed-off-by: pkv <pkv@obsproject.com>
2022-02-19 15:17:19 -08:00
jp9000 109b54fd66 obs-ffmpeg: Fix svt-av1 rate control settings
For SVT-AV1, rate control is explicitly set via an "rc" option, so set
those options manually for SVT-AV1. CBR doesn't seem to be fully
supported, but it's sort of supported via CVBR (constrained variable
bitrate), which seems to be specific to each GOP size, which is about as
close to CBR as we can get.
2022-02-07 13:11:34 -08:00
Translation UpdaterandTranslation Updater ac8dbf67be Update translations from Crowdin 2022-02-06 02:24:08 +00:00
derrodandRodney 8367c8adfa obs-ffmpeg: Add MX450 to blacklist 2022-01-25 16:46:55 +01:00
jp9000 0dd5d93d42 obs-ffmpeg: Add new SVT presets
Don't worry, these preset names are just placeholders for now
2022-01-23 14:57:27 -08:00
VainockandJim 4e8fbb8f77 obs-ffmpeg: Fix spelling mistake for 'Encoder.Timeout' 2022-01-12 07:33:04 -08:00
gxalphaandMatt Gajownik 723d5a2163 obs-ffmpeg: Add missing "FFmpegOpts" locale 2022-01-12 21:48:38 +11:00
pkvandMatt Gajownik d78971b4db obs-ffmpeg: Further FFmpeg deprecations fixes for FFmpeg 4.4+
avcodec.h stopped including channel_layout.h per FFmpeg commit
1be3d8a0cb77 [1]. Fixes compilation error on macOS against
FFmpeg later than the mentioned commit.
[1] https://github.com/FFmpeg/FFmpeg/commit/1be3d8a0cb77f8d34c1f39b47bf5328fe10c82d7
2022-01-08 18:18:27 +11:00
jp9000 dfaccd1e3a obs-ffmpeg: Fix av1 encoding with fractional framerates
Just use util_mul_div64 instead of using av_rescale_q_rnd
2022-01-04 22:48:10 -08:00
Norihiro KamaeandJim 685f8297e4 obs-ffmpeg: Set frame_size for audio codec parameter
This commit fixes an issue that the last audio packet is sometimes not
written into mp4 format. Since libavformat internally calculates the
packet duration from the frame_size specified in the codec parameter, it
is necessary to set frame_size.
2021-12-23 10:48:37 -08:00
JimandGitHub 91a9688d9f Merge pull request #5501 from RytoEX/fix-ffmpeg-deprecations
Fix FFmpeg deprecations up to FFmpeg 4.4 and current FFmpeg git
2021-12-17 01:16:35 -08:00
Translation UpdaterandTranslation Updater 062de2c998 Update translations from Crowdin 2021-12-17 08:01:29 +00:00
Translation UpdaterandTranslation Updater 261345f9ef Update translations from Crowdin 2021-12-12 02:38:59 +00:00
Carlo CastoldiandMatt Gajownik 4623a6b4bc obs-ffmpeg: Set DRI devices and their name persistently
retrieving the DRI devices from /dev/dri/by-path/ instead of
/dev/dri/renderDXXX. This enable us to use lspci to get the device
name as well.
2021-12-12 11:12:36 +11:00
Norihiro KamaeandJim f8bcc190e2 obs-ffmpeg: Fix memory leaks if replay buffer failed
When releasing a darray mux_packets at error, contents of mux_packets
are not released. It causes memory leaks if error occurs during saving
the replay buffer to a file.
2021-11-30 21:53:34 -08:00
pkvandRyan Foster f32c2b0fbb obs-ffmpeg: Properly name FFmpeg lib used
Cosmetic but this was nagging me since I had authored those lines.
2021-11-23 12:10:56 -05:00
pkvandRyan Foster c398ac9739 obs-ffmpeg: Fix NVENC old codec naming removed in FFmpeg
Per FFmpeg commit 337f777f378c [1], FFmpeg removed nvenc_h264_encoder
and nvenc_hevc_encoder after deprecation in FFmpeg commit 888a5c794778
[2]. The names to be used are ff_h264_nvenc_encoder and
ff_hevc_nvenc_encoder. So we must allow alternative search of codec as
h264_nvenc or nvenc_h264 in obs-ffmpeg.c.

[1]: https://github.com/FFmpeg/FFmpeg/commit/337f777f378cfcc0d6f0d01fb7125905e8b0da55
[2]: https://github.com/FFmpeg/FFmpeg/commit/888a5c794778a2f2aad22e9b4a3952dff92b11fa
2021-11-23 12:10:56 -05:00
Ryan Foster ce734366bc obs-ffmpeg: Respect AVFormatContext and AVOutputFormat constness
AVFormatContext::oformat was made const on April 27, 2021 [1]. If we
respect the constness of AVOutputFormat and do not cast results from
FFmpeg functions to non-const, we cannot modify the results after the
fact. Our choices are either to cast them to non-const (and presumably
have them implicitly casted back to const on later function calls), or
only try to modify the results in versions of FFmpeg where these are not
expected to be const.

Instead of relying on casts, we can set the encoder values in the
ffmpeg_cfg struct, which are later passed to new_stream.

Also modifies deps/media-playback. Removes compiler warnings.
Some avformat functions return const AV(In/Out)putFormat per [1], so
ifdef as needed.

[1]: https://github.com/FFmpeg/FFmpeg/commit/56450a0ee4fdda160f4039fc2ae33edfd27765c9
     lavf 59.0.100 avformat.h
     avformat: Constify the API wrt AV(In|Out)putFormat

     Also constify AVProbeData.
2021-11-23 12:10:25 -05:00
Ryan Foster abf1d609d2 obs-ffmpeg: Include channel_layout.h
avcodec.h stopped including channel_layout.h per FFmpeg commit
1be3d8a0cb77 [1]. avformat.h stopped including avcodec.h per FFmpeg
commit e67e02d15672 [2]. As a result, we need to explicitly include
avutil/channel_layout.h when needed. Fixes compilation error against
FFmpeg later than the two mentioned commits.

[1]: https://github.com/FFmpeg/FFmpeg/commit/1be3d8a0cb77f8d34c1f39b47bf5328fe10c82d7
[2]: https://github.com/FFmpeg/FFmpeg/commit/e67e02d15672a87da1b0566e197a1e19dc7e1e33
2021-11-21 11:30:02 -05: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]: https://github.com/FFmpeg/FFmpeg/commit/e67e02d15672a87da1b0566e197a1e19dc7e1e33
     lavf/avformat.h: drop the avcodec.h include
2021-11-21 11:30:02 -05:00
Norihiro KamaeandJim 2a0b9d851c obs-ffmpeg: Fix starting video packet offset in replay-buffer
The commit 4a5ac3974 fixed the bug the first PTS is not zero. This
commit fixed the same issue in replay-buffer.
A variable `video_dts_offset` is renamed to `video_pts_offset` and the
variable is initialized by `pts` instead of `dts`.
2021-11-04 14:49:17 -07:00
Clayton GroeneveldandJim af6c719139 UI, libobs, obs-plugins: Fix compiler warnings
Found warnings when compiling OBS.
2021-11-04 06:25:52 -07:00
pkvandJim 258365da71 obs-ffmpeg-mux: Add support for rist protocol
This adds RIST to the list of protocols supported by the obs
ffmpeg_mpegts_muxer.
RIST is container and codec agnostic. But this implementation relies
on ffmpeg avformat integration and uses mpeg-ts container.
2021-10-30 15:06:58 -07:00
jp9000 442886c0aa obs-ffmpeg: Add AOM AV1 and SVT-AV1 encoders
Adds the ability to encode with software AV1 encoders within FFmpeg,
specifically AOM AV1 and SVT-AV1.
2021-10-25 12:24:16 -07:00
jp9000 e8d366f789 obs-ffmpeg/ffmpeg-mux: Allow codecs of any type
Allows the ability to mux with a codec which may not actually have an
encoder implementation within the current build of FFmpeg
2021-10-25 12:24:16 -07:00
Norihiro KamaeandJim 499af309b5 obs-ffmpeg: Fix unwritten audio-only output
When video is disabled, no audio was sent to the container so that the
audio was not saved. Prior to this change, all audio was discarded until
the first video packet arrives. This change limits to discard audio only
if video is available.
2021-10-24 00:02:32 -07:00
VainockandJim 11a690b038 Update translations from Crowdin 2021-09-24 09:42:08 -07:00
Richard StanwayandJim 1444ead812 Revert "obs-ffmpeg, obs-qsv11: Disable dynamic bitrate support"
This reverts commit 1b29bfc884.
2021-08-23 18:26:37 -07:00
Richard StanwayandJim 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
Matt GajownikandJim a5878e1caa obs-ffmpeg: Translate VAAPI property names 2021-07-31 15:09:29 -07:00
jpark37andJim 880eac5b24 obs-ffmpeg: Fix comparison type mismatch 2021-07-06 14:08:28 -07:00
ExeldroandJim 62d0661f98 obs-ffmpeg: Don't purge packets when there are none 2021-06-29 08:40:13 -07:00
TranslationandJim ef2b1eb1c6 Update translations from Crowdin 2021-06-11 07:18:15 -07:00
jpark37andJim ba3eb46bf9 obs-ffmpeg: Add missing return statement 2021-06-07 22:14:38 -07:00
jpark37andJim 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
jpark37andJim 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
jpark37andJim 15e37f96d1 obs-ffmpeg: Add linear alpha setting
Allow proper linear treatment of alpha for authoring sanity.
2021-06-04 19:04:08 -07:00
Gol-D-Ace 90df8d44df Update translations from Crowdin 2021-05-30 20:33:35 +02:00
Kurt KartaltepeandJim 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
floeleandJim 44c38e71cc obs-ffmpeg/ffmpeg-mux: Fix hang without global_stream_key
If DEBUG_FFMPEG_MUX is enabled, when starting a recording without
configuring global_stream_key, obs-ffmpeg-mux will hang. Apply same
check to global_stream_key as in init_params() to prevent this.
2021-03-30 04:55:33 -07:00
Eric LindvallandJim 3c76fc4ddb obs-ffmpeg: Enable macOS hardware decoding for media source
Reverts  c7395b05ec
2021-03-30 03:45:06 -07:00
jpark37andJim 10c43f19c0 obs-ffmpeg: Missing NVENC bounds check 2021-03-20 12:35:49 -07:00
jpark37andJim 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 f35e37a963 obs-ffmpeg: Use NVENC preset lookahead length
If the preset specifies the lookahead length, use it. Force to previous
setting of 8 otherwise.
2021-03-16 20:03:45 -07:00
jpark37 6826285921 obs-ffmpeg: Align NVENC config values
Hard-code various config values as they appear in FFmpeg.
2021-03-16 20:03:29 -07:00