Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPi 5 Compatibility #179

Open
Harvey-Mushman opened this issue Sep 18, 2024 · 21 comments
Open

RPi 5 Compatibility #179

Harvey-Mushman opened this issue Sep 18, 2024 · 21 comments

Comments

@Harvey-Mushman
Copy link

Your comment about RPi5 not supporting v4l2 hardware encoding and suggest there is a solution for software encoding but stop short of going into any detail how this might be done. Can you report this project where you start out with a RPi5 or describe how and where to do the encoding in software? This is a great project that has so many possibilities but the hardware encoding restriction seems like a big hiccup.

@TzuHuanTai
Copy link
Owner

TzuHuanTai commented Sep 18, 2024

Sorry that my document only writes one line to describe here
To use software encoding, please set v4l2_format value to mjpeg and remove --hw_accel flag.

Below is a command used for software encoding and set uuid=home-pi-5 for example.

/path/to/pi_webrtc 
--device=/dev/video0 \ # camera device path
--fps=30 \
--width=1280 \
--height=960 \
--v4l2_format=mjpeg \ #use mjpeg here and remove --hw_accel flag
--mqtt_host=example.s1.eu.hivemq.cloud \ # set your mqtt url
--mqtt_port=8883 \
--mqtt_username=hakunamatata \ # set your mqtt username
--mqtt_password=Wonderful \ # set your mqtt pw
--uid=home-pi-5 # set your custom uid
--record_path=/mnt/ext_disk/video/ # remove this line if recording is not requred

The following MQTT topics will be used, {mqtt_user_id_from_app} is a random value for each new MQTT connection. home-pi-5 will be changed to your uid setting :

  1. The user's app publishes SDP/ICE to topics below, subscribe by pi_camera
    home-pi-5/ice/{mqtt_user_id_from_app}/offer
    home-pi-5/sdp/{mqtt_user_id_from_app}/offer
  2. The pi_camera responds SDP/ICE to topics below, subscribe by the user's app
    home-pi-5/ice/{mqtt_user_id_from_app}
    home-pi-5/sdp/{mqtt_user_id_from_app}

image

@TzuHuanTai
Copy link
Owner

I'll write all the details on the project's wiki page in the next few days.

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Sep 19, 2024 via email

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Sep 23, 2024 via email

@TzuHuanTai
Copy link
Owner

TzuHuanTai commented Sep 23, 2024

  1. Download the app Pi Camera from Play Store.
  2. Open the app go to Settings page, and click the earth icon to input your MQTT server. Leave STUN and TURN blank.
  3. Press + button to create a new device, copy the uid from the app, and run pi_webrtc with this uid, such as pi_webrtc --device=/dev/video0 --uid=xxxxxxxxxx ......

Pi Camera home page will show the preview when all set.
You can follow the readme in the Pi Camera instruction repo for more details. If you need more help, please let me know which step bothers you.

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Sep 24, 2024 via email

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Sep 24, 2024 via email

@TzuHuanTai
Copy link
Owner

/dev/video0 not found, you can follow the issue (#182), the main reason is that the gpu_mem=16 is not enough for Pi 4B.
You can try gpu_mem=256 in /boot/firmware/config.txt for your Pi 5.

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 7, 2024 via email

@TzuHuanTai
Copy link
Owner

TzuHuanTai commented Oct 7, 2024 via email

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 7, 2024 via email

@TzuHuanTai
Copy link
Owner

TzuHuanTai commented Oct 10, 2024

I received pi 5 today! It works fine with the --use_libcamera flag on the latest v1.0.1 pi_camera.
Since pi 5 does not support a hardware encoder, I expected it would cost a lot of CPU usage, but it only uses 25% at 1080p30!
The performance surprises me, and so does the temperature, which goes up to 85°C if there isn't a heat sink...

I use Bookworm Lite (6.6.47) Pi OS, and the only difference is the setting in /boot/firmware/config.txt. Please use the default camera_auto_detect=1, because camera module v3 only supports via libcamera.

/path/to/pi_webrtc --use_libcamera --fps=30 --width=1920 --height=1080  --mqtt_host=xxxx --mqtt_port=8883 --mqtt_username=xxxx --mqtt_password=xxxx --uid=home-pi-5

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 10, 2024 via email

@TzuHuanTai
Copy link
Owner

I found an issue with the camera module 3.
The official doc said it supports autofocus but it does not work here.
Maybe I need to control it by libcamera actively.

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 12, 2024 via email

@TzuHuanTai
Copy link
Owner

Yes, the doc said the autofocus needs to be set in code while the camera starts running.

You could send messages to my email, LinkedIn, or the Google Group. Or is there any other way you like?

@TzuHuanTai
Copy link
Owner

Auto focus is fixed in #194

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 14, 2024 via email

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 14, 2024 via email

@Harvey-Mushman
Copy link
Author

Harvey-Mushman commented Oct 15, 2024 via email

@TzuHuanTai
Copy link
Owner

It can be placed in any folder where you can execute it. This error represents the camera is not detected by the OS.
What is your setting in /boot/firmware/config.txt right now?
What version of Pi OS are you using? (you can use uname -a in terminal)
What is the command you ran pi_camera?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants