Skip to content

Consolidate Video Encoder Processing#1634

Open
mhoyer-streamlabs wants to merge 9 commits intostagingfrom
mh-consolidate-encoders
Open

Consolidate Video Encoder Processing#1634
mhoyer-streamlabs wants to merge 9 commits intostagingfrom
mh-consolidate-encoders

Conversation

@mhoyer-streamlabs
Copy link
Contributor

@mhoyer-streamlabs mhoyer-streamlabs commented Feb 25, 2026

Description

Consolidate video encoder processing into one place. Previously, encoder IDs, etc were hard coded multiple places leaving significant room for error. I created osn-encoders.hpp/cpp and included this anywhere these values are needed. encoders_set, containing encoder IDs and conversions, was renamed videoEncoderOptions and moved into this file. It was also updated to include additional fields - backup to cover a case where a backup encoder is needed, preset to keep Preset names in a single place, and family which is used in updating settings. Again, these values were previously hard coded multiple places. Additionally, quite a few encoders previously defaulted to obs_x264 in incomplete if/switch statements, those cases are now handled correctly. Other updates:

  • Some encoders were not previously included in encoders_set so those were added with the appropriate values
  • Added helper functions to retrieve values from videoEncoderOptions rather than hard coding values in if or switch statements
  • Separate logic of finding available encoders from creating a list so that we can use the same functionality to validate a single encoder vs returning an entire list
  • New API - validate recording encoders on creation (since it is based on a flag that doesn't change), validate streaming encoders on start (because it is based on a service and we are certain to have all necessary info on start but not creation)
  • Old and new API - if simple mode, convert the simple encoder name to the internal encoder name on creation so the FE doesn't have to know about encoder conversions
  • Renamed a couple things for clarity

I also made some FE changes to utilize this new flow (PR coming soon). Previously, the FE would convert encoders in a couple different ways before sending them back to the BE, and this caused errors in several cases because hard coded values didn't match. Remove these conversions and allow the BE to handle all of it.

Motivation and Context

Minimize the chance of bugs stemming from encoder information being hard coded in multiple places.

How Has This Been Tested?

Tested locally with all available encoders, both recording and streaming.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Move encoder processing to its own file so ensure all source files are using the same encoders/settings/logic.
Remove logging

Update nodeobs_service.cpp

Update CMakeLists.txt to add osn-encoders

Consolidate encoder processing

Move encoder processing to its own file so ensure all source files are using the same encoders/settings/logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant