The algorithms of Raspberry Pi cameras are affected by tuning files which are specific for each camera type and Raspberry Pi version. These files are automatically loaded when the camera system is instantiated.
A set of default tuning files for all camera models are part of the Raspberry Pi OS distribution.
(For details, see the Raspberry Pi Camera Algorithm and Tuning Guide)
With raspiCamSrv, you can control which files are used and you may tweak specific features within these files to optimize the camera behavior for your specific needs.
This functionality can be accessed through menu Config, submenu Tuning:
The configuration provides three parameters:
- Name of Tuning File
This is the name of the tuning file to be loaded for the active camera.
Raspberry Pi OS distributions include default tuning files with '.json' type and a name which is identical to the name of the camera model.
If you provide own tuning files, you may choose an arbitrary name. If you are using multiple camera models simultaneously, you should be able to correctly associate a file with a camera model. - Full path to folder with tuning files
If this is empty (None), Picamera2 will search a system-specific list of likely installation folders for the required tuning file.
raspiCamSrv supports usage of a custom folder (/home/<user>/prg/raspi-cam-srv/raspiCamSrv/static/tuning
) which allows keeping own tuning files separate from the default ones. - Load Tuning File
If this checkbox is activated, raspiCamSrv will request Picamera2 to load the specified tuning file instead of the default one.
Otherwise, Picamera2 will load the default tuning file.
Any changes of one of these parameters needs to be submitted with the Submit & Apply button.
If Load Tuning File is checked, a restart of the live stream will be requested so that the result of the chosen tuning file can be directly seen in the Live view.
- Button Custom Folder will switch the folder for tuning files to the custom folder
/home/<user>/prg/raspi-cam-srv/raspiCamSrv/static/tuning
If there is already a tuning file with the specified name in this folder, it will be used.
If the tuning file does not yet exist in the custom folder, the standard tuning file will be copied to the custom folder. - Button Default Folder (toggled) will switch to the default folder.
This folder is system-specific, e.g./usr/share/libcamera/ipa/rpi/pisp
Modification of tuning files with raspiCamSrv can only be done in the custom folder.
If you are not directly accessing the tuning files on the Raspberry Pi, you can download a file, rename it, if desired, and modify it on the client machine.
Afterwards you can upload it to the custom folder.
When done, the file will be available for selection.
The button Delete Tuning File will only be active, if
- the custom folder is activated
- Load Tuning File is unchecked
- No parameter changes have beenn made after the last Submit & Apply
This restriction avoids inadvertently deleting the wrong file if the file has been changed without submitting.
A tuning file can be downloaded from the default folder or from the custom folder.
The buttons for upload will only be active if the custom folder is selected.
- You start pushing the Select Tuning File for Upload button
- If a single file has been selected, its name will be shown on the button:
- If a multiple files have been selected, the number of selected files will be shown on the button:
- Finally, you need to the Upload selected File button to upload:
If you have already prepared tuning files in a specific folder on the Raspberry Pi, which is different from the Custom Folder used by raspiCamSrv, you can also refer to this folder.
You first need to manually enter the Full Path to this folder and push Submit & Apply.
Afterwards, the .json files in this folder will be available for selection as Name of Tuning File
Tuning files are specific for a camera and not for a camera model.
If two cameras are used with a Pi5, the tuning file needs to be individually specified for each camera, also if both are the same model.
To preserve the tuning configuration for a camera, it must be memorized using the Memorize Configuration and Controls for Camera Change in screen Web Cam
Because of a Threading issue in Picamera2 (see Picamera2 Issue #1103 Tuning file support not thread-safe?), the streams from the two cameras in dialog Web Cam may look as if the tuning file of the first camera would have also been applied to the second one.
Nevertheless, the handling in raspiCamSrv is correct.
You may proof this in the following way:
- Activate a dialog without live view, e.g. Info.
- Wait at least 10 sec. until both streaming threads have terminated (refresh the screen from time to time)
- In another browser window, stream just one camera (endpoint video_feed or video_feed2).
You should then see the effect of the correct tuning file.
However, if you later start streaming the other camera, you may see that the tuning file for the previously started camera has been applied.