Skip to content

Published video resolution does not follow what is requested #451

Open
@thepacketloss

Description

@thepacketloss

Select which package(s) are affected

@livekit/rtc-node

Describe the bug

What is happening :

I'm trying to publish a video (screen share and 1920x1080 and simulcast is false) from js client sdk to livekit and receive it using node or rust sdk and then republish it to livekit but after that the resolution of received video is browser is too small (480x256) after some minutes (4-5 minutes) it gradually goes to 1920x1080

btw if the video was sent from other browser and js sdk then the resolution will be 1920x1080 initially
but when I send video from node or rust sdk as I described the resolution will be small initially

also sometimes getting this warnings in console when publishing tracks or in middle of publishing
(I think it's happen when width o height is more than 1000) :

Warning: Desired width too large

Warning: Desired height too large

What is expected

I want to initial resolution of received video be what I set

Reproduction

js client code :

await this.room.localParticipant.setScreenShareEnabled(true, {
        contentHint: 'text',
        resolution: {
          frameRate: 10,
          width: 1920,
          height: 1080,
        }
      }, {
        name: nanoid(15), source: Track.Source.ScreenShare,
        videoCodec: 'vp8',
        videoEncoding: {
          maxFramerate: 10,
          maxBitrate: 250_000,
          priority: 'high'
        },
        screenShareEncoding: {
          maxFramerate: 10,
          maxBitrate: 250_000,
          priority: 'high'
        },
        degradationPreference: 'maintain-resolution',
      })

node sdk code :

const room = new Room();
await room.connect('ws://localhost:7880', jwt, {autoSubscribe: true, dynacast: true});

room.on(RoomEvent.TrackSubscribed, async (track, publication, participant) => {
    const source = new VideoSource(1920, 1080);
    const vp8_track = LocalVideoTrack.createVideoTrack('vp8_track', source);
    await room.localParticipant.publishTrack(vp8_track, {
        simulcast: false,
        videoCodec: VideoCodec.VP8,
        source: TrackSource.SOURCE_SCREENSHARE,
        videoEncoding: {
            maxBitrate: 250_000,
            maxFramerate: 10
        }
    })

    const stream = new VideoStream(track);
    for await (const buf of stream) {
        await source.captureFrame(buf.frame);
    }

    await source.close()
    stream.close()
});

Logs

System Info

Binaries:
    Node: 23.9.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.2.0 - /usr/bin/npm
    pnpm: 8.15.4 - ~/.local/share/pnpm/pnpm
    bun: 1.1.21 - ~/.bun/bin/bun
  npmPackages:
    @livekit/rtc-node: ^0.13.8 => 0.13.8 
    livekit-server-sdk: ^2.10.2 => 2.10.2

LiveKit server version

latest self hosted version

Severity

blocking all usage of LiveKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions