This message was deleted.
# helpdesk
s
This message was deleted.
πŸ‘€ 1
e
Hi @silly-train-16715, thanks for reaching out. Most people familiar with this are in the Pacific time zone, so expect a reply later today. cc @bright-scooter-10854 @acoustic-engineer-41666
πŸ‘ 1
m
@silly-train-16715 are you using Cloud or self-hosted?
s
Hi @magnificent-art-43333. Cloud, since we decided to eliminate any possible problems that can be related to improper backend configuration/setup.
m
And you’re still having connectivity/quality issues? This is unexpected. Can y’all help here @freezing-lifeguard-43174 @eager-raincoat-52616 @better-house-11852?
I haven’t been following your other threads @silly-train-16715. Have you shared more info about the issues testers are complaining about? Do you surface connection quality in your UI? Do you have sessions/participant URLs in your cloud dash you can share with us, which identify some problematic sessions?
e
Are there video quality issues besides the slowdown in framerate you mentioned in the other thread?
d
I have a few more questions in addition to the above β€’ Where are the testers located? β€’ What type of network connection are they using? (and any firewalls?) β€’ Which platforms & devices are the issues experienced on?
s
Hi @eager-raincoat-52616. If I use configuration from flutter example app, then I get remote participants framerate slowdown over time in my app on Android devices. In example app framerate also degrades over time when
adaptiveStream
is set to
true
. When
adaptiveStream
is off, example app seems to work just fine, but in my app framerate slowdown is perceptible when
adaptiveStream=false
, but I've managed to improve the situation by increasing max bitrate of the layers. Without it video of remote participants is blocky or quality is very poor/blurry.
Hi @dry-elephant-14928. β€’ Testers are mostly located in Ukraine. Exceptions are: one in Cyprus and one in UK β€’ No firewalls. By most part they are using WiFi but sometimes 4G β€’ Here is example of something our testers called "bad" (said that connection was very bad and wasn't able to carry out a call): https://cloud.livekit.io/projects/p_519ctfqf1bf/sessions/RM_2vwLSKihFKfD
Hi @magnificent-art-43333. Yes I shared more info in that threads. I show connection indicator in UI but it doesn't seem to work properly. Sometimes it shows perfect connection quality by video quality is poor and sometimes vice versa.
d
I'm looking at the session that you sent, looks like it has only a single participant that left within seconds. there was no sign of anyone else that they may be having a call with (only an egress instance). Is this the right session?
what indicated to the tester that the connection is bad? could they record a screen recording that allows us to see what they are experiencing?
for the flutter/adaptivestream issue, could you paste the publish settings that you've used? that'd help to see what bitrates/layer sizes are at play
s
Which one: before "fix/improvement" or after I've made adjustments?
d
has it been improved to a point of satisfaction for you? or does it still appear choppy?
s
Our testers are currently testing: some that it's OK, others - not. But default framerates seem to be improper for given resolutions. Also increased max bitrate seems to increase device power consumption and it seems to (thermally) throttle over time and video starts to lag every now and then.
d
ok, please paste the current settings you are using.
s
Here one more session. I guess that the same testers. They tries to create another room. https://cloud.livekit.io/projects/p_519ctfqf1bf/sessions/RM_PL2QxqQNUNfi
here are the current settings that seem to work +-
Copy code
final videoSimulcastLayers = Platform.isAndroid
        ? const [
          VideoParameters(
            dimensions: VideoDimensionsPresets.h180_169,
            encoding: VideoEncoding(
              maxBitrate: 500 * 1000,
              maxFramerate: 20,
            ),
          ),
          VideoParameters(
            dimensions: VideoDimensionsPresets.h360_169,
            encoding: VideoEncoding(
              maxBitrate: 1000 * 1000,
              maxFramerate: 20,
            ),
          )
        ]
        : const [
            VideoParameters(
              dimensions: VideoDimensionsPresets.h360_169,
              encoding: VideoEncoding(
                maxBitrate: 1000 * 1000,
                maxFramerate: 20,
              ),
            ),
            VideoParameters(
              dimensions: VideoDimensionsPresets.h540_169,
              encoding: VideoEncoding(
                maxBitrate: 3000 * 1000,
                maxFramerate: 20,
              ),
            )
          ];
      await room.connect(
        roomServerUrl,
        roomToken,
        connectOptions: ConnectOptions(
          autoSubscribe: currentUser?.isCoach ?? false,
        ),
        roomOptions: RoomOptions(
            adaptiveStream: !Platform.isAndroid,
            dynacast: true,
            defaultVideoPublishOptions: VideoPublishOptions(
              simulcast: true,
              videoSimulcastLayers: videoSimulcastLayers,
            ),
            defaultCameraCaptureOptions:
                CameraCaptureOptions(cameraPosition: newCameraPosition)),
      );
    }
also I added this event handling for android devices. Looks like it helps a bit too:
Copy code
..on<TrackSubscribedEvent>((e) async {
      if (e.publication.kind == TrackType.VIDEO && Platform.isAndroid) {
        await e.publication.setVideoQuality(VideoQuality.LOW);
      }
    })
f
I’ll look into that, also, I’m making Stats monitoring API for flutter might be able to help find the reason for the bitrate/framerate drop.
d
thanks for the details. I think the 20fps cap on the simulcast layers is interesting.. have you tried to remove them? we'll do some testing on our side too. We've seen some devices that use hw encoder that aren't able to encode at a different fps for the simulcast layers.
s
Hi @dry-elephant-14928. Do you mean custom layers? I've tried the default configuration when i skip
videoSimulcastLayers
and it gave bad results: some testers complained about bad video quality and other/same testers complained about remote participant framerate degradation. Or do you mean setting
maxFramerate
to those numbers that are given in
video_parameters.dart
?
f
hey @silly-train-16715. If you are using fast connect options in your test, there may be blurry/low frame rate caused by defaultOptions parameters are not passed correctly , you can try this patch https://github.com/livekit/client-sdk-flutter/pull/289/files
πŸ‘ 1
s
Hi @freezing-lifeguard-43174. It looks like those were added in 1.3.2 version of flutter livekit client. I've switched to this version yesterday and asked our testers to test new build
Sorry, I didn't notice
defaultCameraCaptureOptions
. I'll try to modify it too
Doesn't seem to help. Speed test shows good connection but connection indicator shows poor internet connection quality.
f
oh no, Looks like the framerate is very low.
Can you try to open another flutter web (chrome) or iOS app to watch the same publish track?
I will try merge the
Stats Monitor API
soon so we can track the RTC stats. This should help us locate the cause of the low frame rate/bit rate.
s
I've done the following. Entered the same room through my app on android, iPhone and via https://example.livekit.io/ app on my laptop. Web app shows both videos OK. But participant from android is always shown with very bad internet connection. iPhone app shows video from android OK too and also shows poor internet connection for android participant Android app shows web video OK, but video from iPhone is very laggy (low framerate) All devices are connected to WiFi
πŸ‘€ 1
@freezing-lifeguard-43174, interesting thing I've noticed recently: When I open profiler and monitor memory usage the RSS memory usage "sticks" to Dart/Flutter level over time and keeps that way on (first picture). While before it was much higher and wasn't lowering over time (was at the level like on the most left in the second picture). And it happens only on android devices. On iPhone it is has the plot where RSS memory is almost x2 times higher than Dart/Flutter and never lowers over time (when on the same page in app). Maybe this behaviour is responsible for those lags.
f
It seems to be related to this information. I see that the receiving and decoding frame rate is close to 30 fps in the stats monitor layer, but the visual frame rate is only about 5 fps
s
Does it mean that you can reproduce?
f
Yes, From rtc stats, nearly half of the frames dropped
disconnecting from surface 0xb4000070c31e0010, reason disconnectFromSurface
After this log prints, the decoder is reset and starts dropping frames
s
That's good. At least now we know that it is not something related only to my app. Because it was driving me crazy last few weeks πŸ˜…
d
we'll investigate this on our side. having a repro helps!
πŸ‘ 1
s
By the way, when you find the root of the problem can you please give a rough estimate on how much time it may take to fix? Don't want to be pushy or something, just need to plan our future development steps.
f
Yes, we have located the issue. The frame loss seems to be related to the HW decoder of libwebrtc. we tested that using the SW decoder can get smooth and clear video. since this is a tricky issue, it may take more time, but I will try to fix it within 1 week if possible.
❀️ 3
πŸ™ 1
s
Thank you Duan
d
@silly-train-16715 we do have a workaround if you are interested. There's a way for us to disable the use of H.264 for your project entirely, so that it will instead use VP8 for the entire project. This would bypass the bug that you've identified with HW decoding. Let me know if that's of interest and I can enable on our side while the bug is being looked at.
s
@dry-elephant-14928 that would be great.
πŸ‘ 1
Is that a backend thing you will do or I should change H264 to VP8 in
VideoPublishOptions
?
d
I can set it in the backend, but it'll take a bit of time for it to clear the caches/etc
s
If you are sure that it'll improve the video quality, then OK. By the way, is it something we would be able to change from the dashboard in the future?
d
Yup, we are working on it. here's a preview.
πŸ”₯ 1
f
hey @silly-train-16715 can you try to add this override dependency to your flutter projects
pubspec.yaml
and check if dropped frames are fixed, In addition, if you update to the
client-sdk-flutter/example
of the latest commit, you can see video statistics, bit rate, frame rate, resolution, etc. from the main video Widgets.
Copy code
dependency_overrides:
  flutter_webrtc:
    git:
      url: <https://github.com/flutter-webrtc/flutter-webrtc.git>
      ref: fix/frame-drops-on-android-hw-decoder
s
Hi @freezing-lifeguard-43174. Sorry for late response. I haven't used statistics display yet but the issue seems to be resolved.
πŸŽ‰ 3
Hi @freezing-lifeguard-43174 @dry-elephant-14928. It looks like there is similar problem with audio for Android. When I spawn
ffmpeg
process to strem music to previously generated rtmp URL with this code (JS)
Copy code
const ffmpeg = childProcess.spawn(
                `ffmpeg`, [`-re`, `-ss`, `${toHHMMSS(req.body.seekSeconds)}`, `-stream_loop`, `-1`, `-i`, `${concat}`, `-c:v`, `libx264`, `-c:a`, `aac`, `-f`, `flv`, `${req.body.rtmpUrl}`],
                {
                    cwd: process.cwd() + '/songs'
                }
            );
It looks like some parts of a song are dropping and it becomes choppy. I haven't tried it using cloud project with h264 turned off yet, but I'll let you know.
I tried with cloud project where h264 is turned off and got the same behaviour. For Web and iPhone everything works fine. Watch the attached video (playback progression bar is not configured yet so don't mind about it).
m
cc @eager-raincoat-52616
d
@silly-train-16715 are you using an Ingress instance for this? What comes after RTMP in this workflow?
s
Yes, I'm using ingress
d
I see, and it's audio-only? or are you sending video with it as well?
s
In this case audio only
But we are planning to use this flow for video too
d
In this case, it's possible it's a compatibility issue with Ingress and Flutter for Android. Can you file an issue in the Ingress repo so we can investigate?
πŸ‘Œ 1
having the ffmpeg command you've used to reproduce would be helpful
s
But I've already provided it earlier
We are spawning ffmpeg process using node.js
In this code snippet
toHHMMSS
transforms seconds to MM:SS format, and we pass list of mp3 files with
concat
@dry-elephant-14928 I opened new issue: https://github.com/livekit/ingress/issues/115
πŸ™ 1
d
@silly-train-16715 thank you. Yes I meant including the details in the GH issue so the developer taking a look could reproduce. It's easy for things to get lost in Slack threads.
s
Hi @dry-elephant-14928. It looks like I've managed to find a solution to my problem. I switched
-c:a
from
aac
to
mp3
and added
-vbr 5
. It would be great if someone added section to docs on how to use ffmpeg to stream video/audio to room using Ingress and potential pitfalls like one I experienced so it would be not just try and error method. There is a section in livekit-cli REAME but it's pretty small. This PR conversation was helpful too when I first tried to stream something to a room: https://github.com/livekit/livekit-cli/pull/25 Thanks
m
cc @acoustic-engineer-41666 @millions-honey-92294
s
Hi @freezing-lifeguard-43174. It looks like the problem with dropped frames arised once again. To reproduce I've used the code from this branch https://github.com/livekit/client-sdk-flutter/tree/feat/prejoin-example In cloud dashboard I set supported codecs to VP8 only in this case (see attached screenshots). Something very strange is happening with stats: sum of decoded and dropped frames is not equal to the number of received
πŸ‘€ 1
Hello again. Any updates on this one? Still can reproduce with version 1.4.2 of livekit client. I've added logging to write stats to influx DB every 20-30 seconds. Below are the plots of decoded and dropped fractions of received frames for android device (first) and iphone (second). Both have inconsistency with sum of decoded and dropped fractions is not equal to 1, but iphone device has 0 dropped frames and video from android is clean without delays, whereas the video from iphone on android device has 10-15 seconds delay.
@freezing-lifeguard-43174 in order to make everything work made a build with version 1.3.3 (prior to dropped frames fix for Android) of livekit client and enabled support of VP8 only in cloud dashboard. This build works fine somehow (none of our testers complained about video quality issues).
f
The biggest difference between 1.3.3 and 1.4.x is that 1.4.x uses libwebrtc m114, I will check again next week
d
@silly-train-16715 to understand the issue, is the problem when encoded in vp8, the receiver (Android) exhibits a low framerate?
s
Hi @dry-elephant-14928. Not a low framerate but a delay. It can be quite big: 10-15 seconds
d
huh. wow.. that's insane.. and the publisher is also Flutter client on Android?
oh nvm, it's from iPhone.. I see in your original message now
s
I may have provided the wrong version number. I guess I actually used 1.3.2 version of client. Sorry for that. I also got lost in all these versions while finding the correct configuration for everything to work properly
d
no problem.. 1.3.2 works properly? or do you mean that is failing for you too
s
I mean that the build with version 1.3.2 of livekit client together with VP8 being the only codec enabled at backend works fine
πŸ‘ 1
d
ok, thanks, we'll look through to see what the difference might be
f
Confirmed again, 1.4.x uses WrappedVideoDecoderFactory correctly. When using VP8 or H264 decoding, the only difference is that m104 is upgraded to m114
@silly-train-16715 Which Android phone model are you using? There is another possibility that when decoding multiple VP8 tracks, there will be frame drops due to device performance limitations, perhaps through the subscriber setting the quality layer to medium or low
s
Hi @freezing-lifeguard-43174. We are using EB2103, ONEPLUS A6000, Umidigi F2
Hey @dry-elephant-14928 @freezing-lifeguard-43174. I've made one mistake once again (I wrote about it to David some time ago). In my project I forgot to commit one quite important update: set video parameters for camera track to 360p in preview page. The track was created with default parameters (which means 720p) and passed to fast connect options. Which may explain frame drops. I don't know how I missed this part but I'm very sorry for that. I'll test again and let you know if anything have changed.
d
sorry, I'm not quite following. are you still experiencing drops and/or delays? if so could you describe the repro steps in detail? ideally it could be filed as an GH issue. Slack is a bit difficult to track
s
As I said earlier: currently I'm using version 1.3.2 with VP8 only enabled at the backend. I'll use this configuration for a while since it works best. After I finish more important tasks on my project, I'll try a newer version of livekit client and let you know if something is not working correctly.
πŸ™ 1
d
sounds good. keep us posted!