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

Streaming quality is not as good as meet.livekit.io #56

Open
b0iq opened this issue Apr 11, 2023 · 10 comments
Open

Streaming quality is not as good as meet.livekit.io #56

b0iq opened this issue Apr 11, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@b0iq
Copy link
Contributor

b0iq commented Apr 11, 2023

Describe the bug

The streaming quality is weird I tried several methods but still receiving quality is not same meet.livekit.io

To Reproduce

Steps to reproduce the behavior:

Room configs:

const room = new Room({
  adaptiveStream: {
    pixelDensity: 'screen',
  },
  publishDefaults: {
    videoSimulcastLayers: [VideoPresets.h720, VideoPresets.h1080],
    simulcast: false,
  },
  // optimize publishing bandwidth and CPU for published tracks
  dynacast: false,
  videoCaptureDefaults: {
    facingMode: 'user',
    resolution: VideoPresets.h720, // Cannot set it more than that!! 1080 and above will not work
  },
});

// -------- SETTING THE QUALITY 
trackStreamStateChanged(
  publication: RemoteTrackPublication,
  streamState: Track.StreamState,
  participant: RemoteParticipant
) {
  publication.setVideoQuality(2);
},

// -------- RENDERING REMOTE VIDEO
const RemoteVideo = () => {
  const remote = useLiveStore((state) => state.remoteVideo);
  if (!remote || remote.isMuted) return <ZLoading backgroundColor="red" zIndex={1} />;
  return (
    <VideoView
      objectFit="contain"
      videoTrack={remote}
      mirror={false}
      style={{ flex: 1, backgroundColor: 'red' }}
    />
  );
};

room is connected to cloud server...

Expected behavior

There problem is I cannot check the video quality only the connection quality and it is excellent
but it should be better than meet.livekit.io because it is native

Screenshots

web viewer web publisher
IMG_6326 IMG_0863
app viewer app publisher
IMG_6327 IMG_0864

.
.
.
.
.

Most of the time the quality is worst, However, this is as highest as I can get

.
.
.
.
.

Device Info:

Viewer: iPhone 11 [16.1.2]
Host: iPhone 14 [16.4.1]

Dependencies Info (please reference your package-lock.json or yarn.lock file):

  • @livekit/react-native: ^0.3.0
  • livekit-client: ^1.7.1
  • react-native-webrtc: ^111.0.0
  • Server region is in germany and am located it Dubai
@b0iq b0iq added the bug Something isn't working label Apr 11, 2023
@davidzhao
Copy link
Member

Discussed with reporter in Slack. The problem is both local and remote video appear lower resolution the RN app. b0iq will test with example app and report back.

@b0iq
Copy link
Contributor Author

b0iq commented Apr 13, 2023

Hi again.
I tried to reproduce with the example but not matter what I try it always failed to build. using old RN version cannot build on my machine. However, I create new vanilla RN project and try to do a minimal setup: https://github.com/b0iq/LKExample

The final result was not what I hoped for. it was same or worst.

Viewer (Web) Publisher (Web)
IMG_6333 IMG_0871
Viewer (App) Publisher (App)
IMG_6332 IMG_0870

@pankajmyt
Copy link

This is affecting us too. The video quality for web+mobile call, the mobile camera generated video is quite pixelated, grainy and lags quite a bit on latency in android.

@pankajmyt
Copy link

using 4/3 preset gives better quality, but improvements can be done.

@davidliu
Copy link
Contributor

@pankajmyt does this repro with the example app?

What settings are you using with the Room object?

@pankajmyt
Copy link

const [room] = useState(() =>
      new Room({
        adaptiveStream: { pixelDensity: 'screen' },
        // publishDefaults: { simulcast: false },
        audioCaptureDefaults: {
          autoGainControl: true,
          echoCancellation: true,
          noiseSuppression: true,
        },
        videoCaptureDefaults: {
          facingMode: 'user',
          resolution: VideoPresets43.h540.resolution
        },
        publishDefaults: { 
          simulcast: false,
          videoSimulcastLayers: [VideoPresets43.h540, VideoPresets43.h720]
        },
        reconnectPolicy: {
          nextRetryDelayInMs: (context): number | null => {
            if (context.retryCount > 10) {
              return null
            }

            console.log(`retrying connection: retries: ${context.retryCount} sec: ${context.elapsedMs/1000} `)
            return 3000 //retry every 3 seconds
          }
        },
        disconnectOnPageLeave: true,
      }
  ));

@davidzhao
Copy link
Member

If you are sending simulcast: false, videoSimulcastLayers would have no effect there. Simulcast will not be used.

@pankajmyt
Copy link

:) yes, I have kept it there to remind myself to enable it later.

In readme it says simulcast is not supported, however in react-native-webrtc readme it says simulcast is supported.
https://github.com/react-native-webrtc/react-native-webrtc/blob/master/README.md

Simulcast - As of version 111.0.0 Simulcast is now easily possible due to the use of software encode/decode factories by default.

@davidzhao
Copy link
Member

Simulcast is supported as of v1.0

@lukasIO
Copy link
Contributor

lukasIO commented Apr 21, 2023

also you're setting resolution: VideoPresets43.h540.resolution as capture defaults, this will obviously limit the quality of the acquired camera track.

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

5 participants