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

Add an option to limit maximun bitrate #47

Open
javierriveracastro opened this issue Mar 16, 2023 · 6 comments
Open

Add an option to limit maximun bitrate #47

javierriveracastro opened this issue Mar 16, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@javierriveracastro
Copy link

This is mainly to make the module usable with Livekit Cloud. I understand that this could hurt (or boost) your business line so I understand if it is declined.

I have made some tests and it is quite simple, I've been able to limit the rate to 300 kbs just adding this line in LiveKitCliente.ts

  get trackPublishOptions(): TrackPublishOptions {
    const trackPublishOptions: TrackPublishOptions = {
      audioBitrate: AudioPresets.music.maxBitrate,
      simulcast: true,
      videoSimulcastLayers: [VideoPresets43.h120, VideoPresets43.h240],
      videoEncoding: {maxBitrate: 300_000, maxFramerate: 30} // New line 1479
    };

It needs a setting to enable/disable it and some cleaning but the idea is there.

If you think it is something that can be added to the module, I'm willing to do a PR.

@javierriveracastro javierriveracastro changed the title Add an option to limit the maximun bitrate Add an option to limit maximun bitrate Mar 16, 2023
@bekriebel
Copy link
Owner

I'd be open to bringing something like that in. I'm not concerned about impact on the Patreon cluster subscriptions, but I do want to avoid making the options page too cluttered. What did you have in mind for the settings?

@javierriveracastro
Copy link
Author

I was thinking of adding just a single field to the configuration window: Max_bitrate. It will be empty by default and if it is it will work just as now. If you enter a number it will be multiplied by 1 000 and passes as maximun bitrate.

I need to stablish a maximum framerate to be able to limiybitrate. I expect Livekit to reduce framerate as it main trick to keep to the bitrate limit, so I'm planning to setting it to 30 or maybe even 60. Hardcoded to avoid cluttering the user with options.

The setting could be added to either livekit settings page, or system video server selection. I have no real preference. It makes more sense to have it in module settings, but it is all checkboxes so it will stand out. It also makes some sense in the server configuration window, and it will surely look better there.

@ForjaSalvaje
Copy link

I have seen some modules that have an option with a checkbox with something like "experimental settings" that way people don't usually mess with them. But if someone needs to access it you could add a maxbitrate and framerate setting. They should be very straight forward. If you wanted to add the Codec field too for future support for AV1 for example it would be nice.

@bekriebel
Copy link
Owner

I have seen some modules that have an option with a checkbox with something like "experimental settings" that way people don't usually mess with them. But if someone needs to access it you could add a maxbitrate and framerate setting. They should be very straight forward. If you wanted to add the Codec field too for future support for AV1 for example it would be nice.

I was thinking this as well, but then I glanced through the settings I already expose, and almost all of them are Advanced/Experimental settings 😂

@javierriveracastro Perhaps something similar to my "Audio Music Mode" setting would be good (where an additional setting appears when you change the setting). In this case, the setting could be "Automatic Bitrate" that is defaulted to on. When that is turned off, it could expose the bitrate field (and framerate field if you think that's helpful). For at least the framerate, I think a slider would look better (like what happens with the audio bitrate). If there's a good set of values that could be used for the video bitrate as well, a slider could also be used for that (I don't know if there is a good setting/stepping that makes sense for video bitrate).

Example for the audio version:
image

@bekriebel bekriebel added the enhancement New feature or request label Mar 17, 2023
@ForjaSalvaje
Copy link

Looks really nice!
Values for video could be from 100K to 2Mbps, each increment could be 200K. Default could be 700K
Values for framerate could be from 15fps to 60fps, each increment could be 15fps (or 5fps if more granular). Default could be 30fps
If you added codec to the options if not automatic then it could select vp8,h264,av1

@javierriveracastro
Copy link
Author

That looks nice, I'll try to draft a first PR next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants