element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Manual FPS override for screenshares in 1:1 call

Open w3bb opened this issue 5 years ago • 13 comments

Your use case

What would you like to do?

Have an option to manually override the framerate of video to something higher

Why would you like to do it?

For gamers and other people using screenshare it is essential to be able to use higher framerates. Currently the only other program that has this kind of option I'm aware of is Discord.

How would you like to achieve it?

A simple drop down menu with options for framerates would probably work best.

Have you considered any alternatives?

No response

Additional context

This is one of those small things that drives me nuts and prevents me from using Element's video chat in a meaningful capacity.

w3bb avatar Sep 13 '21 12:09 w3bb

@gaelledel, would it be possible to edit the screen-sharing dialog to allow for setting things such as FPS, resolution and sharing desktop audio? (this probably isn't a priority atm, but would be great in future)

Related: https://github.com/vector-im/element-desktop/issues/791

SimonBrandner avatar Sep 13 '21 15:09 SimonBrandner

Any news? It's been likr 4 year.

32bitx64bit avatar Apr 28 '25 22:04 32bitx64bit

It's 2026 soon and the screen share quality is still bad. Guys, we really need it to be better.

centralnui avatar Oct 05 '25 12:10 centralnui

Hi, still no update ?

kipavy avatar Feb 09 '26 22:02 kipavy

This, alongside element-hq/element-desktop/pull/2850, are the current blockers for me to daily drive element. Would really like to see them at some point in the near future, wish the devs the best of luck implementing them.

nnra6864 avatar Feb 12 '26 12:02 nnra6864

I would like to add that this is also very useful for people who are screen sharing during music sessions over telephony.

My family currently uses Discord to share a video "conductor" stream to keep everyone in sync as they play together as a band. We are looking for ways to do 60 fps screen sharing.

Element + Element ESS in our location is giving us 3-6 ms ping with video + audio, which is great for latency, but it loses out on perceived stream smoothness by only being 30 fps during screen sharing.

I am hoping the protocol isn't locked down to a 30 fps target (though I could see why it would be since most telephony is for meeting and spreadsheet sharing calls).

If there are code spots that I could make a contribution towards on this front, would the team be able to point me towards that? I might be able to dig in and set up a PR? I work in real time communications and community work and my background comes from real time rendering and video processing for VFX.

I feel like I could at least dig in and through some reading, maybe give some feedback to these other folks as to how complicated this would be as a feature?

As one open source maintainer to another, thanks for y'all's consideration and efforts!

I'm sure you're very busy working on other features that have higher priority.

nick-funk avatar Feb 25 '26 21:02 nick-funk

@nick-funk https://github.com/element-hq/element-call/blob/d16fa4531c58005a5093743965059eb8067503a1/src/livekit/options.ts#L27

t3chguy avatar Feb 25 '26 21:02 t3chguy

@nick-funk https://github.com/element-hq/element-call/blob/d16fa4531c58005a5093743965059eb8067503a1/src/livekit/options.ts#L27

Thanks @t3chguy! I will dig in, much obliged. Hopefully, I can submit a PR soon-ish once I get my bearings.

nick-funk avatar Feb 25 '26 21:02 nick-funk

Hey folks, I have some bad news for y'all.

So, element-call (the code base that handles video/audio/screenshares) is using a package called livekit-client to process this audio and video. That is completely normal, and Live Kit is a very well known company with an open source toolkit to do this.

In their code, they have the following presets for screen sharing:

export const ScreenSharePresets = {
  h360fps3: new VideoPreset(640, 360, 200_000, 3, 'medium'),
  h360fps15: new VideoPreset(640, 360, 400_000, 15, 'medium'),
  h720fps5: new VideoPreset(1280, 720, 800_000, 5, 'medium'),
  h720fps15: new VideoPreset(1280, 720, 1_500_000, 15, 'medium'),
  h720fps30: new VideoPreset(1280, 720, 2_000_000, 30, 'medium'),
  h1080fps15: new VideoPreset(1920, 1080, 2_500_000, 15, 'medium'),
  h1080fps30: new VideoPreset(1920, 1080, 5_000_000, 30, 'medium'),
  // original resolution, without resizing
  original: new VideoPreset(0, 0, 7_000_000, 30, 'medium'),
} as const;

source: https://github.com/livekit/client-sdk-js/blob/main/src/room/track/options.ts

The element-call web app uses this when it builds its options to host our video/audio/screenshare calls:

const defaultLiveKitPublishOptions: TrackPublishDefaults = {
  audioPreset: AudioPresets.music,
  dtx: true,
  // disable red because the livekit server strips out red packets for clients
  // that don't support it (firefox) but of course that doesn't work with e2ee.
  red: false,
  forceStereo: false,
  simulcast: true,
  videoSimulcastLayers: [VideoPresets.h180, VideoPresets.h360] as VideoPreset[],
  screenShareEncoding: ScreenSharePresets.h1080fps30.encoding,
  stopMicTrackOnMute: false,
  videoCodec: "vp8",
  videoEncoding: VideoPresets.h720.encoding,
  backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
} as const;

source: https://github.com/element-hq/element-call/blob/d16fa4531c58005a5093743965059eb8067503a1/src/livekit/options.ts#L27

This is why we are seeing screen sharing sit at 1080p with a 30 fps share rate.

I thought to myself, what if I try and override it? Maybe I can coerce live kit to accept a higher frame rate?

So I made this change to the element-call options:

export const OverridePresets = {
  h1080fps60: new VideoPreset(1920, 1080, 6_650_000, 60, 'medium'),
}

const defaultLiveKitPublishOptions: TrackPublishDefaults = {
  audioPreset: AudioPresets.music,
  dtx: true,
  // disable red because the livekit server strips out red packets for clients
  // that don't support it (firefox) but of course that doesn't work with e2ee.
  red: false,
  forceStereo: false,
  simulcast: true,
  videoSimulcastLayers: [VideoPresets.h180, VideoPresets.h360] as VideoPreset[],
  screenShareEncoding: OverridePresets.h1080fps60.encoding,
  stopMicTrackOnMute: false,
  videoCodec: "vp8",
  videoEncoding: VideoPresets.h720.encoding,
  backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
} as const;

Unfortunately (and somewhat expected), when I tested this, the screen share defaulted back down to 1080p at 30 fps. The lack of 60 fps (or higher) is entirely dependent upon live kit and has nothing to do with element and their app.

Until Live Kit Client decides to update these options with further supported modes for higher fps, neither the Element devs (or us) can do anything about.

I'm going to open an issue on their end to see if they would be interested in providing this.

There you go folks, that's why this feature can't be implemented easily.

Thanks @t3chguy for pointing me to the code, found the issue almost immediately. Have a good one!

nick-funk avatar Feb 25 '26 23:02 nick-funk

I have opened a feature request on the Live Kit side of things. If folks want to go over there and show their support, it might help it get noticed by their devs.

Fingers crossed, we can make something happen here to unblock the Element devs on this one.

LiveKit Upstream Feature Request: https://github.com/livekit/client-sdk-js/issues/1822

nick-funk avatar Feb 25 '26 23:02 nick-funk

Hi! We've been discussing and testing some code for having more screen share options at https://github.com/element-hq/element-call/issues/249

There's also a pr mentioned over there that I think would cover your use case @nick-funk

pirosuki avatar Feb 25 '26 23:02 pirosuki

Hi! We've been discussing and testing some code for having more screen share options at element-hq/element-call#249

There's also a pr mentioned over there that I think would cover your use case @nick-funk

This is great, thanks for sharing!

I will keep an eye on this, would be great to have more flexibility (even if it's in a developer menu like @robintown suggests in the linked PR).

Really cool to see so many other musicians, gamers, and audio folks discussing similar workflows to myself and others! 😄

nick-funk avatar Feb 26 '26 06:02 nick-funk

We got a reply on the sdk issue, but I don't get it. Does that mean we're free to set any preset on the element end without modifying the sdk?

https://github.com/livekit/client-sdk-js/issues/1822#issuecomment-4279186517

As in, would this solve all our problems: https://github.com/element-hq/element-call/issues/249

rwjack avatar Apr 23 '26 20:04 rwjack