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

Vesktop streams resolution of source window no matter what #463

Closed
BuyMyMojo opened this issue Mar 20, 2024 · 2 comments
Closed

Vesktop streams resolution of source window no matter what #463

BuyMyMojo opened this issue Mar 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@BuyMyMojo
Copy link

Describe the bug

When screen sharing Vesktop will ignore your prefered resolution and use the resolution of the display/app you are using. I confirmed this with a friend and they are receiving a full 4K stream even tho discord reports that I chose 720p for both of us.

To Reproduce

  1. Start stream
  2. Click on Voice Connected in the bottom left corner
  3. Click Debug
  4. Under the title RTC DEBUG: STREAM there will be a tab named Outbound go there
  5. Check the Resolution reported there
    image

Expected behavior

scale video to 720p during encode

Screenshots

Screenshot_20240320_224946

I am streaming the file explorer window behind the debug window. it is in one corner of my 4K monitor and I chose to stream in discord at 480p:
image
image

Desktop (please complete the following information):

  • OS/Distro: NixOS
  • Desktop Environment (linux only): KDE Plasma 5
  • Version: 23.11 (But I'm running nix on the unstable channel)

Command line output

nothing to really note

vesktop 
[arRPC > ipc] listening at /run/user/1000/discord-ipc-0
[arRPC > websocket] listening on 6463
[arRPC > process] started
Error occurred in handler for 'VencordGetUpdates': Error: No handler registered for 'VencordGetUpdates'
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:78280)
    at WebContents.emit (node:events:514:28)

image

Additional context

@PolisanTheEasyNick
Copy link
Contributor

I found that for some reason, framerate takes directly from mediaDevices.getDisplayMedia (which returns MediaStream) object.
For fixing FPS value, we can just reapply constraints for the stream in src/renderer/patches/screenShareAudio.ts, where we already have getDisplayMedia function overriding:

navigator.mediaDevices.getDisplayMedia = async function (opts) {
        const stream = await original.call(this, opts);
        const id = await getVirtmic();

        var track = stream.getVideoTracks()[0];
        var constraints = track.getConstraints();
        const newConstraints = {
            ...constraints,
            frameRate: 15,
            width: 640,
            height: 320,
        };

        track
        .applyConstraints(newConstraints)
        .then(() => {
            console.log("Applied constraints successfully");
            console.log("New settings:", track.getSettings());
        })
        .catch(error => {
            console.error("Error applying constraints:", error);
        });

        ....(audio code here)

        return stream;
    };

In code above, there are also tries to set custom resolution but without success (even if these constraints applying works in local WebRTC share-show demo)
After starting stream, we can see on demo and on debug menu that FPS of input is actually capped
image
So for applying fps setting we can use this approach

But for me, the main complexity is that I do not know how to pass screenShare.ts's choice StreamPick object with resolution and fps that user chose to screenShareAudio.ts file, so I believe that someone who knows this project and TypeScript better can deal with it.
Tested on Wayland, KDE.

@Curve
Copy link
Member

Curve commented Apr 18, 2024

Closed by #489.

@Curve Curve closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants