這篇文章簡(jiǎn)單記錄一下RK平臺(tái)基于V4L2框架camera調(diào)試過(guò)程中常用的一些命令:
(1)查看拓?fù)浣Y(jié)構(gòu):查看media0的pipeline
media-ctl -p -d /dev/media0
(2)抓數(shù)據(jù)流命令:
對(duì)video0節(jié)點(diǎn),設(shè)置格式為NV12,分辨率為1920x1080,不裁剪,4個(gè)buf輪轉(zhuǎn),--verbose的作用是刷出幀率。
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop, flags=0,top=0,left=0,width=1920,height=1080
(3)抓圖命令:
類(lèi)似上面的,將圖像保存到文件,加了--stream-poll的參數(shù),如果抓不到數(shù)據(jù)會(huì)返回錯(cuò)誤
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=3 --stream-skip=4 --stream-to=/data/1920x1080_nv12.yuv --stream-count=5 --stream-poll
(4)設(shè)置節(jié)點(diǎn)格式:
參考如下,設(shè)置ISP的rkisp1-isp-subdev節(jié)點(diǎn)的分辨率和圖像格式、裁減信息等
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":0[fmt:UYVY2X8/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":0[crop:(0,0)/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":2[fmt:UYVY2X8/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":2[crop:(0,0)/1920x1080]'
(5)配置數(shù)據(jù)鏈路
將節(jié)點(diǎn)m01_f_ov13855 7-0010的pad0和rockchip-csi2-dphy1的pad0連接文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-438459.html
media-ctl -d /dev/media1 -l '"m01_f_ov13855 7-0010":0->"rockchip-csi2-dphy1":0[1]'
(6)設(shè)置曝光增益:
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl 'exposure=1216,analogue_gain=10'
(7)查看節(jié)點(diǎn)具體信息
v4l2-ctl -d /dev/video0 -D
v4l2-ctl -d /dev/video11 --all
(8)獲取格式:會(huì)調(diào)用驅(qū)動(dòng)的G_FMT
v4l2-ctl -d /dev/video0 --get-fmt-video
v4l2-ctl -d /dev/v4l-subdev2 --get-subdev-fmt
(9)獲取幀率
v4l2-ctl -d /dev/v4l-subdev2 --get-subdev-fps
(10)查看節(jié)點(diǎn)支持的分辨率和格式
v4l2-ctl -d /dev/video0 --list-formats-ext
(11)查詢事件變化:
例如查詢分辨率變化事件和5V 的拔插事件,wait-for是等待一次時(shí)間,poll-for一直等待事件文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-438459.html
v4l2-ctl -d /dev/v4l-subdev2 --wait-for-event=source_change=0
v4l2-ctl -d /dev/v4l-subdev2 --poll-for-event=source_change=0
v4l2-ctl -d /dev/v4l-subdev2 --wait-for-event=ctrl=power_present
v4l2-ctl -d /dev/v4l-subdev2 --poll-for-event=ctrl=power_present
(12)移動(dòng)馬達(dá)動(dòng)作
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl 'focus_absolute=64'
到了這里,關(guān)于V4L2常用調(diào)試命令的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!