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

Serverside - force quality settings #176

Closed
ne0YT opened this issue Aug 19, 2023 · 23 comments
Closed

Serverside - force quality settings #176

ne0YT opened this issue Aug 19, 2023 · 23 comments
Assignees

Comments

@ne0YT
Copy link

ne0YT commented Aug 19, 2023

Is your feature request related to a problem? Please describe.
I want to forcefully enable "lossless" as the quality mode and enable "webrtc_udp "

Describe the solution you'd like
It would be great to be able to just pass this as a variable to the vncserver- command.

@ne0YT ne0YT changed the title force quality settings Serverside - force quality settings Aug 19, 2023
@ne0YT
Copy link
Author

ne0YT commented Aug 21, 2023

I tried with the standard config file under:
/etc/kasmvnc/kasmvnc.yaml

while only changing:
runtime_configuration:
allow_client_to_override_kasm_server_settings: false
allow_override_standard_vnc_server_settings: false

I can still set whatever I want when connecting from the client.

@ne0YT
Copy link
Author

ne0YT commented Sep 14, 2023

@mmcclaskey
no way to force or just predefine "lossless" ?

@ledestin
Copy link
Collaborator

In order to lock-in lossless, besides the options you've changed, you need to change encoding.video_encoding_mode.jpeg_quality, etc in a server config.

UI lets you set anything, but it doesn't change stream quality settings you set in server config (with client overrides disabled).

I'll cover WebRTC UDP later.

@ne0YT
Copy link
Author

ne0YT commented Sep 17, 2023

In order to lock-in lossless, besides the options you've changed, you need to change encoding.video_encoding_mode.jpeg_quality, etc in a server config.

UI lets you set anything, but it doesn't change stream quality settings you set in server config (with client overrides disabled).

I'll cover WebRTC UDP later.

Can you post the example config to represent lossless?

@ne0YT
Copy link
Author

ne0YT commented Sep 27, 2023

In order to lock-in lossless, besides the options you've changed, you need to change encoding.video_encoding_mode.jpeg_quality, etc in a server config.

UI lets you set anything, but it doesn't change stream quality settings you set in server config (with client overrides disabled).

I'll cover WebRTC UDP later.

@ledestin
hey there :)
any update?

@ne0YT
Copy link
Author

ne0YT commented Oct 7, 2023

@ledestin hey there, it would be very nice if you could help me out as I don't get what to set.
if you could share the part of the config it would be really great :)

@ne0YT
Copy link
Author

ne0YT commented Oct 15, 2023

@ledestin I really cannot figure it out.
please help me out :)

@ne0YT
Copy link
Author

ne0YT commented Oct 18, 2023

@mmcclaskey maybe you can help?

@ne0YT
Copy link
Author

ne0YT commented Oct 23, 2023

@ledestin @mmcclaskey @lyarwood @koying @lhchavez
please any way to force this?

@john-deng
Copy link

@ne0YT did you make any progress on this issue?

@ne0YT
Copy link
Author

ne0YT commented Oct 31, 2023

@john-deng sadly not at all. You're trying the same?

@john-deng
Copy link

@ne0YT Yes, I am. Not only this issue, but a lot more. I think we may contribute to this project, and things will get much easier if we can get some help from Kasmtech, e.g. hold the community meeting to discuss key features and issues. @mmcclaskey

@mmcclaskey
Copy link
Collaborator

mmcclaskey commented Nov 3, 2023

This setting does not restrict everything. Current logging does not provide any feedback explicitly on what settings are applied or not applied when the client sends the changes.

@clbr, could you please do the following

  1. When logging is set to 100, log settings that are sent by the client and whether they were applied or ignored.
  2. Can you provide a list of what settings the server will ignore from the client when -IgnoreClientSettingsKasm 1 is passed to Xvnc. I can then document this.

Initial testing does show that video mode is not altered by the client changing the Preset mode. When the preset is set to Extreme, it should disable video mode and that is not happening as expected. Once the above two items are addressed we can fully test that all settings that should be blocked are being blocked.

Here is my /etc/kasmvnc/kasmvnc.yml file...

  runtime_configuration:
    allow_client_to_override_kasm_server_settings: false

  logging:
    log_writer_name: all
    log_dest: logfile
    # 0 - minimal verbosity, 100 - most verbose
    level: 100

  encoding:
    max_frame_rate: 60
    full_frame_updates: none
    rect_encoding_mode:
      min_quality: 7
      max_quality: 8
      consider_lossless_quality: 10
      rectangle_compress_threads: auto

    video_encoding_mode:
      jpeg_quality: -1
      webp_quality: -1
      max_resolution:
        width: 1920
        height: 1080
      enter_video_encoding_mode:
        time_threshold: 5
        area_threshold: 45%
      exit_video_encoding_mode:
        time_threshold: 3
      logging:
        level: off
      scaling_algorithm: progressive_bilinear

@clbr
Copy link
Collaborator

clbr commented Nov 6, 2023

We have an internal branch now that logs all client settings.

Re the original question, for lossless you have to set the dynamic quality min and max to 9 in your server config. You may also need to disable the video mode and possibly some other settings. UDP you cannot force on, as it depends on client support.

@ne0YT
Copy link
Author

ne0YT commented Nov 6, 2023

We have an internal branch now that logs all client settings.

Re the original question, for lossless you have to set the dynamic quality min and max to 9 in your server config. You may also need to disable the video mode and possibly some other settings. UDP you cannot force on, as it depends on client support.

Hey there
Can you figure out the config the way mmcclaskey was posting?

@clbr
Copy link
Collaborator

clbr commented Nov 6, 2023

Sorry, I work on the server directly. I don't use vncserver or the config, I pass options directly to Xvnc on the command line, so I don't really know what the lossless yaml config would be.

@ne0YT
Copy link
Author

ne0YT commented Nov 6, 2023

@mmcclaskey can you do this? :)

@mmcclaskey
Copy link
Collaborator

@ne0YT , I am not sure what you are asking for.

@clbr has created a feature branch that logs settings applied by the client, to include logging when settings from the client are ignored. This has not been merged to master yet, but the change is just logging, it still works exactly the same. I also have a branch on the docs that adds more detail on the yaml configuration allow_client_to_override_kasm_server_settings. The docs list which client settings are blocked when this is set to true.

https://s3.amazonaws.com/kasmvnc-docs/kasmvnc/docs/feature_KASM-5214_log_render_settings_applied/configuration.html#runtime-configuration

@ne0YT
Copy link
Author

ne0YT commented Nov 6, 2023

@mmcclaskey I don't need to enforce the settings but want to make it the standard if someone connects without setting anything to have the same settings as if he sets "lossless" as it works the best for my situation not only from quality but even from performance.

so I want to figure out which settings represent this in kasmvnc.yml

"for lossless you have to set the dynamic quality min and max to 9 in your server config. You may also need to disable the video mode and possibly some other settings"

so is there a way for me to figure this out myself rn what else is needed?

@mmcclaskey
Copy link
Collaborator

There is confusion on terminology. @clbr referred to lossless in reference to traditional VNC, which basically just increases the JPEG/webp quality level all the way up and disables dynamic quality. Normally, KasmVNC will vary the jpeg/webp compression quality based on how much motion is happing at any given time. By setting the quality to 9 and setting treatlossless to 9, you are effectively getting as close to lossless with traditional VNC as possible. Technically, it is not lossless because even a setting of 9 is lossy.

See this for reference of Client preset settings https://www.kasmweb.com/kasmvnc/docs/latest/clientside.html#present-modes.

The extreme mode is set here, which is close to traditional lossless https://github.com/kasmtech/noVNC/blob/68135beedd40c2654f2d41bba821165ddf0d09d7/app/ui.js#L2044

KasmVNC has a truly lossless mode that uses QOI image format rather than JPEG. It is truly lossless but takes up a lot more bandwidth and is more suited to local LAN. This is in the client pre defined modes, see link above for that. Here is the client side code that sets that mode
https://github.com/kasmtech/noVNC/blob/68135beedd40c2654f2d41bba821165ddf0d09d7/app/ui.js#L2028C29-L2028C29

To do what you want, you will need to modify the front end so that it defaults to either extreme or lossless. Because there is no way to do what you want with only server side settings. Because the client always sends the settings it wants, so the server either needs to take the client settings or ignore them. All the client settings are stored in local storage, so you may be able to get away with just setting values in local storage, just open up dev tools and look at local storage values. Play with the control panel and you will see them change.

@ne0YT
Copy link
Author

ne0YT commented Nov 8, 2023

@mmcclaskey do you have an idea where / how to inject a simple .js to do this wihtout changing the code, os I cna still update KASM normally?
otherwise, if I take your config will it be the same as "lossless" but forced?

@mmcclaskey
Copy link
Collaborator

Sorry, I can't assist in developing your project, but I am happy to see others adapt KasmVNC for their unique requirements.

The following configuration would force near lossless and keep the client from changing it.

  runtime_configuration:
    allow_client_to_override_kasm_server_settings: false

  logging:
    log_writer_name: all
    log_dest: logfile
    # 0 - minimal verbosity, 100 - most verbose
    level: 100

  encoding:
    max_frame_rate: 60
    full_frame_updates: none
    rect_encoding_mode:
      min_quality: 9
      max_quality: 9
      consider_lossless_quality: 9
      rectangle_compress_threads: auto

    video_encoding_mode:
      jpeg_quality: 9
      webp_quality: 9
      max_resolution:
        width: 1920
        height: 1080
      enter_video_encoding_mode:
        time_threshold: 100
        area_threshold: 100%
      exit_video_encoding_mode:
        time_threshold: 3
      logging:
        level: off
      scaling_algorithm: progressive_bilinear

@ne0YT ne0YT closed this as completed Nov 8, 2023
@ne0YT ne0YT reopened this Nov 8, 2023
@ne0YT ne0YT closed this as completed Nov 8, 2023
@ne0YT
Copy link
Author

ne0YT commented Nov 8, 2023

@mmcclaskey thank you very much for the configs :)

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

No branches or pull requests

5 participants