How much bandwidth is your video stream using?

Camera model
pi cam v2 - [Edit] I double checked this is the 5Mpixel one so it must be a version 1, I ordered a 2.
What is the problem?
15Mbps for 640x480
What did you already try to solve it?
install uv4l
Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

Additional information about your setup (OctoPrint version, OctoPi version, ...)
pi 4 OctoPrint : 1.4.0rc4

camera="raspi"
camera_raspi_options="-x 640 -y 480 -fps 10"

Mine is like 150mbps

Are you running 1080p then? I guess I need gigabit for the pi 4?

According to this a h264 stream at 1080p should only use 1.2Mbps. Another site has a calculator that shows 12Mbps for 1080p at 30fps. Not 100 not 150 so what is going on here? If Netflix can stream you a 1080p movie it can't possibly use 100mbps. Google h264 1080p bandwidth

[edited for clarity]

OctoPrint's web interface embeds mjpg streams, not h264. Those are quite bandwidth hungry.

Why mjpg? Lowest common denominator, back when this stuff was initially implemented a Pi was simply not capable of transcoding a stream without slowing the print to a grinding halt, and switching to a video tag so far hasn't been done due to more pressing priorities.

So to change from mjpg to h264 is what I want to learn how to do, I just don't know what a good starting point for replacing the mjpg_streamer.

[edit] I tried uv4l but it didn't use the h264 encoder either, any suggestions?

Weeeelllll that's not that easy.
I found this ways:

I use 5 GHz wifi.

Not to be a pessimist but you might end up spending a fair amount of time "upgrading" to a beefier video stream only to find that your Pi now is working too hard, negatively impacting your print quality.

Thanks PrintedWeezl this will be a nice adventure, now if I could only find a few seconds to work on my Pi while I am not printing!

I will update with my findings if there is anything worthwhile.

I tried uv4l and it didn't use h264, then I tried RaspiMJPEG and killed my octoprint sudo user, had to rebuild octoprint but I have a backup. When I get some time I am going to try ffmpeg. supposedly has hardware support if you compile it.

Wouldn't the hardware encoder for h264 make it better? Maybe not, I hear ya, I will find out sometime when I got more time.

Yeah the hardware encoder helps but I can't say how much.
On a pi zero (different project) I get a smooth stream with the help of the encoder. :slight_smile:
I didn't test it on faster pis.

1 Like

Nice to hear, dude. I may look at this for another project.

I had good results with this
https://www.linux-projects.org/uv4l/
Webrtc worked best for me.

1 Like

Nor sure if you still searching for alternatives.
I was searching for a simple solution to live-stream an h264 stream to a website without WebSockets and complex setup and used the raspivid with the broadway player. Depending on the quality compensation you can run it smoothly with 1080p on a pi zero... If you want to check the performance you could simply try around and adjust the settings.

I'm not familiar with octoprint implementation but let me know if i can help.

I am seeing a consistent near 3 MB/s for my OctoPrint on PI3+ with PI cam ... which seems rather excessive to me.

I can't seem to find any settings to lower the bandwidth consumption. Only settings to tweak the recording size.

Are there no options to tweak the webcam in OctoPrint?

Also, the above 3 MB/s is for 1 instance with just the small webcam window in the sidebar.

In the main screen with the large webcam view + the sidebar active, it is 5 MB/s.

lower resolution, fps or image quality :slight_smile: