Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Add pre-stream encoder setup wizard #3515

Closed
wants to merge 13 commits into from

Conversation

JohannMG
Copy link
Contributor

@JohannMG JohannMG commented Sep 29, 2020

Description

This PR adds a wizard workflow specifically for fine-tuning the stream encoder configuration. In this implementation we're using Facebook's no-auth API, a user-anonymous version of the professional API hardware encoders use. The wizard is extensible for other destinations to use.

Settings are applied for users of simple mode. Setting complicated configuration strings automatically for novice users.

If this change includes UI elements, please include screenshots.

Please note that the Facebook-specific text and buttons are only shown for when the Destination is Facebook AND UI will have some changes while in WIP status.

Settings check entry point next to the stream key:
Settings check entry point next to stream key.

First page of stream check educates user and suggests the most common resolutions. This is configurable per-service:
Prompt

Loading page should be very short so is a minimal animation of the ellipses on the label
Loading

After querying and loading suggested encoder settings, user can select which to apply:
Selections

Final page, user applied settings. Respective service can use the footer to show text and link with next steps.
Finish

Error page, example is network timeout.
Error Finish

Motivation and Context

Why is this change required? What problem does it solve?

Better Stream Broadcasts
Stream destinations have seen a multiplicative surge in broadcasts from OBS since covid started. This highlighted many takeaways and improvement opportunities for our live streaming platform but for this PR we focus on two problems and solutions: First, that the settings on incoming streams could be better for both ingest to reduce latency as well as increase the quality for the streamer and their viewers. Second, direct feedback from users has shown us that configuration in OBS is still difficult.

Complex encoder settings
I am adding this wizard to apply fine-tuned settings to the existing encoder selection in Output Settings so that the user ideally doesn't even need to change anything in the tab.

Extensible and anonymous
The wizard is being written in a way that other services can use and extend the UI. Any service can write their own provider. Overall we want to make the experience better. Facebook is using an API that doesn't require login, is only used when you will be streaming to Facebook, and doesn't log any personal information; this leverages a new a light version of the Professional Facebook Encoder API but made to be anonymous, stateless, and faster. [ Publicly available documentation link coming soon ]

Goal: Refractor and combine with first-run wizard
Motivation behind starting #3246 "UI: Refactor Wizard Pages into encapsulated files" is that the wizards could be refactored and unified for both start up and go-live. See next, "Goal: Go-Live workflow "

Goal: Go-Live workflow
Eventually would like to have an opt-in flow between "Start Streaming" and Streaming that performs a check on encoder settings leveraging the autoconfig and/or pre-stream wizards.

How Has This Been Tested?

Tested: Macbook Pro, MacOS 10.15.7 (19H2)

  • Runs from settings
  • Verified collected correct settings to send service.
  • More testing coming up.

Will change this line when Windows testing completes.

Will change this line when Linux testing completes.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
    • Moving some reused code to smaller common/shared classes

This is a Work in Progress with some finished, some upcoming:

  • Write class to gather settings to send to to the configuration wizard
  • UI: Add a Stream Settings entry point
  • UI: Add start prompt explaining wizard.
  • Create Settings provider structure that other services can use API or hard code configurations.
  • Service: Add Facebook provider
  • UI / Service: Parse FB settings in generic settings map: Generic so that the checkbox UI can show settings from any provider.
  • Text: First review of text and design review internally passing
  • UI: Shows Apply button on commit pages.
  • UI: Finish Error Page
  • UI: Work on Loading page or remove it
  • Launch: Correct launch destination sent
  • UI: review wizard button order
  • Polish interface
  • Service: Write Settings Apply

In consideration: first version may only apply settings for x264 basic and then add support for NVEC and Apple Hardware Encoder. Provisioning a windows laptop to test and work on NVEC support by roughly next week.

Final Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@JohannMG
Copy link
Contributor Author

JohannMG commented Sep 29, 2020

** First CI notes to self:**

  • Fix .get() is now .data().
  • Issue with use of designated initializers in MOC?

Windows
— solved — 

Linux
— solved — 

UI/common-settings.cpp Outdated Show resolved Hide resolved
UI/common-settings.cpp Outdated Show resolved Hide resolved
Copy link

@lruijsink lruijsink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'm no expert in Qt so I glossed over most of that. Let me know if there's things you'd like me to take a closer look at.

UI/common-settings.cpp Outdated Show resolved Hide resolved
UI/common-settings.cpp Outdated Show resolved Hide resolved
UI/common-settings.hpp Show resolved Hide resolved
UI/pre-stream-wizard/page-completed.cpp Outdated Show resolved Hide resolved
@WizardCM WizardCM added Enhancement Improvement to existing functionality Request for Comments More feedback & discussion is requested labels Sep 30, 2020
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch 4 times, most recently from 43adf52 to 89eb3e2 Compare September 30, 2020 20:56
@JohannMG JohannMG changed the title [WIP] UI: Add pre-stream encoder setup wizard UI: Add pre-stream encoder setup wizard Oct 8, 2020
@dodgepong dodgepong added this to the OBS Studio 26.1 milestone Oct 8, 2020
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch 2 times, most recently from a16e52a to 36c05db Compare October 8, 2020 16:26
@JohannMG
Copy link
Contributor Author

JohannMG commented Oct 8, 2020

This product is now viable. I'm requesting testers on Windows and Linux please.

@JohannMG JohannMG marked this pull request as ready for review October 8, 2020 16:30
@jp9000
Copy link
Member

jp9000 commented Oct 8, 2020

Will test on Windows and Linux when I get an opportunity.

@dodgepong dodgepong added the Seeking Testers Build artifacts on CI label Oct 8, 2020
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch from 36c05db to 5414d37 Compare October 8, 2020 17:19
@JohannMG
Copy link
Contributor Author

JohannMG commented Oct 8, 2020

rebased on to 26.0.2

@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch 2 times, most recently from 8b070eb to 97e361a Compare October 8, 2020 18:27
@RytoEX
Copy link
Member

RytoEX commented Oct 14, 2020

While attempting to test this on Windows, I got this error message.
2020-10-14 17_45_00-Verify Stream Settings

@JohannMG
Copy link
Contributor Author

JohannMG commented Oct 14, 2020 via email

@JohannMG
Copy link
Contributor Author

JohannMG commented Oct 14, 2020 via email

@Fenrirthviti
Copy link
Member

Another thing we had noticed was that this appears to assume the encoder is x264, and returns x264-specific recommendations and settings (or rather, settings that only x264 has options to even change/adjust). How is this planned to be handled for hardware encoders, such as NVENC or QSV which might not support these options?

Hide buttons that are disabled for better user clarity.
Applies selected settings to the simple encoder setup. Use the Custom
Encoder Settings to set specific settings. Additionally, changes the
output resolution so the canvas layout is not changed possibly right
before a stream. Next to add gating so this wizard only shows in output
Simple Mode.
Show pre-stream wizard only when in simple mode since it only operates
on simple mode for now. Later, will look into expanding capability.
Additionally, fix a bug where was making a copy of a QPair instead of
creating a reference so settings were not being written.
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch from 97e361a to fd92b24 Compare October 19, 2020 20:15
@JohannMG
Copy link
Contributor Author

Removed QtNetwork dependency. Tested and works on Mac. Windows machine is not cooperating with me right now.

@jp9000
Copy link
Member

jp9000 commented Oct 19, 2020

I'll check it out.

@jp9000
Copy link
Member

jp9000 commented Oct 19, 2020

obs64_2020-10-19_16-10-36
Hm, on Windows, I'm getting to the apply settings page, but it appears to be blank. Seems to work fine on macOS though.

@JohannMG
Copy link
Contributor Author

@jp9000 Is there any TLS error this time?
Will investigate tomorrow.

@jp9000
Copy link
Member

jp9000 commented Oct 19, 2020

I'm pretty sure it returned the json from the remote successfully, it's just not populating the final list box for some reason, haven't delved into it deeply.

@JohannMG
Copy link
Contributor Author

When I use the CI build it works correctly... Does it sign differently that could affect TLS ?
https://github.com/obsproject/obs-studio/actions/runs/316250925

WindowsWorks

OBS does not ship OpenSSL and has a curl helper already to use.
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch from fd92b24 to 6e53c89 Compare October 20, 2020 23:09
@JohannMG
Copy link
Contributor Author

Updated branch with handling of empty/no data more clearly.

@jp9000
Copy link
Member

jp9000 commented Oct 21, 2020

After debugging, I discovered the reason for the bug: in pre-stream-current-settings.hpp, you use static on what I think was intended to be a global variable SettingsResponseKeys that's defined within that header, which is included in multiple source files. When you define a non-extern static variable within a header, it will not make the variable global across different object modules (object modules being the o/obj files that c/cpp files are compiled into); instead, they will be local to each object module this header is used in, and thus that code will essentially be duplicated for each object module.

But that's not quite the exact reason why this failed; the reason why this failed is because you use const char * as your key type. So it's using an pointer, not an actual string. Thus, the keys become invalid because each object module has different pointers for those strings despite them having the same exact string contents. I would probably recommend using QString instead just so no one else gets tripped up by potentially unsafe code.

For your global SettingsResponseKeys variable, if you want to use a global variable across multiple c/cpp files within the same project, then in the header, you need to declare the variable non-static with extern, and define the value of that variable within one of the c/cpp files. For example:

// header file
struct MyStruct {
    const char *str1;
    const char *str2;
};

extern MyStruct myVar;
// source file
MyStruct myVar = {"string 1", "string 2"};

@RytoEX
Copy link
Member

RytoEX commented Oct 21, 2020

Why does the API permit framerates other than 30 if 30 FPS is recommend in Facebook's documentation?

30 is deal. There are some using 24-drop and similar for TV-to-livestream broadcasts.

Why does the API permit video bitrates above 6000 Kbps if the recommended maximum is 4000-6000 Kbps according to Facebook's documentation (see links above)?

1080p broadcasts with the pages that have it enabled (see above Q&A) have higher bitrate limits.

The only information I can find about this is the Level Up program mentioned in these two help articles:

There, the recommended bitrate is still "6mbps", and I don't see any mention of a higher bitrate limit. Also, the API is still clamping to a maximum of 30 FPS, despite 60 FPS being permitted when eligible per the above. The API does not seem to care if I set the input_video_bitrate to 80000 Kbps, whereas this would be clamped to 6000 due to specifications from services.json (more on that in a moment).


On a default OBS installation, "Enforce streaming service bitrate limits" ([SimpleOutput] EnforceBitrate) defaults to true/enabled, which will force the settings to adhere to the service limits provided in services.json. In Facebook's case, that's:

"recommended": {
    "keyint": 2,
    "profile": "main",
    "max video bitrate": 6000,
    "max audio bitrate": 128
}

The audio bitrate setting sent from the API will be overridden by apply_audio_encoder_settings with the value specified here. Profile is, luckily, not overridden.


When testing this with a handcrafted x264Settings/x264opts string (the PR still doesn't work for me on Windows, now getting a blank wizard settings window), NVENC and QSV do not use the options.

When using x264, I get this:

02:19:25.921: [x264 encoder: 'simple_h264_stream'] preset: veryfast
02:19:25.921: [x264 encoder: 'simple_h264_stream'] profile: high
02:19:25.921: [x264 encoder: 'simple_h264_stream'] x264 param: slice_mode=fixed failed
02:19:25.921: [x264 encoder: 'simple_h264_stream'] x264 param: bufsize=8000 failed
02:19:25.921: [x264 encoder: 'simple_h264_stream'] settings:
02:19:25.921: rate_control: CBR
02:19:25.921: bitrate: 4000
02:19:25.921: buffer size: 4000
02:19:25.921: crf: 0
02:19:25.921: fps_num: 30
02:19:25.921: fps_den: 1
02:19:25.921: width: 1280
02:19:25.921: height: 720
02:19:25.921: keyint: 60
02:19:25.921:
02:19:25.922: [x264 encoder: 'simple_h264_stream'] custom settings:
02:19:25.922: profile = high
02:19:25.922: level = 4.1
02:19:25.922: keyint = 60
02:19:25.922: slice_mode = fixed
02:19:25.922: open_gop = 0
02:19:25.922: bframes = 3
02:19:25.922: ref = 3
02:19:25.922: bufsize = 8000
02:19:25.935: ---------------------------------
02:19:25.935: [FFmpeg aac encoder: 'simple_aac'] bitrate: 128, channels: 2, channel_layout: 3
02:19:25.935:
02:19:25.938: [rtmp stream: 'simple_stream'] Connecting to RTMP URL rtmps://rtmp-api.facebook.com:443/rtmp/...
02:19:25.979: [rtmp stream: 'simple_stream'] Interface: Realtek USB GbE Family Controller (ethernet, 1000 mbps)
02:19:26.607: [rtmp stream: 'simple_stream'] Connection to rtmps://rtmp-api.facebook.com:443/rtmp/ successful

As you can see, the audio bitrate has been overridden due to the specification in services.json. It appears that slice_mode is specific to openh264/libopenh264 rather than x264. Is that what you meant to use? The param bufsize should probably be vbv-bufsize for x264.

Echoing concerns above, a lot of the fine-tuning here seems x264-specific. On systems with NVENC available, OBS defaults to NVENC, so these settings would not take effect. Given that, the apparent prevalence of NVENC-capable systems using OBS, and widespread recommendations that users use NVENC when possible, I'm much more interested in seeing NVENC settings fleshed out. I noticed you mentioned that support for NVENC and Apple Hardware Encoder would come later. Do you have any plans to provide fine tuned settings for QuickSync, AMF, or Apple's Software Encoder?

I'm not clear on the benefit of specifying level rather than leaving it on auto. In fact, when forcing 4.1 and trying to stream at 1920x1080@60, which you claim is possible for some users, I get this warning because 4.1 only supports up to about 1920x1080@30:

04:50:22.812: [x264 encoder: 'simple_h264_stream'] MB rate (489600) > level limit (245760)

While OBS still produces a stream in this case, I do not understand why specifying level is required in the first place when the proper minimum level will be auto-selected otherwise.

Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to leave some questions and notes before I forget to do so.

UI/window-basic-settings-stream.cpp Show resolved Hide resolved
UI/pre-stream-wizard/page-input-display.cpp Show resolved Hide resolved
UI/common-settings.cpp Outdated Show resolved Hide resolved
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
@JohannMG
Copy link
Contributor Author

@jp9000 changed to QString and declared in extern-ed struct in implementation file.

Added code and notes from @RytoEX

@JohannMG
Copy link
Contributor Author

There, the recommended bitrate is still "6mbps", and I don't see any mention of a higher bitrate limit.

This is usually for like Level Up, this is for specific users we've discussed with e.g., Pro Gamers, TV.

Also, the API is still clamping to a maximum of 30 FPS, despite 60 FPS being permitted when eligible per the above.

This is being discussed internally but in the mean time one of the reason the settings shows as options you can turn off, for those that know to use it. Like I said above, I might change to make it more hidden in a future commit.

The API does not seem to care if I set the input_video_bitrate to 80000 Kbps, whereas this would be clamped to 6000 due to specifications from services.json (more on that in a moment).

At 720 it will clamp. At 1080 we don't clamp, this is because OBS is not the only user of the API and 1080 was requested not to have ceiling by both other integration partners and our internal team.

Other providers of the wizard can clamp as they see fit and I imagine they will. We may as well later.

Audio

Right now Audio settings are not applied in OBS's implementation.

Slice mode

I had a hard time with documentation on what the ingest team wanted here, I'm actually going to remove this for this PR.

The param bufsize should probably be vbv-bufsize for x264.

Fixed. Thanks for that.

Given that, the apparent prevalence of NVENC-capable systems using OBS, and widespread recommendations that users use NVENC when possible, I'm much more interested in seeing NVENC settings fleshed out.

Me too. Working on it. But these are settings our ingest servers work with best so are purposefully generalized for now. We are looking to add more API inputs for the specificity but friction from both vendors and internal teams makes the API changes slow so it will not be in the first pass.

Are there any analytics on NVEC enabled systems OBS can track to verify how used it is?

I noticed you mentioned that support for NVENC and Apple Hardware Encoder would come later. Do you have any plans to provide fine tuned settings for QuickSync, AMF, or Apple's Software Encoder?

In simple mode Apple's Encoders aren't available and are also not recommended for streaming. Will reavaluate after. There's a decent amount of work in Setting's structure to be done to be able to change Advanced controls in a wizard imho.
For NVEC, the most important: bitrate and resolution are set.

I'm not clear on the benefit of specifying level rather than leaving it on auto

We may remove that from the API side, we have talked about it. But the limit was on purpose from the encoding team. Like above, other users of the UI wouldn't have to set it at all.

@RytoEX
Copy link
Member

RytoEX commented Oct 22, 2020

Also, the API is still clamping to a maximum of 30 FPS, despite 60 FPS being permitted when eligible per the above.

This is being discussed internally but in the mean time one of the reason the settings shows as options you can turn off, for those that know to use it. Like I said above, I might change to make it more hidden in a future commit.

The API does not seem to care if I set the input_video_bitrate to 80000 Kbps, whereas this would be clamped to 6000 due to specifications from services.json (more on that in a moment).

At 720 it will clamp. At 1080 we don't clamp, this is because OBS is not the only user of the API and 1080 was requested not to have ceiling by both other integration partners and our internal team.

I see the clamping as described on 720p.

However, at 1080p, it will still clamp the framerate to 30 and the GOP size (keyint) to 60. This means that a user would have to disable both of these settings or end up with settings that are not recommended (60 FPS with keyint=60).

My comments about the lack of bitrate clamping is related to you specifying the level parameter, because you can exceed the bitrate limit for level 4.1 if you go above 62500 kbps. Similarly, 1920x1080@60 is outside the constraints of level 4.1 - you would need at least level 4.2. I don't know what maximums you allow for other users, but this is one of the reasons why it's better to just leave level at auto. There are possible repercussions to this sort of invalid set of parameters, so I'd think it's better to just not end up with invalid parameters in the first place by just leaving the level at auto. The encoder should auto-select 4.1 if the stream settings are within the constraints of 4.1 anyway.

options you can turn off, for those that know to use it.

This comes back to, paraphrased, "the API is recommending these settings but not all users should apply them and those users will just have to know better what they should and should not apply" which has been expressed by @WizardCM , @dodgepong , and @Fenrirthviti above. I'm sort of inclined to agree with what @Fenrirthviti said:

If we trust these settings, they should just be applied. If we don't trust these settings... well, keep reading

That said, perhaps better wording, and maybe tooltips for each setting, on the settings page to indicate that the user can select/deselect or choose specific settings to apply would help here. Right now, the settings are just presented as "recommended" and that's it. Most users will probably just accept everything that's listed there. Some users will undoubtedly uncheck a few things, like perhaps framerate, but then leave everything else enabled.

I'm not clear on the benefit of specifying level rather than leaving it on auto

We may remove that from the API side, we have talked about it. But the limit was on purpose from the encoding team. Like above, other users of the UI wouldn't have to set it at all.

I don't understand this limit though. As far as I know, OBS will still push out a stream of 80000kbps video at 1920x1080@60 with level 4.1 set even though those parameters exceed what 4.1 is supposed to handle. On the other hand, decoders might reject or fail to display such a stream because it has invalid parameters.

Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With VS2019 on Windows 10, the x264_c_String ends up as a garbage string. See embedded review note for more info.

Is UI/pre-stream-wizard/CMakeLists.txt necessary to include?

UI/pre-stream-wizard/page-input-display.cpp Show resolved Hide resolved
UI/streaming-settings-util.cpp Outdated Show resolved Hide resolved
@JohannMG JohannMG force-pushed the no-auth-stream-wiz-2 branch from 3a7da4b to bdc3a3e Compare October 23, 2020 16:39
@jp9000
Copy link
Member

jp9000 commented Oct 28, 2020

So I want to go over this again in a more formal capacity on the PR. The thing I'm a bit concerned about is this basically being similar functionality to the auto-configuration wizard; I agree with others who have stated similar things. As stated in your original plans, this is something you want to combine with the auto-configuration wizard, so my primary concern is the idea of adding this, and then basically combining them later: why not improve the existing wizard from the start? I know that this is just the start of your plans, and that there are many plans to more thoroughly integrate it, but I can't help but to feel like as it is right now, it's currently duplicating a bit too much of the existing functionality. Are you sure that we should duplicate and combine later like this? Shouldn't we be trying to integrate it into the current wizard if that's the intention later on, rather than creating a new, separate wizard with very similar purpose?

Another thing that makes me feel a bit uncomfortable is how it's accessed, which is currently via the stream section of settings. I know that you want to expand this eventually, but right now, as it is currently implemented in the PR, user access to it is very limited, and they are unlikely ever to change it again after they press it once -- if they press it once.

I don't think the encoder settings for x264/etc are too critical, I think the most important things to modify are usually things like bitrate, resolution, fps, GOP/keyint, maybe profile -- but I don't think things like buffer size or level or anything like that are important because we already handle those automatically behind the scenes. It feels a bit unusual to modify those other settings, and some of those settings are different depending on which encoder implementation you use (x264/NVENC/VCE/etc), whereas the primary settings such as bitrate/res/fps/gop/etc are universal. The settings in the PR are all designed for x264, whereas the majority of our users are probably using NVENC over x264 (NVENC is default if available). So those settings often won't even be set -- thus it's a concern I want to iron out. In my humble opinion, focusing on good bitrate/resolution/fps/keyint combinations is the most important thing.

I think that another very easy and simple way to approach integration of the API would be to implement it as a transparent settings sanity-check when they start their stream using the service. We do need more sanity-checks in the program to make sure that people are streaming with solid settings, that much is definitely true. So basically my idea would be: when the user starts the stream, do a transparent check internally to check the API with current stream settings, and if things are within reasonable/expected/required parameters for the service, then start the stream as normal, otherwise if the streaming settings are not ideal or not within requirements, we can present a dialog to the user asking them if they want to change these parameters to the recommended parameters, and show them the recommended parameters that they can apply if they so choose, then start stream. Doesn't even need to be a wizard I think -- perhaps it could be simplified further to make it easier and more straightforward for users. That way, it would be even more simple to implement, and if the API changes server-side, it would affect all users as soon as the API is changed, which is probably one of the other original intentions for the API. It's something that would allow you to roll the API out the door more quickly/easily, while also ensuring more coverage to users to get them using it.

I know that the API as-is right now is made more for auto-configuration, but I feel like this all could be adapted (likely without even changing the API) to allow this sort of sanity-check functionality, and the sanity-check functionality would probably be even more effective than an auto-configuration that's run a single time. This is just my idea though, I'm trying to find constructive ways to integrate streaming specifications received via API, while keeping things simple and reducing potentially duplicated functionality of the auto-configuration wizard. And if the service is not Facebook, then we can just calculate reasonable settings for the sanity-check. I think this is something we can calculate/check reasonably well in a service-agnostic way as a fallback if the service doesn't have its own API or something.

That being said, I think we can adapt the existing wizard to use the API as well. And if there's issues with the wizard taking too long to use, we should be able to iron those out as well. Or at least that would be my hope.

What do you think about this? If I'm off the mark or anything like that, please let me know.

@jp9000
Copy link
Member

jp9000 commented Oct 28, 2020

I do want to additionally state that the placement of it within the streaming section of settings itself is not a bad idea -- in fact, it's smart, because if a user is running on default settings, and they haven't run the auto-configuration, we should probably ensure that they have at least attempted to configure encoding settings or auto-configured encoding settings.

We should probably have some check somewhere to make sure they've set encoding settings, and then possibly prompt to run the auto-configuration wizard if they haven't configured settings before they try to start the stream, or suggest good settings to them ala the sanity-check. So I really like the idea of trying to get the user to set good encoding settings early on, and make sure they're not stuck on defaults unintentionally. I realize now that was one of your intentions there, and it's definitely on the mark.

#3649 is another good idea as well, we could combine the idea I proposed there with it here. I'm wondering if perhaps we could also try to run the auto-configuration before they try to start their stream if we detect that they haven't set their encoding settings.

So, to summarize, on a "Start Streaming" click, the idea for running the auto-config could be:

  1. Find some way to detect whether the user has set their encoding settings
  2. If they haven't set their encoding settings, prompt them to run the auto-configuration wizard before starting the stream perhaps?

Or, on "Start Streaming" click, if it knows that the user has set their encoding settings:

  1. Perform a sanity check on their settings to make sure they're within specified parameters (and Facebook specifically could supplement this with the API)
  2. If they're not within specified parameters, try to suggest them the most ideal settings we can calculate, either OBS-calculated or API-returned
  3. Give them the option to apply those settings and start stream perhaps?

Again what do you think on these sort of idea? I feel like they should be simple to implement, and should ensure users are using solid settings at all times.

And what does everything else think for that matter?

@JohannMG
Copy link
Contributor Author

The thing I'm a bit concerned about is this basically being similar functionality to the auto-configuration wizard

I decided to write this as a separate wizard because we have similar ideas on making a Start Streaming flow. And believed in the end it should be different from the AutoConfig first-run/setup wizard. I think there's problem over-reusing UIs in the application already which creates endpoints with a lot of flags, options, and routes to manage. I want to keep this simpler. Additionally, I had started looking at the existing wizard and refactoring it but the PR has been ignored which signaled me it would be best to compartmentalize this UI flow.

...How it's accessed, which is currently via the stream section of settings...

Our thinking was, even if not promised every stream, when people are setting up their stream key is the good time to check settings one last time. The original draft had it every stream interrupting Start Stream but we want to make sure it works like this AND get it done in time first.

[NVEC + ] ...In my humble opinion, focusing on good bitrate/resolution/fps/keyint combinations is the most important thing.

Agree. We're seeing tens of thousands of streams send over-resolution daily. But encoder settings are important for the ingest backend side; even if x264 is not the majority it will be a good start. Making streams closer match what live stream ingest servers expect reduce latency and streaming failures. Back on the big four (BR/RES/FPS/KF), we agree that the four big data flows are the most important, which is why they’re they a priority of this API for now. I'm okay removing most x264 settings that are undesired here.

I think that another very easy and simple way to approach integration of the API would be to implement it as a transparent settings sanity-check when they start their stream using the service.

Originally this was going to be a checkbox and no UI that checked settings on stream. I thought that users should be more informed that settings are changing. We additionally know we have users who need to make a decision on resolution to make sure it’s either below or at 1080p. These were the biggest driving factors in adding a short UI as well.

I started writing this as a sanity check comparison but found a few issues: i) some parts of the settings API in OBS is hard to use to compare values which meant a lot of overhead when we're trying to target the next release, ii) I ended up writing UI component for confirmation anyways, iii) our internal gaming team worried that we would apply a resolution setting that was not desired by the account [hence the confirmation screen now]

Overall I believe these should be separate. I'm glad you approve of the placement in setting as well as #3649 — the two combined should paint a picture why I think each flow is important. I think the autoconfig wizard should be on first run for profiles and any fresh start while this flow was designed to quickly add specific encoder settings per provider specific to a provider before a stream.

Or, on "Start Streaming" click, if it knows that the user has set their encoding settings...

The only problem I see here is significantly more development time and like we discussed, we were targeting this to try to help the holiday surge we get in November through December.

@dodgepong
Copy link
Member

Max bitrate and keyframe interval are already things that can be controlled by service requirements in services.json. However, resolution and framerate are currently not things that can be limited by services.json. For a short-term solution I would much rather see support for resolution and fps limits inside services.json instead of actively introducing technical debt to the project via the creation of an additional auto-config wizard. That's a feature any service can find useful. Yes, putting those values in the services.json file makes it harder for Facebook to change those recommendations on the fly (requires submitting a PR to services.json instead of just tweaking the API response), but we're talking about a feature that Facebook are hoping to have released in the wild in less than a month. Consensus on the OBS side seems pretty clear that the current design leaves a lot to be desired in terms of usability and future maintainability, so if expediency is the primary motivating factor here, then augmenting the existing system we have in place for applying sane limits on settings (services.json) seems like the shortest path toward something that is at least somewhat more workable.

@JohannMG
Copy link
Contributor Author

For a short-term solution I would much rather see support for resolution and fps limits inside services.json

I'll look into this next week.

Also working on #3649 when I have a moment

@JohannMG JohannMG closed this Oct 29, 2020
@jp9000
Copy link
Member

jp9000 commented Oct 29, 2020

I will also do my utmost to help to make sure we have a solution for the holidays, the item I've been blocked on has been eliminated off of my plate, so feel free to let me know if there's anything I can do to help.

@RytoEX RytoEX removed this from the OBS Studio 27.0 milestone Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality Request for Comments More feedback & discussion is requested Seeking Testers Build artifacts on CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants