This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ipnc的arm侧如何保存encode以后的bits文件?

开发平台:DM8127+ipnc3.5

现在想把h264压缩后的bits在arm侧保存,然后上传到上位机进行解码。为了实现此想法,首先是在  ipcBitsInLink中配置如下

    ipcBitsInHostPrm->cbCtx                                     = &gVencModuleContext;
    ipcBitsInHostPrm->cbFxn                                     = App_ipcBitsInCbFxn;

然后在

/opt/ipnc/Source/ipnc_rdk/ipnc_mcfw/demos/mcfw_api_demos/multich_usecase/ti_mcfw_ipcbits.c

中的App_ipcBitsInit()打开文件保存。

Int32 App_ipcBitsInit()
{
    //modified by qiu
    //gApp_ipcBitsCtrl.fObj.enableFWrite = FALSE;
    gApp_ipcBitsCtrl.fObj.enableFWrite = TRUE;
}

运行软件,可以看到在文件系统中有以下文件,但是文件大小为0

drwxr-sr-x 2 root 3355 4096 8月   7 17:35 ./
drwxrwsrwx 4 qiu  3355 4096 8月   7 16:48 ../
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_0.bin
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_0.bin.mv
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_1.bin
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_1.bin.mv
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_2.bin
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_2.bin.mv
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_0.bin
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_1.bin
-rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_2.bin
这是为什么呢?

跟踪ti_mcfw_ipcbits.c中的函数App_streamSysVidWrite()发现
Int App_streamSysVidWrite(UInt32 chId, UInt32 codecType, Void * pEncodeBuffer,
Int32 frameSize, Int32 frameType, UInt32 timestamp,
UInt32 temporalId)
{
if (writeEnable == TRUE)
{
stream_write(pEncodeBuffer, // pAddr
frameSize, // size
frameType, // frame_type
streamType, // stream_type
AUDIO_GetTimeStamp(), // timestamp
temporalId, // temporalId
stream_get_handle()); // pParm
}
}
这里面stream_get_handle()获取的文件指针不是前面App_ipcBitsOpenFileHandles()打开的文件指针。
那么,bits文件流保存到哪里去了呢?
谢谢指教!

  • 你好, IPNC RDK的代码可以把编码后的jpeg存在sd上。你有参考过相关代码么?

  • 谢谢您的回复!我查看了PNC RDK把编码后的jpeg存在sd上的代码。

    您的意思是,以下的h264文件需要自己参考jpeg保存代码来实现写h264文件?

    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_0.bin
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_0.bin.mv
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_1.bin
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_1.bin.mv
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_2.bin
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_DATA_2.bin.mv
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_0.bin
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_1.bin
    -rw-r--r-- 1 root 3355    0 8月   9 09:19 VBITS_HDR_2.bin

  • 你好;
    demo 里面可以直接保存 h264 的编码流;
    参考:Source/ipnc_rdk/ipnc_mcfw/demos/mcfw_api_demos/multich_usecase/ti_mcfw_ipcbits.c
    文件中的 static Void *App_ipcBitsRecvStreamFxn(Void * prm) 这个函数你 debug 一下;
    ipcbit 数据在这里可以获取,h264 的帧视频流;
  • 好的,谢谢您!