m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.96k stars 449 forks source link

Nvidia nvenc #271

Closed mbattista closed 1 year ago

mbattista commented 1 year ago

Hi,

I had a similar problem with the rpi pipeline back in the day. I added h264parse and it worked like expected. I took every 3 seconds as a value for the refresh frame.

I changed the profile and the profile to High Quality since it should be fast enough on nvenc either way. But some experimenting could be done here.

m1k1o commented 1 year ago

Wow @mbattista thank you very much, you actually fixed this issue! It has been there for raspberry pi pipeline all the time since you added it. I tried almost everything but didn't think of looking at raspberry pi pipeline.

I somehow suspected that it must have something to do with keyframes, but I had no idea where to search for it and what would fix it.

I would keep gop-size=15 because default is 75 and that's quite long distance. Maybe also changing keyframe-period=180 and key-int-max=60 for other encoders to 15. Or maybe 30, what would you say?

When I'm reading about h264parse config-interval= is not -1 the value that would be actually desired? To send those informations with IDR frame?

mbattista commented 1 year ago

The last time the keyframes were changed to a shorter interval, the short freezes in the pipeline were reintroduced. (At least for me)

I do not understand, why you would want to resend it in such a short interval? Are there any benefits besides a shorter delay at the startup?

m1k1o commented 1 year ago

The freezes still happen for me. And they match the length of keyframe interval. Therefore keyframe-max-dist for vp8enc has been changed to match fps 25. Now I get only one second freezes.

Does this not happen for h264? Is it only Vp8 issue? What about vaapivp8enc where keyframe-period is 180, there must be at least 7sec freezes (I don't use VAAPI so cannot test that).

If that's not issue for H264 we can keep longer keyframe interval and just introduce h264parse for all other pipelines to ensure fast joinig.

mbattista commented 1 year ago

Interesting. But it seems that those are different freezes that I had.

Can you check if you drop frames in those intervalls?

m1k1o commented 1 year ago

It happens at least once per session (1-2hours long). So I'll have stats open and will check the next time.