I’m working with a Luckfox Pico Zero using the IMX415 camera sensor, and I’m trying to achieve 1920x1080 @ 30 FPS using rkipc.ini.
However, no matter what I configure, I’m consistently getting only ~10–12 FPS.
Currently I have set these parameters in my /userdata/rkipc.ini to use as less overhead as possible while storing 7s clips:
[video.source]
enable_ivs = 0
enable_rtsp = 0
enable_rtmp = 0
enable_npu = 0
enable_venc_1 = 0
enable_venc_2 = 0
[video.0]
width = 1920
height = 1080
src_frame_rate_num = 30
dst_frame_rate_num = 30
output_data_type = H.264
gop = 30
enable_motion_deblur = 0
buffer_size = 1036800
[storage.0]
enable = 1
file_duration = 7
[osd.common]
enable_osd = 0
[ivs]
md = 0
od = 0
[event.regional_invasion]
enabled = 0
[network.ntp]
enable = 0
Even while streaming to VLC over rtsp I was only able to achieve 11FPS. Is there an out of the box configuration to achieve 1080p@30FPS using rkipc? Or is a custom RKMPI build the only way to achieve high res and fps?
Please let me know if I can provide any additional details
Thanks!
Unable to achieve 1080p 30FPS on Luckfox Pico Zero (IMX415) using rkipc.ini – stuck at ~12 FPS
The resolution set in rkipc is only the scaled resolution; the image actually captured from the sensor remains 3840x2160. The maximum frame rate of the IMX415 on RV1106 is around 4K @ 15 FPS, which is limited by the CSI PHY bandwidth. Therefore, modifying the rkipc.ini is ineffective.
You need to change the output resolution directly in the driver to 1920x1080. Below is a configuration gathered from online sources. We have not tested it, so you need to verify its usability yourself.
Note: If you use the IMX415 driver with 1920x1080 resolution, you need to comment out the following content in /oem/usr/bin/RkLunch.sh.
You need to change the output resolution directly in the driver to 1920x1080. Below is a configuration gathered from online sources. We have not tested it, so you need to verify its usability yourself.
Code: Select all
/*
* Xclk 37.125Mhz
*/
static __maybe_unused const struct regval imx415_linear_10bit_1920x1080_891M_regs[] = {
/*
IMX415-AAQR Window cropping 1920x1080 CSI-2_4lane 37.125MHz AD:10bit Output:10bit 891Mbps Master Mode 60.012fps Integration Time 14.442ms
Tool ver : Ver9.0
*/
{0x3008, 0x7F}, // BCWAIT_TIME[9:0]
{0x300A, 0x5B}, // CPWAIT_TIME[9:0]
{0x3020, 0x01}, // HADD .
{0x3021, 0x01}, // VADD .
{0x3022, 0x01}, // ADDMODE[1:0] .
{0x3024, 0xCA}, // VMAX[19:0]
{0x3025, 0x08},
{0x3028, 0x26}, // HMAX[15:0]
{0x3029, 0x02},
{0x3031, 0x00}, // ADBIT[1:0]
{0x3033, 0x04}, // SYS_MODE[3:0] .
{0x3050, 0x08}, // SHR0[19:0] .
{0x30C1, 0x00}, // XVS_DRV[1:0]
{0x30D9, 0x02}, // DIG_CLP_VSTART[4:0]
{0x30DA, 0x01}, // DIG_CLP_VNUM[1:0]
{0x3116, 0x24}, // INCKSEL2[7:0]
{0x3118, 0xC0}, // INCKSEL3[10:0]
{0x311A, 0xE0}, // INCKSEL4[10:0]
{0x311E, 0x24}, // INCKSEL5[7:0]
{0x32D4, 0x21}, // -
{0x32EC, 0xA1}, // -
{0x344C, 0x2B}, // -
{0x344D, 0x01}, // -
{0x344E, 0xED}, // -
{0x344F, 0x01}, // -
{0x3450, 0xF6}, // -
{0x3451, 0x02}, // -
{0x3452, 0x7F}, // -
{0x3453, 0x03}, // -
{0x358A, 0x04}, // -
{0x35A1, 0x02}, // -
{0x35EC, 0x27}, // -
{0x35EE, 0x8D}, // -
{0x35F0, 0x8D}, // -
{0x35F2, 0x29}, // -
{0x36BC, 0x0C}, // -
{0x36CC, 0x53}, // -
{0x36CD, 0x00}, // -
{0x36CE, 0x3C}, // -
{0x36D0, 0x8C}, // -
{0x36D1, 0x00}, // -
{0x36D2, 0x71}, // -
{0x36D4, 0x3C}, // -
{0x36D6, 0x53}, // -
{0x36D7, 0x00}, // -
{0x36D8, 0x71}, // -
{0x36DA, 0x8C}, // -
{0x36DB, 0x00}, // -
{0x3701, 0x00}, // ADBIT1[7:0]
{0x3720, 0x00}, // -
{0x3724, 0x02}, // -
{0x3726, 0x02}, // -
{0x3732, 0x02}, // -
{0x3734, 0x03}, // -
{0x3736, 0x03}, // -
{0x3742, 0x03}, // -
{0x3862, 0xE0}, // -
{0x38CC, 0x30}, // -
{0x38CD, 0x2F}, // -
{0x395C, 0x0C}, // -
{0x39A4, 0x07}, // -
{0x39A8, 0x32}, // -
{0x39AA, 0x32}, // -
{0x39AC, 0x32}, // -
{0x39AE, 0x32}, // -
{0x39B0, 0x32}, // -
{0x39B2, 0x2F}, // -
{0x39B4, 0x2D}, // -
{0x39B6, 0x28}, // -
{0x39B8, 0x30}, // -
{0x39BA, 0x30}, // -
{0x39BC, 0x30}, // -
{0x39BE, 0x30}, // -
{0x39C0, 0x30}, // -
{0x39C2, 0x2E}, // -
{0x39C4, 0x2B}, // -
{0x39C6, 0x25}, // -
{0x3A42, 0xD1}, // -
{0x3A4C, 0x77}, // -
{0x3AE0, 0x02}, // -
{0x3AEC, 0x0C}, // -
{0x3B00, 0x2E}, // -
{0x3B06, 0x29}, // -
{0x3B98, 0x25}, // -
{0x3B99, 0x21}, // -
{0x3B9B, 0x13}, // -
{0x3B9C, 0x13}, // -
{0x3B9D, 0x13}, // -
{0x3B9E, 0x13}, // -
{0x3BA1, 0x00}, // -
{0x3BA2, 0x06}, // -
{0x3BA3, 0x0B}, // -
{0x3BA4, 0x10}, // -
{0x3BA5, 0x14}, // -
{0x3BA6, 0x18}, // -
{0x3BA7, 0x1A}, // -
{0x3BA8, 0x1A}, // -
{0x3BA9, 0x1A}, // -
{0x3BAC, 0xED}, // -
{0x3BAD, 0x01}, // -
{0x3BAE, 0xF6}, // -
{0x3BAF, 0x02}, // -
{0x3BB0, 0xA2}, // -
{0x3BB1, 0x03}, // -
{0x3BB2, 0xE0}, // -
{0x3BB3, 0x03}, // -
{0x3BB4, 0xE0}, // -
{0x3BB5, 0x03}, // -
{0x3BB6, 0xE0}, // -
{0x3BB7, 0x03}, // -
{0x3BB8, 0xE0}, // -
{0x3BBA, 0xE0}, // -
{0x3BBC, 0xDA}, // -
{0x3BBE, 0x88}, // -
{0x3BC0, 0x44}, // -
{0x3BC2, 0x7B}, // -
{0x3BC4, 0xA2}, // -
{0x3BC8, 0xBD}, // -
{0x3BCA, 0xBD}, // -
{0x4004, 0x48}, // TXCLKESC_FREQ[15:0]
{0x4005, 0x09}, //
{0x400C, 0x00}, // INCKSEL6
{0x4018, 0x7F}, // TCLKPOST[15:0]
{0x401A, 0x37}, // TCLKPREPARE[15:0]
{0x401C, 0x37}, // TCLKTRAIL[15:0]
{0x401E, 0xF7}, // TCLKZERO[15:0]
{0x401F, 0x00}, //
{0x4020, 0x3F}, // THSPREPARE[15:0]
{0x4022, 0x6F}, // THSZERO[15:0]
{0x4024, 0x3F}, // THSTRAIL[15:0]
{0x4026, 0x5F}, // THSEXIT[15:0]
{0x4028, 0x2F}, // TLPX[15:0]
{0x4074, 0x01}, // INCKSEL7 [2:0]
{REG_NULL, 0x00},
};
static const struct imx415_mode supported_modes[] = {
/*
* frame rate = 1 / (Vtt * 1H) = 1 / (VMAX * 1H)
* VMAX >= (PIX_VWIDTH / 2) + 46 = height + 46
*/
{
.bus_fmt = MEDIA_BUS_FMT_SGBRG10_1X10,
.width = 1920,
.height = 1080,
.max_fps = {
.numerator = 10000,
.denominator = 600000,
},
.exp_def = 0x08ca - 0x08,
.hts_def = 0x0226 * IMX415_4LANES * 2,
.vts_def = 0x08ca,
.global_reg_list = imx415_global_10bit_3864x2192_regs,
.reg_list = imx415_linear_10bit_1920x1080_891M_regs,
.hdr_mode = NO_HDR,
.mipi_freq_idx = 1,
.bpp = 10,
.vc[PAD0] = 0,
.xvclk = IMX415_XVCLK_FREQ_37M,
},
};
Code: Select all
csi_unite=$(( $(luckfox-config get_csi_unite) ))
if [ -z csi_unite ]; then
csi_unite=0
fi
if lsmod | grep 'imx415' | awk '{print $3}' | grep -w 1; then
if [ $csi_unite == "0" ]; then
luckfox-config set_csi_unite 1
echo "[rkipc] Set rockchip,unite to 1; rkipc requires a reboot to function properly."
return
fi
else
if [ $csi_unite == "1" ]; then
luckfox-config set_csi_unite 0
echo "[rkipc] Set rockchip,unite to 0; rkipc requires a reboot to function properly."
return
fi
fi
Hi Crocodile,
Thanks a lot for your help. By editing the ./sysdrv/source/kernel/drivers/media/i2c/imx415.c and ./project/app/rkipc/rkipc/src/rv1106_ipc/RkLunch.sh and building the new image, I was able to get close to 1080p@30FPS.
I also had to update /userdata/rkipc.ini and change the resolution and FPS to achieve 1080p@30FPS.
The driver code you shared has this:
So I am assuming it is capable of 1920x1080@60 FPS. In my tests, it always defaults to 30FPS:
ffprobe -v error -select_streams v:0 -show_entries stream
=codec_name,width,height,avg_frame_rate,r_frame_rate,nb_frames -of default=nopri
nt_wrappers=1 /userdata/video0/20240101000107.mp4
codec_name=hevc
width=1920
height=1080
r_frame_rate=30/1
avg_frame_rate=30/1
nb_frames=296
These are the settings I have kept in my /userdata/rkipc.ini:
I know this is a bit greedy but do you have any additional tips/pointers to help achieve 1080p@60FPS? Is this even possible to achieve on the Luckfox Pico Zero?
Thanks a lot for the help!
Thanks a lot for your help. By editing the ./sysdrv/source/kernel/drivers/media/i2c/imx415.c and ./project/app/rkipc/rkipc/src/rv1106_ipc/RkLunch.sh and building the new image, I was able to get close to 1080p@30FPS.
I also had to update /userdata/rkipc.ini and change the resolution and FPS to achieve 1080p@30FPS.
The driver code you shared has this:
Code: Select all
{
.bus_fmt = MEDIA_BUS_FMT_SGBRG10_1X10,
.width = 1920,
.height = 1080,
.max_fps = {
.numerator = 10000,
.denominator = 600000,
},ffprobe -v error -select_streams v:0 -show_entries stream
=codec_name,width,height,avg_frame_rate,r_frame_rate,nb_frames -of default=nopri
nt_wrappers=1 /userdata/video0/20240101000107.mp4
codec_name=hevc
width=1920
height=1080
r_frame_rate=30/1
avg_frame_rate=30/1
nb_frames=296
These are the settings I have kept in my /userdata/rkipc.ini:
Code: Select all
[audio.0]
enable = 0
card_name = default
encode_type = G711A
format = S16
sample_rate = 16000
channels = 2
frame_size = 1152
bit_rate = 32000
input = mic_in
volume = 50
[video.source]
enable_aiq = 1
enable_vo = 0
vo_dev_id = 3 ; 0 is mipi, 3 is hdmi
enable_ivs = 1
enable_jpeg = 0
enable_venc_0 = 1
enable_venc_1 = 0
enable_venc_2 = 0
enable_npu = 0
npu_fps = 10
enable_rtsp = 0
enable_rtmp = 0
[video.0]
buffer_size = 1036800
buffer_count = 4
enable_refer_buffer_share = 1
stream_type = mainStream
video_type = compositeStream
max_width = 1920
max_height = 1080
width = 1920
height = 1080
rc_mode = VBR
rc_quality = high
src_frame_rate_den = 1
src_frame_rate_num = 60
dst_frame_rate_den = 1
dst_frame_rate_num = 60
target_rate = 8192
max_rate = 16384
min_rate = 0
output_data_type = H.265
smart = close
h264_profile = high
gop = 30
smartp_viridrlen = 25
gop_mode = normalP
stream_smooth = 50
[ivs]
smear = 0
weightp = 0
md = 0
od = 0
md_sensibility = 3 ;available: 1 2 3,max 3
[isp.0.adjustment]
contrast = 50
brightness = 50
saturation = 50
sharpness = 50
fps = 60
hue = 50
[isp.0.video_adjustment]
image_flip = close
scene_mode = indoor
power_line_frequency_mode = NTSC(60HZ)
[storage.0]
enable = 1
folder_name = video0
file_format = mp4 ; flv,ts
file_duration = 10
video_quota = 30
Thanks a lot for the help!

