Commit graph

739 commits

Author SHA1 Message Date
Huts, Roman 275bb344d8 obs-ffmpeg: Fix AMF encoder reconfiguration
Must Flush() or Drain() before ReInit()
2023-06-03 14:37:57 -07:00
PatTheMav 2966c4030e libobs: Use static library for version string information
Switching to a static library that contains version information as
const char strings has multiple benefits:

* The version information provided externally via compiler definitions
  will fail compilation early if malformed
* An updated version string (which will happen with every commit) will
  not invalidate existing compilation units, because only the static
  library is affected by the change
* An update of the version change just requires a recompilation of the
  static library and a linker update
* An update of the version will _not_ infect the rest of the codebase
  (as it does currently, because everything includes obsconfig.h one
  way or another)
* Other modules which used the macro definition directly have been
  updated as much as possible to use the proper getter method from
  `libobs` instead (some Windows-specific modules use preprocessor
  string composition, the value has been added as a compiler definition
  directly in those cases)
* Because the impact of a version change due to a commit hash change
  is limited to the static library, ccache hit rates should be
  improved considerably
2023-05-27 16:48:24 -07:00
CodeYan01 1d45881fcb obs-ffmpeg: Add option to disable settings logging
Allows plugins to disable the logging of settings every time the ffmpeg
source is updated, by passing "log_changes" as true in the settings.
2023-05-20 17:52:56 -07:00
David Rosca 17cb966c62 obs-ffmpeg: Add FFmpeg Options for VA-API 2023-05-20 16:56:39 -07:00
tt2468 d314d4725d libobs, plugins: Deprecate obs_output_t functions with flag parameters
This deprecates the following functions, replacing them with new
versions:
- `obs_output_can_begin_data_capture()` - now `*capture2()`
- `obs_output_initialize_encoders()` - now `*encoders2()`
- `obs_output_begin_data_capture()` - now `*capture2()`

The flags parameter was initially designed to support audio-only or
video-only operation of an output which had the `OBS_OUTPUT_AV` flag,
however, full support for that was never implemented, and there are
likely fundamental issues with an implementation, mainly that most
outputs are programmed assuming that there will always be at least one
audio and one video track. This requires new flags specifying support
for optional audio/video, among other things.

An implementation to allow audio/video to be optional is best done
using the flag technique above, with audio/video enablement specified
by whether media (raw, `video_t/audio_t`) or encoder (`obs_encoder_t`)
objects are specified.

Since every implementation I could find always specifies `flags` as 0,
I was able to safely conclude that immediately removing the parameter's
functionality is safe to do.
2023-05-20 16:41:55 -07:00
Norihiro Kamae d9c34eff8b obs-ffmpeg: Add missing translations
The name of the obs_output_t won't appear in usual operation but some
output types have the translation and others do not. Let's translate
them.
Also translate `FilePath` property name.
2023-05-20 16:35:05 -07:00
Norihiro Kamae abb92878f1 obs-ffmpeg: Add missing translations 2023-05-20 16:35:05 -07:00
Norihiro Kamae 4aaffe16ec obs-ffmpeg: Remove obsolete translations
A commit 4e140d2ff added AMF error messages but they were never used.
A commit 45d029b1f removed some code but a translation key "Advanced"
was left.
A commit 77fbfbe5c removed code to translate NVENC.TooManyBFrames but
the translation key was left.
A commit 6cc7cf3d5 removed the code to select codecs but the translation
was left.
2023-05-20 16:35:05 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
tytan652 6e887f8158 obs-ffmpeg,cmake: Replace external folder by obs-deps headers 2023-05-13 17:06:39 -07:00
Florian Zwoch 8b816eba8e obs-ffmpeg: Fix compilation when ENABLE_HEVC is not set
When ENABLE_HEVC is not set the 'bool hevc' function parameter
is not being used in this function causing a warning and aborting
compilation.
2023-05-13 16:12:25 -07:00
Richard Stanway ba0c273846 obs-ffmpeg: Show error if trying to use AV1 fallback 2023-05-05 15:58:13 -04:00
Translation Updater a0fbdc3c34 Update translations from Crowdin 2023-05-01 23:11:13 +00:00
Ryan Foster 877c1c74d0 obs-ffmpeg: Set error message for AMF with P216/P416
If P216 or P416 color formats are selected with AMF, these color formats
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
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
derrod cf6adf84ab obs-ffmpeg: Fix iteration over sample formats 2023-04-05 21:53:23 +02:00
derrod ba38a7d9f4 obs-ffmpeg: Disable AMF texture encoder runtime reconfiguration 2023-04-05 10:18:20 -07:00
tt2468 bfbc189853 obs-ffmpeg: Use event for source reconnect thread
Fixes an issue where update/destroy of a media source during reconnect
would block the parent thread until the next reconnect attempt. This
would result in significant quantities of dropped frames, delayed OBS
shutdown, or frozen UI during this period.
2023-04-04 15:11:59 -04:00
PatTheMav 6e07b86729 cmake: Remove EXCLUDE_FROM_ALL directive from interface libraries 2023-04-04 17:27:54 +00:00
Ryan Foster a973b97036 obs-ffmpeg: Set framerate for AVCodecContext outputs
In avcodec.h, the docs for AVCodecContext->framerate say:
encoding: May be used to signal the framerate of CFR content to an
          encoder.

OBS is designed to always output Constant Frame Rate (CFR) content.
Instead of letting this be implied, let's explicitly set the framerate
per the docs.
2023-04-03 23:28:31 +00:00
derrod c2e66942d0 obs-ffmpeg: Allow specifying audio sample format 2023-04-03 23:37:22 +02: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
Richard Stanway 0f614034ca obs-ffmpeg: Handle mux errors when writing replay buffer
Without this, we could continuously call signal_failure in write_packet,
crashing OBS with a stack overflow with all the error callbacks.
2023-04-01 16:21:37 -07:00
Richard Stanway d71fa5248f obs-ffmpeg: Fix memory corruption during cleanup
We were calling avio_close on a field that might have held an
AVIOContext. This commit checks which type was allocated so we
can call the appropriate cleanup function.
2023-03-31 13:19:48 -04:00
derrod d98abf8ce9 obs-ffmpeg: Enable padding for NVENC CBR modes 2023-03-29 16:53:33 -04:00
Translation Updater 7c5560bf1b Update translations from Crowdin 2023-03-27 13:39:03 +00:00
PatTheMav 349372b3b3 cmake: Add changes for CMake build framework 3.0
New code path only taken if OBS_CMAKE_VERSION is set to 3.0.0 or
greater, old functionality remains unchanged.
2023-03-26 18:20:38 -04:00
Richard Stanway 0ed53ada03 obs-ffmpeg: Use more actionable error messages for hardware encoders
Telling a user to "Check your driver is up to date" is too open to
interpretation, many users will use Windows Update or Device Manager to
check for updates which doesn't help. Instead, let's explicitly tell
them what is most likely to fix the problem.
2023-03-25 22:48:19 -04:00
derrod 1a51aad582 obs-ffmpeg: Add unclamped 32-bit floating point PCM encoder 2023-03-25 10:38:18 +01:00
derrod cf837fa38a obs-ffmpeg: Add FLAC encoder 2023-03-25 10:22:45 +01:00
derrod 3ae98511d0 obs-ffmpeg: Add PCM and ALAC encoders 2023-03-25 10:22:45 +01:00
derrod 33e4ffd3fe ffmpeg-mux: Properly support lossless codecs
- Do not set sample rate (not required here, but can be 24/32 now)
- Only set bit_rate for lossless codecs
- Only set frame_size for codecs using a fixed one
2023-03-25 10:22:45 +01:00
Yuriy Chumak 1a05097304 obs-ffmpeg: Add HDR and HEVC to VA-API encoder 2023-03-24 15:16:10 -07:00
derrod f96ae65d1b obs-ffmpeg: Pass correct audio codec to muxer subprocess 2023-03-20 17:01:47 +01:00
derrod 198debe945 ffmpeg-mux: Set experimental compliance for FFmpeg < 6.0
With 5fe417bce1 it became possible to use
Opus in local recordings, this could potentially have the user try to
record Opus in MP4.

FLAC in MP4 was marked as stable in FFmpeg 6.0
Opus in MP4 was marked as stable in FFmpeg 4.3

For Ubuntu 20.04 we still need the latter, for 22.04 (and potentially
other Linux distributions) the former.

While FLAC is not yet implemented, we may want to do that in the near
future so for simplicity just keep it at 6.0.
2023-03-20 17:01:47 +01:00
tytan652 5e4ed49a2d obs-outputs,obs-ffmpeg: Use connect infos in outputs 2023-03-19 17:38:02 +01:00
tytan652 b2d686e8f4 obs-ffmpeg: Allow opus for SRT and RIST 2023-03-19 17:27:43 +01:00
tytan652 cd83b94c7c plugins: Rename audio encoders 2023-03-19 17:27:43 +01:00
tytan652 1514f1597a plugins: Fix codec name on AAC encoders 2023-03-19 17:27:42 +01:00
tytan652 e317c88f55 obs-ffmpeg: Remove AV1 from SRT/RIST supported codecs
MPEG-TS standard is not ready for AV1
2023-03-19 17:08:06 +01:00
tytan652 855956f60e obs-outputs,obs-ffmpeg: Add protocol to service outputs 2023-03-19 15:29:03 +01:00
Jim 6eace37e06
Merge pull request #8229 from derrod/hashed-tables
Hashtable Adventures
2023-03-19 00:34:44 -07:00
Norihiro Kamae 8938aeebfa obs-ffmpeg: Remove an empty clause
The empty clause was originally introduced to set a cutoff settings as a
hack at a commit ae862c16a and later removed at a commit a89470d2e. At
this time, the clause became empty but another commit aa58b9cf5 reuse
the clause and finally a commit 9baedb1c6 removes so that the clause is
empty now.
2023-03-18 15:16:44 -07:00
Richard Stanway 7e9b071a6c
obs-ffmpeg: Add GeForce MX450 variant to unsupported NVENC list 2023-03-18 13:31:42 +01:00
derrod 13040ad241 obs-ffmpeg: Fix translation key capitalisation 2023-03-18 10:47:50 +01:00
Norihiro Kamae baddacc111 Revert "obs-ffmpeg: Use FFmpeg's "fast" AAC encoder by default"
This reverts commit aa58b9cf5f.

FFmpeg has reverted their default AAC encoder from fast to twoloop,
which has much better rate control management, making it closer to CBR,
and it sounds much better.
2023-03-12 10:21:27 -07:00
tytan652 f4e90a5bd7 obs-ffmpeg,cmake: Add a finder for AMF headers 2023-03-07 14:55:03 -05:00
tytan652 6db418fb3f obs-ffmpeg: Replace external/AMF folder by obs-deps headers 2023-03-07 14:55:03 -05:00
Kurt Kartaltepe 0fb89dc9a1 obs-ffmpeg: Fix crash during ratecontrol check
When iterating over an array of structs we incorrectly check for a null
pointer, but the actual sentinel value is the empty struct.
2023-03-04 16:07:12 -08:00