baidu 发表于 2021-7-14 17:26:05

原生wiki+ 原生刷机包 不匹配导致camera无法运行如下demo ,请问官方内部验证过了吗?

原生wiki+ 原生刷机包 不匹配导致camera无法运行如下demo ,请问内部验证过了吗?

# wiki demo 链接:
https://wiki.t-firefly.com/zh_CN/CORE-1126-JD4/Rkmedia.html#ju-ti-shi-li
# 刷机包是官方如下最新包:AIO-RV1126_RV1109-JD4_2021_0709_1611

# 执行如下程序:
VI->GetFrame
该开发流程对应的 DEMO 示例为 rkmedia_vi_get_frame_test.c

说明:设备输入保存至文件。演示 VI 没有 Bind 时如何取视频流。

快速使用:

#从摄像头节点 rkispp_scale0 抓取 10 帧图片并保存为 1080p.nv12 文件
./rkmedia_vi_get_frame_test-a /oem/etc/iqfiles/ -w 1920 -h 1080 -d rkispp_scale0 -o /tmp/1080p.nv12 -c 10

# 命令录取 10 帧图像数据,截取最后一帧来预览
# 使用 dd 跳过前 9 帧数据,得到最后一帧。3110400 = 1920 x 1080 x 3 / 2 一帧 NV12 数据大小
dd if=1080p.nv12 of=1080pl.nv12 bs=3110400 skip=9
# 使用 ffmpeg 把 NV12 图像转换为 PNG 格式。
fmpeg -y -f rawvideo -pix_fmt nv12 -ss 00:01 -r 1 -s 1920x1080 -i 1080pl.nv12 -frames:v 1 output.png
# 打开 output.png 预览。


----

# 报如下错误:
```
# ./rkmedia_vi_get_frame_test -a /oem/etc/iqfil
es/ -w 1920 -h 1080 -d rkispp_scale0 -o /tmp/1080p.nv12 -c 10
media get entity by name: rkcif-lvds-subdev is null
media get entity by name: rkcif-lite-lvds-subdev is null
media get entity by name: rkisp-mpfbc-subdev is null
media get entity by name: rkisp_dmapath is null
media get entity by name: rockchip-mipi-dphy-rx is null
Rga built version:1.04 9286b22+2021-07-12 04:18:21
#####Device: rkispp_scale0
#####Resolution: 1920x1080
#####Frame Count to save: 10
#####Output Path: /tmp/1080p.nv12
#CameraIdx: 0

#####Aiq xml dirpath: /oem/etc/iqfiles/

#bMultictx: 0

ID: 0, sensor_name is m01_f_os04a10 1-0036, iqfiles is /oem/etc/iqfiles/
:XCAM ERROR v4l2_device.cpp:657: device(/dev/video15) start failed
:XCAM ERROR CamHwIsp20.cpp:3068: prepare isp params dev err: -9

Segmentation fault (core dumped)
#
```

baidu 发表于 2021-7-14 17:37:14


# grep '' /sys/class/video4linux/video*/name
/sys/class/video4linux/video0/name:stream_cif_mipi_id0
/sys/class/video4linux/video1/name:stream_cif_mipi_id1
/sys/class/video4linux/video10/name:rkisp_rawwr3
/sys/class/video4linux/video11/name:rkisp_rawrd0_m
/sys/class/video4linux/video12/name:rkisp_rawrd2_s
/sys/class/video4linux/video13/name:rkisp_rawrd1_l
/sys/class/video4linux/video14/name:rkisp-statistics
/sys/class/video4linux/video15/name:rkisp-input-params
/sys/class/video4linux/video16/name:rkisp-mipi-luma
/sys/class/video4linux/video17/name:rkispp_input_image
/sys/class/video4linux/video18/name:rkispp_m_bypass
/sys/class/video4linux/video19/name:rkispp_scale0
/sys/class/video4linux/video2/name:stream_cif_mipi_id2
/sys/class/video4linux/video20/name:rkispp_scale1
/sys/class/video4linux/video21/name:rkispp_scale2
/sys/class/video4linux/video22/name:rkispp_iqtool
/sys/class/video4linux/video23/name:rkispp_input_params
/sys/class/video4linux/video24/name:rkispp-stats
/sys/class/video4linux/video3/name:stream_cif_mipi_id3
/sys/class/video4linux/video4/name:rkcif-mipi-luma
/sys/class/video4linux/video5/name:rkisp_mainpath
/sys/class/video4linux/video6/name:rkisp_selfpath
/sys/class/video4linux/video7/name:rkisp_rawwr0
/sys/class/video4linux/video8/name:rkisp_rawwr1
/sys/class/video4linux/video9/name:rkisp_rawwr2

板蓝根 发表于 2021-7-15 09:07:27

本帖最后由 板蓝根 于 2021-7-15 09:16 编辑

你有接 mipi 摄像头吗?
有 kernel log 吗?
自己用哪个仓库编译的?
固件本身就有自带有 rkmedia_vi_get_frame_test 二进制可执行文件,跑过吗?对比过吗?

baidu 发表于 2021-7-15 09:36:45

板蓝根 发表于 2021-7-15 09:07
你有接 mipi 摄像头吗?
有 kernel log 吗?
自己用哪个仓库编译的?


谢谢版主回复.

你有接 mipi 摄像头吗? ==> firefly官方的os04a10 模组, 用vlc可以正常推流预览.
有 kernel log 吗?==> 有,我想办法上传一下log,稍等.
自己用哪个仓库编译的? ==> 我既用官方的烧录包AIO-RV1126_RV1109-JD4_2021_0709_1611测试,也用./build.sh aio-rv1126-jd4.mk 自己build, 结果一样.
固件本身就有自带有rkmedia_vi_get_frame_test 二进制可执行文件,跑过吗?对比过吗?==> 我就是用的固件本身的这个bin文件测试的.



baidu 发表于 2021-7-15 09:39:47

kernel log 见附件.

亦可以看如下文字版本<文字版本log 无法上传,说有不良信息@@>.
########################


板蓝根 发表于 2021-7-15 09:42:14

本帖最后由 板蓝根 于 2021-7-15 09:44 编辑

你 vlc 能预览的话,那你跑的时候没有把应用关掉吗?关掉应该不能预览。cd /oem/;./Rklaunch-stop.sh; 如果不关掉会把摄像头占用的

baidu 发表于 2021-7-15 09:56:38

1. 从kernellog 看, 虽然中间有丢log, 但camerasensor id 是读到了, 因为我这边已经能正常vlc preview了.

2. 从执行命令后error信息看,不管 -d 指定rkispp_scale0 还是其他entire, 都报错在video15 对应rkisp-input-params, 打开失败.
# ./rkmedia_vi_get_frame_test -a /oem/etc/iqfiles/ -w 1920 -h 1080 -d rkispp_scale0 -o /tmp/1080p.nv12 -c 10

:XCAM ERROR v4l2_device.cpp:657: device(/dev/video15) start failed

我的设备Core-1126-JD4 video15 对应rkisp-input-params
/sys/class/video4linux/video15/name:rkisp-input-params

3. 结论: 因为用的都是官方默认的固件, 程序, 摄像头, evb, 所有我怀疑是否此程序目前不兼容AIO-RV1126_RV1109-JD4_2021_0709_1611

故:
是否如下wik有值得完善的地方<分析不当的地方, 辛苦版主指正>?
https://wiki.t-firefly.com/zh_CN/CAM-C11262U/Rkmedia.html#vi-getframe

板蓝根 发表于 2021-7-15 10:16:27

本帖最后由 板蓝根 于 2021-7-15 10:18 编辑

1. 你所说的 vlc 可以预览,rtsp 推流的前一步骤取流和编码都是由 rkmedia 完成的,而你所用的系统自带的 rkmedia_vi_get_frame_test 是用同一个库编译出来的,所以 vlc 预览没有问题这个 demo 就不可能有问题。


2.你有根据 5 楼所说的验证过吗?
       cd /oem/;./Rklaunch-stop.sh; 如果不关掉会把摄像头占用的
       cd /oem/;./Rklaunch-stop.sh; 如果不关掉会把摄像头占用的
       cd /oem/;./Rklaunch-stop.sh; 如果不关掉会把摄像头占用的
       cd /oem/;./Rklaunch-stop.sh; 如果不关掉会把摄像头占用的

3. AIO-RV1126_RV1109-JD4_2021_0709_1611 这个固件我已经反复验证过无数次了,根据你的反馈我又去再验证了一次没有问题。
# cat /proc/version
Linux version 4.19.111 (daijh@tchip14) (rv1126_rv1109_linux_20210621.xml) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05)) #1 SMP PREEMPT Thu Jul 8 17:38:26 CST 2021
# rkmedia_vi_get_frame_test-a /oem/etc/iqfiles/ -w 1920 -h 1080 -d rkispp_scale0 -o /tmp/1080p.nv12 -c 10
media get entity by name: rkcif-lvds-subdev is null
media get entity by name: rkcif-lite-lvds-subdev is null
media get entity by name: rkisp-mpfbc-subdev is null
media get entity by name: rkisp_dmapath is null
media get entity by name: rockchip-mipi-dphy-rx is null
Rga built version:1.04 a83a665+2021-07-08 18:03:28
#####Device: rkispp_scale0
#####Resolution: 1920x1080
#####Frame Count to save: 10
#####Output Path: /tmp/1080p.nv12
#CameraIdx: 0

#####Aiq xml dirpath: /oem/etc/iqfiles/

#bMultictx: 0

ID: 0, sensor_name is m01_f_os04a10 1-0036, iqfiles is /oem/etc/iqfiles/
rk_aiq_uapi_sysctl_init/prepare succeed
rk_aiq_uapi_sysctl_start succeed
SAMPLE_COMM_ISP_SetFrameRate start 30
SAMPLE_COMM_ISP_SetFrameRate 30
##RKMEDIA Log level: 2
:text is all=2
:module is all, log_level is 2
:RK_MPI_VI_EnableChn: Enable VI:rkispp_scale0, 1920x1080 Start...
:RKAIQ: parsing /dev/media0
media get entity by name: rkcif-lvds-subdev is null
media get entity by name: rkcif-lite-lvds-subdev is null
:RKAIQ: parsing /dev/media1
media get entity by name: rkisp-mpfbc-subdev is null
media get entity by name: rkisp_dmapath is null
media get entity by name: rockchip-mipi-dphy-rx is null
:RKAIQ: model(rkisp0): isp_info(0): isp-subdev entity name: /dev/v4l-subdev5
:RKAIQ: parsing /dev/media2
:RKAIQ: model(rkispp0): ispp_info(0): ispp-subdev entity name: /dev/v4l-subdev0
:#V4l2Stream: camraID:0, Device:rkispp_scale0
:camera_id: 0, chn: rkispp_scale0
:camera_id: 0, chn: rkispp_scale0, idx: 0
:#V4l2Stream: camera id:0, VideoNode:/dev/video19
Using mplane plugin for capture
:#V4L2Ctx: open /dev/video19, fd 92
:RK_MPI_VI_EnableChn: Enable VI:rkispp_scale0, 1920x1080 End...
main initial finish
Get Frame:ptr:0x97225000, fd:93, size:3110400, mode:9, channel:0, timestamp:456717214, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-0 to /tmp/1080p.nv12
Get Frame:ptr:0x96f28000, fd:94, size:3110400, mode:9, channel:0, timestamp:456750243, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-1 to /tmp/1080p.nv12
Get Frame:ptr:0x96c2b000, fd:95, size:3110400, mode:9, channel:0, timestamp:456783336, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-2 to /tmp/1080p.nv12
Get Frame:ptr:0x97225000, fd:93, size:3110400, mode:9, channel:0, timestamp:456816301, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-3 to /tmp/1080p.nv12
Get Frame:ptr:0x96f28000, fd:94, size:3110400, mode:9, channel:0, timestamp:456849648, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-4 to /tmp/1080p.nv12
Get Frame:ptr:0x96c2b000, fd:95, size:3110400, mode:9, channel:0, timestamp:456882994, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-5 to /tmp/1080p.nv12
Get Frame:ptr:0x97225000, fd:93, size:3110400, mode:9, channel:0, timestamp:456916337, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-6 to /tmp/1080p.nv12
Get Frame:ptr:0x96f28000, fd:94, size:3110400, mode:9, channel:0, timestamp:456949865, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-7 to /tmp/1080p.nv12
Get Frame:ptr:0x96c2b000, fd:95, size:3110400, mode:9, channel:0, timestamp:456983022, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-8 to /tmp/1080p.nv12
Get Frame:ptr:0x97225000, fd:93, size:3110400, mode:9, channel:0, timestamp:457016437, ImgInfo:<wxh 1920x1080, fmt 0x4>
#Save frame-9 to /tmp/1080p.nv12
:Mode:Chn drop buffer, Please get buffer in time!
:RK_MPI_VI_DisableChn: Disable VI:rkispp_scale0, 1920x1080 Start...
:#SourceStreamFlow: stream off....
libv4l2: error dequeuing buf: Invalid argument
:rkispp_scale0, ioctl(VIDIOC_DQBUF): Invalid argument
:#SourceStreamFlow: read thread exit sucessfully!
:#V4L2Ctx: close , fd 92
:#V4L2Stream: v4l2 ctx reset to nullptr!
:#SourceStreamFlow: stream reset sucessfully!
:SourceFlow:v4l2_capture_stream quit
:RK_MPI_VI_DisableChn: Disable VI:rkispp_scale0, 1920x1080 End...
rk_aiq_uapi_sysctl_stop enter
rk_aiq_uapi_sysctl_deinit enter
rk_aiq_uapi_sysctl_deinit exit
main exit!
#





baidu 发表于 2021-7-15 12:35:59

板蓝根 发表于 2021-7-15 10:16
1. 你所说的 vlc 可以预览,rtsp 推流的前一步骤取流和编码都是由 rkmedia 完成的,而你所用的系统自带的 r ...

谢谢版主认真负责的工作态度, 给您点赞!

按照您post的步骤, step by step 成功了.
但我依旧通过如下步骤复现我提到的问题, 从而确认是Rklaunch 占用了摄像头. 这种问题以您的经验是如何快速确认的呢, 如何知道sensor 被占用了?
step1. reboot.
step2. vlc 推流验证成功,关闭vlc.
step3. 执行rkmedia_vi_get_frame_test...那串命令, 复现问题,输出error 信息和#1楼一致.
step4. 参考您的操作, ./RkLunch-stop.sh 后重新执行step3, 成功运行.

板蓝根 发表于 2021-7-15 12:57:44

rkmedia vi 同个通道只能被初始化调用一次,你 vlc 可以预览那么,这个通道肯定被占用了,无论是什么应用调用肯定回报错的
页: [1]
查看完整版本: 原生wiki+ 原生刷机包 不匹配导致camera无法运行如下demo ,请问官方内部验证过了吗?