Hi,
i'm wondering is the way of fast video mode switching?
Right now only way to switch video resolution is to restart ISP daemon with new parameters in Sensor0_Entry.cfg .
how do you restart ISP daemon with new parameters in Sensor0_Entry.cfg? do you use v4l2-ctl? if you need add new resolution, maybe you need add it in the Sensor0_Entry.cfg, if current Sensor0_Entry.cfg already has the resolution you need, you just want to change it, you can use v4l2-ctl
Thank you.
Sensor0_Entry.cfg has 3 modes defined. Do you have an example how to change mode using v4l2-ctl?
This way?
v4l2-ctl --set-ctrl=sensor_mode=2
You are fully right.
Do you know if one can reconfigure the ISP scaler dynamically without restarting ISP server?
IMHO this is the only way to select between modes that are defined in the sensor kernel driver. You need to restart ISP daemon with new parameters in Sensor0_Entry.cfg as you said.
However if you are only interested in lowering the video resolution dynamically without stopping live stream (scaling), you can do it with Gstreamer G2D GPU accelerator.
If input aspect ratio does not fit output aspect ratio, you can crop parts of the input image like in example bellow:
v4l2src device=/dev/video0 ! video/x-raw, width=3840,height=2160 ! videocrop name=video_crop ! imxvideoconvert_g2d ! video/x-raw, width=480, height=800 ! autovideosink
and dynamically setting videocrop parameters (left_crop, right_crop etc.).
Note that the actual cropping and downscaling is done inimxvideoconvert_g2d. "videocrop" gstreamer element will only insert necessary metadata.
Also note that this approach only works if you use Gstreamer in an application and not on command line.
I have done this sort of computing a lot. Let me know if u need further assistance.
Thank you.
That is also how I understand this ISP.
ISP also has a scaler.
The reason for switching modes - is FPS value. Lower resolution - higher FPS can be achieved.
Scaling down from 4K @ 30fps, possible to only with 30fps. With FullHD possible to get up to 120FPS.
v4l2-ctl is just another solution for change resolution, but you still need restart ISP, for crop, this is another topic, let me remind, this is limitation for crop and scale
Crop and scale
• Top alignment: 16 pixels
• Left alignment: 16 pixels
• Width alignment: 16 pixels
• Height alignment: 8 pixels
• Maximum resolution: 4096 x 3072
• Minimum resolution: 176 x 144
The scale up ratio is limited to a maximum of 4.0. There is no limitation for the scale down ratio.
yes, thank you.
That was my doubt.
v4l2-ctl is not working here for changing ISP modes.
this command should work and helpful for others
sed -i 's/mode = .*/mode = 0/g' Sensor0_Entry.cfg
v4l2-ctl -d0 --verbose --set-fmt-video=width=1920,height=1080,pixelformat=BA12 --stream-mmap --stream-count=1 --stream-to=grbg.raw