您尚未登录。

楼主 # 2024-05-27 00:00:34

qingyue.mo
会员
注册时间: 2024-05-26
已发帖子: 3
积分: 33

V3S 硬件H264编码

按照 论坛unturned3 大佬给的包 去做  提示

CAM_V2P_IOCTL: Inappropriate ioctl for device

我使用的也是DVP 的 OV5640

我是不是没装什么库

大佬代码 cam.c这段

// dirty hack to get physical address of buffers
// see github repo README for details
perror_ret(ioctl(fd, CAM_V2P_IOCTL, &addr), "CAM_V2P_IOCTL");
出现了这个东西
CAM_V2P_IOCTL: Inappropriate ioctl for device
大佬说的要获取物理地址 这个无法操作啊

有人遇到过吗 是少了什么么

copy_video.sh   fswebcam.sh     h264enc_demo    kern_update.sh
# ./h264enc_demo 640 480 30 300
Info: DLOG_LEVEL changed to 1
debug  : ionAlloc <__GetIonMemOpsS:985>:*** get __GetIonMemOpsS ***
debug  : ionAlloc <ion_alloc_open:134>:begin ion_alloc_open

debug  : cedarc <VeSetSpeed:1559>: *** set ve freq to 360 Mhz ***
debug  : cedarc <VeInitialize:1198>: ve init ok

debug  : ionAlloc <ion_alloc_open:175>:** phy offset = 40000000
debug  : cedarc <VeRelease:1253>: ve release ok

debug  : cedarc <LogVersionInfo:40>:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Cedar Codec <<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag   : createBranch_customize_sylix
branch: CedarC-v1.1.9
commit: 4a182bd42c931bea2f77b0ff9a531d233df8541e
date  : Thu May 25 15:34:03 2017 +0800
author: jenkins8080
patch :
----------------------------------------------------------------------

debug  : cedarc <VeSetSpeed:1559>: *** set ve freq to 360 Mhz ***
debug  : cedarc <VeInitialize:1198>: ve init ok

debug  : ionAlloc <__GetIonMemOpsS:985>:*** get __GetIonMemOpsS ***
debug  : ionAlloc <ion_alloc_open:134>:begin ion_alloc_open

debug  : cedarc <VideoEncInit:195>: (f:VideoEncInit, l:195)
debug  : cedarc <VideoEncInit:210>: (f:VideoEncInit, l:210)
debug  : cedarc <BitStreamCreate:102>: BitStreamCreate OK
Info: h264 encoder init OK
Debug: 2 media entities detected
CAMEAR_IC: name  sun6i-csi: subdev entity id = -1
CAMEAR_IC: name  ov5640 1-003c: subdev entity id = -1
Debug: ov5640 1-003c: subdev entity id = 5
Debug: ov5640 1-003c: subdev pad = 0
Info: ov5640 1-003c: subdev format set to: 640x480, media bus format code = 0x20                               06
Info: ov5640 1-003c: frame rate: requested for 30; image sensor accepted 30
CAM_V2P_IOCTL: Inappropriate ioctl for device
Error: cam_init() failed
debug  : cedarc <VeRelease:1253>: ve release ok

离线

#1 2024-05-27 12:16:07

4610
会员
注册时间: 2022-10-09
已发帖子: 91
积分: 77

Re: V3S 硬件H264编码

找物理地址映射直接查/proc/self/pagemap

或者先写个特征值在物理地址空间里逐页找都行

离线

#2 2024-06-07 00:08:38

unturned3
会员
注册时间: 2020-07-01
已发帖子: 265
积分: 303

Re: V3S 硬件H264编码

你用我配套的buildroot了吗?我那里头有相关的内核补丁,没用补丁的话估计会导致 CAM_V2P_IOCTL: Inappropriate ioctl for device

离线

#3 2024-06-07 00:11:28

unturned3
会员
注册时间: 2020-07-01
已发帖子: 265
积分: 303

Re: V3S 硬件H264编码

离线

楼主 #4 2024-06-08 21:31:04

qingyue.mo
会员
注册时间: 2024-05-26
已发帖子: 3
积分: 33

Re: V3S 硬件H264编码

万幸 前几天抱着姐姐睡觉 在梦里成功编码了  回来后按照梦里的指示   修改了 sun6i_video.c    成功实现了编码 

可能我是5.2.y 配置文件无法完全适配  最后掉坑里了  只能复制粘贴地改

虽然成功了  但出现个新问题  OV5640   1920 1080  15帧  编码是看得到画面的   

但当我
# ./f264 1920 1080 30 60

Info: captured 60 frames in 2.01s; FPS = 29.8
debug  : cedarc <VeRelease:1253>: ve release ok

30帧  是带有绿色的花屏画面
按照你的代码 里的提示   也是无法解决这个问题
        // This ALIGN_16B thing is wrong?
        // At 1920x1080, this will screw up the data alignment and create a green band in video
        if(width==1920)
        {
         buffers[l].addrVirC = buffers[l].start + ALIGN_16B(g_width) * ALIGN_16B(g_height);
        }else
        {
        buffers[l].addrVirC = buffers[l].start + g_width * g_height;
        }
       
        int addr = buf.m.offset;

        // dirty hack to get physical address of buffers
        // see github repo README for details
        perror_ret(ioctl(fd, CAM_V2P_IOCTL, &addr), "CAM_V2P_IOCTL");

        buffers[l].addrPhyY = (void *) addr;

        if(width==1920)
        {
          buffers[l].addrPhyC = (void *) ( addr + ALIGN_16B(g_width) * ALIGN_16B(g_height) );
        }else
        {
         buffers[l].addrPhyC = (void *) (addr + g_width * g_height);
        }




Info: captured 60 frames in 23.73s; FPS = 2.5
debug  : cedarc <VeRelease:1253>: ve release ok

效果如图
.png

这是编码后的视频截图

设置15帧的时候是:

2.png

图像下方好像有点问题  虽然不是很清晰 

我想知道 为什么30帧的时候  画成绿色  15帧就有一点正常  是不是 PCLK速度不够?

离线

楼主 #5 2024-06-09 22:13:18

qingyue.mo
会员
注册时间: 2024-05-26
已发帖子: 3
积分: 33

Re: V3S 硬件H264编码

今天尝试 大佬的 配置文件    1080P 能达到30帧了  但出现很严重的横纹 不知道这是什么产生的  3.png

离线

#6 2024-06-09 22:24:08

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,281
积分: 9197

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn