raspberry-pi-camera/raspindi

Documentation

rudolfbyker opened this issue · 8 comments

Hi, would you add some documentation to help those who are new to NDI to get this up and running on their PI4?

rf152 commented

Hi Rudolf,

If you clone the repo and run build.sh, then it should build the binary under the build directory. You then need to copy that to somewhere in your path, and copy the libraries under Lib to /usr/lib or define LD_LIBRARY_PATH when running.

For example, if you copy the contents of the lib folders to /opt/raspindi/lib and the binary to /opt/raspindi/bin, then you would run the following command:

LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi

Besides git, what other dependencies do I need to install to get build.sh working?

$ bash build.sh 
src/main.cpp:17:10: fatal error: libconfig.h++: No such file or directory
 #include <libconfig.h++>
          ^~~~~~~~~~~~~~~
compilation terminated.

OK, build works on vanilla Raspberry PI OS after apt install libconfig++-dev.

Next question: how should the folder structure of /opt/raspindi/lib look? No matter how I slice and dice it, I still get:

./raspindi: error while loading shared libraries: libndi.so.4: cannot open shared object file: No such file or directory

Edit: When I flatten the lib folder, like this:

$ tree
.
├── bin
│   └── raspindi
└── lib
    ├── libndi.so
    ├── libndi.so.4
    ├── libndi.so.4.5.2
    ├── libopencv_aruco.so
    ├── libopencv_aruco.so.4.4
    ├── libopencv_aruco.so.4.4.0
    ├── libopencv_bgsegm.so
    ├── libopencv_bgsegm.so.4.4
    ├── libopencv_bgsegm.so.4.4.0
    ├── libopencv_bioinspired.so
    ├── libopencv_bioinspired.so.4.4
    ├── libopencv_bioinspired.so.4.4.0
    ├── libopencv_calib3d.so
    ├── libopencv_calib3d.so.4.4
    ├── libopencv_calib3d.so.4.4.0
    ├── libopencv_ccalib.so
    ├── libopencv_ccalib.so.4.4
    ├── libopencv_ccalib.so.4.4.0
    ├── libopencv_core.so
    ├── libopencv_core.so.4.4
    ├── libopencv_core.so.4.4.0
    ├── libopencv_datasets.so
    ├── libopencv_datasets.so.4.4
    ├── libopencv_datasets.so.4.4.0
    ├── libopencv_dnn_objdetect.so
    ├── libopencv_dnn_objdetect.so.4.4
    ├── libopencv_dnn_objdetect.so.4.4.0
    ├── libopencv_dnn.so
    ├── libopencv_dnn.so.4.4
    ├── libopencv_dnn.so.4.4.0
    ├── libopencv_dnn_superres.so
    ├── libopencv_dnn_superres.so.4.4
    ├── libopencv_dnn_superres.so.4.4.0
    ├── libopencv_dpm.so
    ├── libopencv_dpm.so.4.4
    ├── libopencv_dpm.so.4.4.0
    ├── libopencv_face.so
    ├── libopencv_face.so.4.4
    ├── libopencv_face.so.4.4.0
    ├── libopencv_features2d.so
    ├── libopencv_features2d.so.4.4
    ├── libopencv_features2d.so.4.4.0
    ├── libopencv_flann.so
    ├── libopencv_flann.so.4.4
    ├── libopencv_flann.so.4.4.0
    ├── libopencv_fuzzy.so
    ├── libopencv_fuzzy.so.4.4
    ├── libopencv_fuzzy.so.4.4.0
    ├── libopencv_gapi.so
    ├── libopencv_gapi.so.4.4
    ├── libopencv_gapi.so.4.4.0
    ├── libopencv_hfs.so
    ├── libopencv_hfs.so.4.4
    ├── libopencv_hfs.so.4.4.0
    ├── libopencv_highgui.so
    ├── libopencv_highgui.so.4.4
    ├── libopencv_highgui.so.4.4.0
    ├── libopencv_imgcodecs.so
    ├── libopencv_imgcodecs.so.4.4
    ├── libopencv_imgcodecs.so.4.4.0
    ├── libopencv_img_hash.so
    ├── libopencv_img_hash.so.4.4
    ├── libopencv_img_hash.so.4.4.0
    ├── libopencv_imgproc.so
    ├── libopencv_imgproc.so.4.4
    ├── libopencv_imgproc.so.4.4.0
    ├── libopencv_intensity_transform.so
    ├── libopencv_intensity_transform.so.4.4
    ├── libopencv_intensity_transform.so.4.4.0
    ├── libopencv_line_descriptor.so
    ├── libopencv_line_descriptor.so.4.4
    ├── libopencv_line_descriptor.so.4.4.0
    ├── libopencv_ml.so
    ├── libopencv_ml.so.4.4
    ├── libopencv_ml.so.4.4.0
    ├── libopencv_objdetect.so
    ├── libopencv_objdetect.so.4.4
    ├── libopencv_objdetect.so.4.4.0
    ├── libopencv_optflow.so
    ├── libopencv_optflow.so.4.4
    ├── libopencv_optflow.so.4.4.0
    ├── libopencv_phase_unwrapping.so
    ├── libopencv_phase_unwrapping.so.4.4
    ├── libopencv_phase_unwrapping.so.4.4.0
    ├── libopencv_photo.so
    ├── libopencv_photo.so.4.4
    ├── libopencv_photo.so.4.4.0
    ├── libopencv_plot.so
    ├── libopencv_plot.so.4.4
    ├── libopencv_plot.so.4.4.0
    ├── libopencv_quality.so
    ├── libopencv_quality.so.4.4
    ├── libopencv_quality.so.4.4.0
    ├── libopencv_rapid.so
    ├── libopencv_rapid.so.4.4
    ├── libopencv_rapid.so.4.4.0
    ├── libopencv_reg.so
    ├── libopencv_reg.so.4.4
    ├── libopencv_reg.so.4.4.0
    ├── libopencv_rgbd.so
    ├── libopencv_rgbd.so.4.4
    ├── libopencv_rgbd.so.4.4.0
    ├── libopencv_saliency.so
    ├── libopencv_saliency.so.4.4
    ├── libopencv_saliency.so.4.4.0
    ├── libopencv_shape.so
    ├── libopencv_shape.so.4.4
    ├── libopencv_shape.so.4.4.0
    ├── libopencv_stereo.so
    ├── libopencv_stereo.so.4.4
    ├── libopencv_stereo.so.4.4.0
    ├── libopencv_stitching.so
    ├── libopencv_stitching.so.4.4
    ├── libopencv_stitching.so.4.4.0
    ├── libopencv_structured_light.so
    ├── libopencv_structured_light.so.4.4
    ├── libopencv_structured_light.so.4.4.0
    ├── libopencv_superres.so
    ├── libopencv_superres.so.4.4
    ├── libopencv_superres.so.4.4.0
    ├── libopencv_surface_matching.so
    ├── libopencv_surface_matching.so.4.4
    ├── libopencv_surface_matching.so.4.4.0
    ├── libopencv_text.so
    ├── libopencv_text.so.4.4
    ├── libopencv_text.so.4.4.0
    ├── libopencv_tracking.so
    ├── libopencv_tracking.so.4.4
    ├── libopencv_tracking.so.4.4.0
    ├── libopencv_videoio.so
    ├── libopencv_videoio.so.4.4
    ├── libopencv_videoio.so.4.4.0
    ├── libopencv_video.so
    ├── libopencv_video.so.4.4
    ├── libopencv_video.so.4.4.0
    ├── libopencv_videostab.so
    ├── libopencv_videostab.so.4.4
    ├── libopencv_videostab.so.4.4.0
    ├── libopencv_xfeatures2d.so
    ├── libopencv_xfeatures2d.so.4.4
    ├── libopencv_xfeatures2d.so.4.4.0
    ├── libopencv_ximgproc.so
    ├── libopencv_ximgproc.so.4.4
    ├── libopencv_ximgproc.so.4.4.0
    ├── libopencv_xobjdetect.so
    ├── libopencv_xobjdetect.so.4.4
    ├── libopencv_xobjdetect.so.4.4.0
    ├── libopencv_xphoto.so
    ├── libopencv_xphoto.so.4.4
    ├── libopencv_xphoto.so.4.4.0
    ├── libraspicam_cv.so
    ├── libraspicam.so
    ├── libraspicam.so.0.1
    └── libraspicam.so.0.1.2

... then I get a different error:

$ LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi
/opt/raspindi/bin/raspindi: error while loading shared libraries: libjasper.so.1: cannot open shared object file: No such file or directory

OK, I'm starting to reverse-engineer this...

sudo apt install libjasper-runtime

Now it runs, but alas, it needs a config file, which is also not documented. Please assist :)

$ LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi
Could not open config file /etc/raspindi.conf

After creating an empty file at /etc/raspindi.conf:

$ LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi
terminate called after throwing an instance of 'libconfig::SettingNotFoundException'
  what():  SettingNotFoundException
Aborted
rf152 commented

Hi Rudolf,

If you look in the source tree under etc, there is a an example config file. (raspindi.conf.default)

If you are able to document the steps you took to compile and install, then I'll happily accept a pull request to improve the documentation.

Thanks! I will write up everything I learn and submit a PR for the README.md file later. But only if I can get it working ;)

For now, more questions...

This is how far I get now:

$ LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi
mmal: mmal_vc_port_enable: failed to enable port vc.ril.camera:out:1(BGR3): ENOSPC
mmal: mmal_port_enable: failed to enable port vc.ril.camera:out:1(BGR3)(0x1fc710) (ENOSPC)
camera video callback2 erroropen Failed to create camera component/home/pi/build/raspicam/src/private/private_impl.cpp 103
Error opening camera.
rf152 commented

To answer your questions:

  • it doesn't have the ability to change settings on RaspiVid at the moment. It's locked to 720p (any higher and the frame rate drops).
  • camera_number = -1 is fine. That is used for a separate part of software (https://github.com/raspberry-pi-camera/atem-tally)
  • Shouldn't need running as root - it runs as the pi user on my cameras.

Have you got the camera module enabled (in raspiconfig)? And is it connected?

Oops, I had another instance of raspivid running. After stopping it, $ LD_LIBRARY_PATH="/opt/raspindi/lib" /opt/raspindi/bin/raspindi runs with no output, so I assume it's working. Next step is to figure out the NDI client part. This is all new to me.