steveseguin / raspberry_ninja

Publish or capture VDO.Ninja streams with Python (Raspberry Pi, Linux, Mac, Windows WSL)
https://raspberry.ninja
149 stars 30 forks source link

Issues with Pi HQ Camera #20

Open d4s1r opened 2 years ago

d4s1r commented 2 years ago

Hello there,

thanks for the awesome effort yoiu are putting into this project.

Setup: I am using a Raspberry Pi High Quality Camera on a RasPi 4. Issue: I am running into problems with the framerate (approx 10fps). What have I tried: All Software is up-to-date. I am suspecting my settings to be off (especially because you referenced this setup in your manual). However if I lower the resolution of the camera it does not affect the fps. When running a preview via raspistill -t 0 all looks fine. Do you have any tips and tricks how I could troubleshoot this?

all the best

steveseguin commented 2 years ago

This should work I'd assume: python3 publish.py --rpi --rpicam

If not, you can try to lower the resolution: python3 publish.py --rpi --rpicam --width 1920 --height --framerate 30

You might also want to consider start running the camera with a flash light pointed into the lens directly to give it more light ; otherwise if you are running the camera in low-light, the pi might lower the frame rate to compensate for the needed increased exposure.

If not, maybe you can try this, just to see, but image corruption might happen python3 publish.py --rpi --omx

I don't have a HQ camera yet to test with

d4s1r commented 2 years ago

I can confirm that this resolves the issue. Using --rpicam changes the picture entirely. The framerate is fine and also the brightness. Thank you very much! If you need to do specific tests for this camera I can help you with let me know!

d4s1r commented 2 years ago

Unfortunatelly there seems to be an issue with stuttering. The preview on the raspberry Pi is perfectly fine (I did not see the preview withour --rpicam btw). Issue: The picture stutters in random intervals for about a second when running with python3 publish.py --room myRoom --bitrate 8000 --width 1920 --height 1080 framerate 30 --rpi --rpicam What have I tried: However it stutters even with a buffer of 1500 on the other client (adding &buffer=1500 to the browser source). The bitrate does not seem to affect this issue. I tried bitrates from 4000 to 8000. The limit of the framerate did not seem to affect it either, I tried running without a framerate-cap. The parameter --rpi does not change it either.

steveseguin commented 2 years ago

You can try with --noaudio added; audio sometimes causes issues currently.

You can also try a lower bitrate or lower resolution, if that doesn't help.

There are some system-level optimizations https://github.com/steveseguin/raspberry_ninja/tree/main/raspberry_pi#firmware , such as ensuring the firmware on a pi4 is up to date.

If you have packet loss on your connection, it might impact things. Updating firmware can fix packet loss over ethernet, but if using wifi, there might be some inherent issues.

Curious to know how bad the stuttering is; if it's very mild or pretty heavy.

d4s1r commented 2 years ago

thanks for the swift response!

--noaudio seems to fix this. The stuttering also occured on 640*480 pixels and I would consider it very heavy. Sometimes the picture was stuck for 3 seconds and after half a second of moving it was stuck again for 2 seconds.

OT: I have not tried it yet, but does vdo.ninja sync the sources if I use a separate audio-feed?