crowsnest icon indicating copy to clipboard operation
crowsnest copied to clipboard

MJPEG is slow, suggest YUYV in docs/config

Open strayr opened this issue 11 months ago • 8 comments

Is your feature request related to a problem? Please describe

Some webcams are painful slow, crowsnest is brilliant for pi cam and on raspberry pi hardware. On other platforms with generic USB webcams, ustreamer in mjpeg mode is just painful. This reddit thread describes the pain https://www.reddit.com/r/klippers/comments/18v8cwh/extremely_low_fps_on_crowsnest_webcam/

I was particularly confused when i moved a webcam from one thin client to another and suddenly it went from a massive framerate to near unusable.

Describe the solution you'd like

Suggest users try

custom_flags: --format=YUYV (ustreamer only) custom_flags: --camera-format=YUYV (camera-streamer only)

if they are experiencing very slow framerates with usb webcams. This could be in the docs, or as a comment in the config file, the latter is more likely to be helpful. Seriously, just something like this will save many users screaming.

#custom_flags: --format=YUYV         # try this if you are experiencing very low framerates with a usb webcam using ustreamer.

edited by mryel00: added parameter for camera-streamer

Describe alternatives you've considered

Buying a raspberry pi and a pi cam - really expensive, i have usb webcams and thin clients that otherwise work.

Additional information

No response

strayr avatar Dec 14 '24 17:12 strayr

You are right, I saw that sometimes in our support forum too. I'm currently rewriting some parts of the docs for v5, so I will add this under common problems.

mryel00 avatar Dec 14 '24 18:12 mryel00

custom_flags: --format=YUYV (ustreamer) can also help if the cam is not putting out any video. This was discovered during support on Discord. There is no error or similar to identify it. See this post on Discord.

edit: custom_flags: --camera-format=YUYV would be the correct parameter for camera-streamer

mryel00 avatar Jan 05 '25 19:01 mryel00

For example, my camera, according to its descrioption, provides twice as high FPS on Mjpeg than on YUVU. But I couldn't make it actually display on Mainsail interface as Mjpeg yet.

Barafu avatar Apr 22 '25 14:04 Barafu

noirOrion on the discord had a similar problem and asked the ustreamer devs for help. The fix was pretty simple: Adding a --allow-truncated-frames to the custom_flags can help too, in some cases. You can find the Discord Post here and here is the GitHub issue comment suggesting it https://github.com/pikvm/ustreamer/issues/313#issuecomment-3083432377

edit: --allow-truncated-frames is an ustreamer only parameter

mryel00 avatar Jul 17 '25 18:07 mryel00

I'd like to add to this one as a user with a C920 who has been plagued by low FPS for years until I just cracked it. I replied to the destination thread as well, but, I think the documentation could use more pointers as well. I was getting around 1-2fps on a pi3b and moved to a pi5 with no change specifically thinking the old pi was limiting me.

--format=YUYV absolutely brought me from 2fps to 10fps which is more than I have seen in a long time. It's a great suggestion and should bein in the documentation.

The big fix for me however was instead using --encoder=HW --allow-truncated-frames

This took me all the way to around 22fps at 720p and 1080p which was a HUGE gain for my use and very reasonable. Both switches were needed together and it should be called out that YUYV should not be specified when using those 2.

The other thing to note with that documentation page is it incorrectly calls for focus_auto when that has been deprecated. focus_automatic_continuous has displaced that.

tastyratz avatar Sep 15 '25 20:09 tastyratz

The other thing to note with that documentation page is it incorrectly calls for focus_auto when that has been deprecated.

The docs are all outdated, and I will soon rewrite them. If you want to checkout the progress (currently none), here is the repo as we migrate back to mkdocs again for easier maintenance: https://github.com/mainsail-crew/docs/tree/mkdocs

edit: here a link to the PR directly https://github.com/mainsail-crew/docs/pull/42

mryel00 avatar Sep 15 '25 20:09 mryel00

Understandable. My goal here was to document my findings and my use case for others to come across and hopefully this information can contribute towards better documentation in the future to help others similar to me.

This git report showed up when I was sleuthing through discord/ the web for answers so if nothing else that's a start.

tastyratz avatar Sep 15 '25 20:09 tastyratz

It's written there:

The big fix for me however was instead using --encoder=HW --allow-truncated-frames

So just add --encoder=HW --allow-truncated-frames to your custom_flags like this: custom_flags: --encoder=HW --allow-truncated-frames If you need more help, join the Discord or open a GitHub Disussion.

P.S. Please do not cite a whole message with quote reply. Cite specific things or ping users instead.

edit: those parameters are ustreamer only

mryel00 avatar Nov 01 '25 16:11 mryel00