Raspberry Pi Cam Module 3

Think i’am almost their!

I’ve been modifying the code so that the web server and the camera run of two separate services which seams to run ok. The camera is up and running without any error messages but when i go to the web server for the camera (9090 not 8080) it says “This site can’t be reached & took too long to respond.”

This is the github page with the latest code:

Many thanks for your support!

Hi,

I think your problem is that you specified the port - "9090" for your camera.
The ports format is [<host>:]<container>; because you did not specify a host port, one will be assigned at random.
The easiest fix is to specify the host port yourself, like you did for the webserver.

In the docker compose do I change the port 9090 To 90:90 ?

You can change it to whatever you want really.

If you want to connect to port 9090, change the entry to 9090:9090.
If you want to connect to port 12345, change the entry to 12345:9090.

Note that these are host ports that change; the container port should remain the same.
They are used when you want to connect to the device.

From one container, you can connect to the other container using its service name, without having to expose the port in such a way.
So, within your webserver, you can connect to the camera using http://camera:9090 (or whatever protocol it is actually running).

1 Like

I’ve changed the docker compose camera port to "90:90" and the docker.template & bash file to expose port 90. However when i go to the http://ip:9090/stream it would attempt to load however show the same message took too long to respond.

I’ve updated the github files to the latest code I’ve been attempting to upload. I have also tried changing the balena compose to "9090:9090" however this would show the message saying ... refused to connect. I also attempted to change the expose to 9090 but didn’t make any difference :frowning:

Thank you for the continued support. Hopefully almost their now :crossed_fingers:

Not manged to make any progress in the last couple of weeks with the error :frowning_face:

Would it be possible to make the pi boot to the raspberry pi os instead of Debian bullseye? Then I can use the original working python code!

Hello, are you suggesting trying to run Raspberry Pi OS in a container? I’m not sure that would solve your issue(s) which seem more related to containerization and port routing than anything missing from Debian Bullseye (the previous version of Raspberry Pi OS is basically Debian Bullseye with some tweaks as I understand it.)
Perhaps start working backwards - try getting just the camera working in a single Dockerfile without docker-compose. Then you should have access to all ports and see what is going on. After that’s working, add back in the other container with docker-compose.

1 Like

Thanks @alanb128. I have already tried making a os as a container. It half worked but showed alot of errors and wouldn’t allow me to install applications :slightly_frowning_face: . I’m just currently attempting to get it to work with a more basic code like you have suggested. However balena doesn’t allow for a “preview” of the camera in the bash script which would probably explain why it isn’t working on the website server

Do you know any methods to override this?

Many thanks
Jake

After a bit of trial and error I’ve managed to get the stream file working on it’s own however the web server is saying that it took too long to respond and i can’t figure out a way to fix this :slightly_frowning_face:

Below are the logs from the Pi. I have also created a new directory which contains the code i’am currently running: ALD-Models/Rail-Vista-Simplified · GitHub

Started service 'camera sha256:3390db4dbf072d38adcd591cb84947b1e9aff43c8ce72e63ccbe20c9e5465e9f'
Releasing update locks
 camera  Available cameras
 camera  -----------------
 camera  0 : imx708 [4608x2592] (/base/soc/i2c0mux/i2c@1/imx708@1a)
 camera      Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
 camera                               2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
 camera                               4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]
 camera  
 camera      Available controls for 4608x2592 SRGGB10_CSI2P mode:
 camera      ----------------------------------------------------
 camera      AeConstraintMode : [0..3]
 camera      AeEnable : [false..true]
 camera      AeExposureMode : [0..3]
 camera      AeMeteringMode : [0..3]
 camera      AfMetering : [0..1]
 camera      AfMode : [0..2]
 camera      AfPause : [0..2]
 camera      AfRange : [0..2]
 camera      AfSpeed : [0..1]
 camera      AfTrigger : [0..1]
 camera      AfWindows : [(0, 0)/0x0..(65535, 65535)/65535x65535]
 camera      AnalogueGain : [1.122807..16.000000]
 camera      AwbEnable : [false..true]
 camera      AwbMode : [0..7]
 camera      Brightness : [-1.000000..1.000000]
 camera      ColourGains : [0.000000..32.000000]
 camera      Contrast : [0.000000..32.000000]
 camera      ExposureTime : [26..112015443]
 camera      ExposureValue : [-8.000000..8.000000]
 camera      FrameDurationLimits : [69669..220535845]
 camera      LensPosition : [0.000000..32.000000]
 camera      NoiseReductionMode : [0..4]
 camera      Saturation : [0.000000..32.000000]
 camera      ScalerCrop : [(0, 0)/64x64..(0, 0)/4608x2592]
 camera      Sharpness : [0.000000..16.000000]
 camera  
 camera  Server listening on port 80
 camera  You can view the stream at http://172.17.0.2:80/
 camera  [0:32:12.459547842] [103]  INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
 camera  [0:32:12.602922676] [105]  INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media1
 camera  [0:32:12.603054620] [105]  INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
 camera  [0:32:12.605948027] [103]  INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-YUV420
 camera  [0:32:12.613443268] [105]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA

Any help would be massively appreciated!

Jake

Unfortunately, I haven’t made any progress with getting the pi camera to stream to a web server.

Could their be any firewall preventing me to stream the camera view to the port 80?

Jake