4755
- 收藏
- 点赞
- 分享
- 举报
Hi3559A读取YUV文件调用VENC进行H264编码,HI_MPI_VENC_SendFrame报错0xa0088003
Hi3559A读取YUV文件调用VENC进行H264编码,VB创建和通道创建都成功了,在调用HI_MPI_VENC_SendFrame函数时报错0xa0088003,/dev/logmpp日志输出以下内容:
[code]<3>[ venc] [Func]:AvcCheckPixelFormat [Line]:1379 [Info]:H.264 don't support format 25.
<3>[ venc] [Func]:VencCheckVideoInfo [Line]:1575 [Info]:Venc 0 : Sendinfo pic info err.[/code]
format 25应该是PIXEL_FORMAT_YVU_SEMIPLANAR_420,海思的SDK中明确说明VENC是支持Semi-planar YVU 4:2:0格式的<>,不知为何会报这个错。
YUV文件读取和发送给VNC的代码片段如下:
[code]未省略代码,出错后面的部分就不发了
HI_S32 SAMPLE_COMM_VENC_GetVencStreamProcEx(HI_VOID)
{
//...一些变量定义
/******************************************
step 1: check & prepare save-file & venc-fd
******************************************/
/* decide the stream file name, and open file to save stream */
/* Set Venc Fd. */
pFile1 = fopen("test.h264","wb+");
if(pFile1 == NULL)
{
printf("new test.h265 file failed\n");
return -1;
}
pFile2 = fopen("1080P.yuv","r+");
// pFile2 = fopen("1080P.yuv","r+");
if(pFile2 == NULL)
{
printf("open 1080P.yuv file failed\n");
return -1;
}
VencFd = HI_MPI_VENC_GetFd(VencChn);
if (VencFd < 0)
{
SAMPLE_PRT("HI_MPI_VENC_GetFd failed with %#x!\n",VencFd);
return -1;
}
VB_BLK handleY = VB_INVALID_HANDLE;
HI_U64 phyYaddr;
HI_U64 *pVirYaddr;
VIDEO_FRAME_INFO_S *pstFrame = malloc(sizeof(VIDEO_FRAME_INFO_S));
/******************************************
step 2: Start to get streams of each channel.
******************************************/
while (frame < 30)
{
/* 分配物理buffer并且映射到用户空间 */
do
{
handleY = HI_MPI_VB_GetBlock(VB_INVALID_POOLID, 1920 * 1080 * 3 / 2 , NULL);
if (VB_INVALID_HANDLE == handleY) {
SAMPLE_PRT("handleY is VB_INVALID_HANDLE\n");
}
}
while (VB_INVALID_HANDLE == handleY);
if( handleY == VB_INVALID_HANDLE)
{
printf("getblock for y failed\n");
return -1;
}
else {
printf("handleY is %d\n", handleY);
}
VB_POOL poolID = HI_MPI_VB_Handle2PoolId (handleY);//得到poolID
printf("pool ID = %d\n", poolID);
phyYaddr = HI_MPI_VB_Handle2PhysAddr(handleY);
if( phyYaddr == 0)
{
printf("HI_MPI_VB_Handle2PhysAddr for handleY failed\n");
return -1;
}
pVirYaddr = (HI_U64 *) HI_MPI_SYS_Mmap(phyYaddr, 1920 * 1080 * 3 / 2);
/* 图像帧结构初始化 */
memset(&(pstFrame->stVFrame),0x00,sizeof(VIDEO_FRAME_S));
pstFrame->stVFrame.u32Width = 1920;
pstFrame->stVFrame.u32Height = 1080;
pstFrame->stVFrame.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;//;
pstFrame->u32PoolId = poolID;
pstFrame->enModId = HI_ID_USER;
pstFrame->stVFrame.u64PhyAddr[0] = phyYaddr;
pstFrame->stVFrame.u64PhyAddr[1] = phyYaddr + 1920 * 1080;
pstFrame->stVFrame.u64VirAddr[0] = (HI_U64)(HI_UL)pVirYaddr;
pstFrame->stVFrame.u64VirAddr[1] = (HI_U64)(HI_UL)pVirYaddr + 1920 * 1080;
pstFrame->stVFrame.u32Stride[0] = 1920 ;
pstFrame->stVFrame.u32Stride[1] = 1920 ;
pstFrame->stVFrame.enField = VIDEO_FIELD_FRAME;
pstFrame->stVFrame.enCompressMode = COMPRESS_MODE_NONE;
pstFrame->stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
pstFrame->stVFrame.enDynamicRange = DYNAMIC_RANGE_SDR8;
pstFrame->stVFrame.enColorGamut = COLOR_GAMUT_BT709;
pstFrame->stVFrame.u64PTS = frame * 40;
pstFrame->stVFrame.u32TimeRef = frame * 2;
/* 从原始文件读取yuv420sp帧,然后调用给编码接口 */
s32Ret = fread(pVirYaddr,1920 * 1080 * 3 / 2, 1, pFile2);
if(s32Ret < 0)
{
printf("fread yuv420sp failed\n");
return -1;
}
else {
printf("Read 1 frame from file : length = %d\n", s32Ret);
}
getchar();
/* 开始发送读到的数据到编码接口 报错!*/
s32Ret = HI_MPI_VENC_SendFrame(VencChn, pstFrame, -1);[/code]
[code]<3>[ venc] [Func]:AvcCheckPixelFormat [Line]:1379 [Info]:H.264 don't support format 25.
<3>[ venc] [Func]:VencCheckVideoInfo [Line]:1575 [Info]:Venc 0 : Sendinfo pic info err.[/code]
format 25应该是PIXEL_FORMAT_YVU_SEMIPLANAR_420,海思的SDK中明确说明VENC是支持Semi-planar YVU 4:2:0格式的<
YUV文件读取和发送给VNC的代码片段如下:
[code]未省略代码,出错后面的部分就不发了
HI_S32 SAMPLE_COMM_VENC_GetVencStreamProcEx(HI_VOID)
{
//...一些变量定义
/******************************************
step 1: check & prepare save-file & venc-fd
******************************************/
/* decide the stream file name, and open file to save stream */
/* Set Venc Fd. */
pFile1 = fopen("test.h264","wb+");
if(pFile1 == NULL)
{
printf("new test.h265 file failed\n");
return -1;
}
pFile2 = fopen("1080P.yuv","r+");
// pFile2 = fopen("1080P.yuv","r+");
if(pFile2 == NULL)
{
printf("open 1080P.yuv file failed\n");
return -1;
}
VencFd = HI_MPI_VENC_GetFd(VencChn);
if (VencFd < 0)
{
SAMPLE_PRT("HI_MPI_VENC_GetFd failed with %#x!\n",VencFd);
return -1;
}
VB_BLK handleY = VB_INVALID_HANDLE;
HI_U64 phyYaddr;
HI_U64 *pVirYaddr;
VIDEO_FRAME_INFO_S *pstFrame = malloc(sizeof(VIDEO_FRAME_INFO_S));
/******************************************
step 2: Start to get streams of each channel.
******************************************/
while (frame < 30)
{
/* 分配物理buffer并且映射到用户空间 */
do
{
handleY = HI_MPI_VB_GetBlock(VB_INVALID_POOLID, 1920 * 1080 * 3 / 2 , NULL);
if (VB_INVALID_HANDLE == handleY) {
SAMPLE_PRT("handleY is VB_INVALID_HANDLE\n");
}
}
while (VB_INVALID_HANDLE == handleY);
if( handleY == VB_INVALID_HANDLE)
{
printf("getblock for y failed\n");
return -1;
}
else {
printf("handleY is %d\n", handleY);
}
VB_POOL poolID = HI_MPI_VB_Handle2PoolId (handleY);//得到poolID
printf("pool ID = %d\n", poolID);
phyYaddr = HI_MPI_VB_Handle2PhysAddr(handleY);
if( phyYaddr == 0)
{
printf("HI_MPI_VB_Handle2PhysAddr for handleY failed\n");
return -1;
}
pVirYaddr = (HI_U64 *) HI_MPI_SYS_Mmap(phyYaddr, 1920 * 1080 * 3 / 2);
/* 图像帧结构初始化 */
memset(&(pstFrame->stVFrame),0x00,sizeof(VIDEO_FRAME_S));
pstFrame->stVFrame.u32Width = 1920;
pstFrame->stVFrame.u32Height = 1080;
pstFrame->stVFrame.enPixelFormat = PIXEL_FORMAT_YVU_SEMIPLANAR_420;//;
pstFrame->u32PoolId = poolID;
pstFrame->enModId = HI_ID_USER;
pstFrame->stVFrame.u64PhyAddr[0] = phyYaddr;
pstFrame->stVFrame.u64PhyAddr[1] = phyYaddr + 1920 * 1080;
pstFrame->stVFrame.u64VirAddr[0] = (HI_U64)(HI_UL)pVirYaddr;
pstFrame->stVFrame.u64VirAddr[1] = (HI_U64)(HI_UL)pVirYaddr + 1920 * 1080;
pstFrame->stVFrame.u32Stride[0] = 1920 ;
pstFrame->stVFrame.u32Stride[1] = 1920 ;
pstFrame->stVFrame.enField = VIDEO_FIELD_FRAME;
pstFrame->stVFrame.enCompressMode = COMPRESS_MODE_NONE;
pstFrame->stVFrame.enVideoFormat = VIDEO_FORMAT_LINEAR;
pstFrame->stVFrame.enDynamicRange = DYNAMIC_RANGE_SDR8;
pstFrame->stVFrame.enColorGamut = COLOR_GAMUT_BT709;
pstFrame->stVFrame.u64PTS = frame * 40;
pstFrame->stVFrame.u32TimeRef = frame * 2;
/* 从原始文件读取yuv420sp帧,然后调用给编码接口 */
s32Ret = fread(pVirYaddr,1920 * 1080 * 3 / 2, 1, pFile2);
if(s32Ret < 0)
{
printf("fread yuv420sp failed\n");
return -1;
}
else {
printf("Read 1 frame from file : length = %d\n", s32Ret);
}
getchar();
/* 开始发送读到的数据到编码接口 报错!*/
s32Ret = HI_MPI_VENC_SendFrame(VencChn, pstFrame, -1);[/code]
我来回答
回答7个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2020-03-17 18:14:42
-
2019-08-30 09:57:03
-
2020-07-23 17:45:58
-
2017-09-20 15:05:29
-
2019-03-13 15:57:54
-
2023-12-06 19:25:35
-
2022-11-02 20:17:05
-
2016-10-26 11:55:21
-
2017-08-10 21:02:27
-
2018-11-19 08:53:29
-
2018-07-24 16:43:24
-
2016-09-10 09:35:34
-
2019-09-01 12:01:05
-
2020-10-29 11:14:15
-
2016-10-28 10:34:01
-
2016-09-20 16:15:23
-
2020-04-07 11:51:15
-
2016-06-23 09:48:58
-
2019-03-13 15:27:13
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
-
10求HI3519DV500_SDK_V2.0.1.1
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认