Hi all;
I use the encoder demo in "dvsdk_2_10_01_1->dvtb_4_10_03". I chave hanged the frame source to be come from a image sensor. I changed the colorspace of the result yuv image to be ColorSpace_YUV420PSEMI, And is encoded ok if i use mpeg4 encoder in every resolution.But when i use h264 encoder, it only succeeds in 640*480 or 720*480 resolution while int other resolution failed. why?Does any one has Any idea?thanks.the video code is as follow./****************************************************************************** * videoThrFxn ******************************************************************************/Void *videoThrFxn(Void *arg){ VideoEnv *envp = (VideoEnv *) arg; Void *status = THREAD_SUCCESS; VIDENC1_Params defaultParams = Venc1_Params_DEFAULT; VIDENC1_DynamicParams defaultDynParams = Venc1_DynamicParams_DEFAULT; Venc1_Handle hVe1 = NULL; Engine_Handle hEngine = NULL; BufTab_Handle hBufTab = NULL; Int frameCnt = 0; Buffer_Handle hCapBuf, hDstBuf; VIDENC1_Params *params; VIDENC1_DynamicParams *dynParams; Int fifoRet; Int bufIdx,i; //g_colorSpace is global and is set to be ColorSpace_YUV420PSEMI ColorSpace_Type colorSpace = g_colorSpace; Bool localBufferAlloc = FALSE; /* Open the codec engine */ hEngine = Engine_open(envp->engineName, NULL, NULL); if (hEngine == NULL) { printf("Failed to open codec engine %s\n", envp->engineName); cleanup(THREAD_FAILURE); } /* Use supplied params if any, otherwise use defaults */ //indeed we use the defaultparams params = envp->params ? envp->params : &defaultParams; dynParams = envp->dynParams ? envp->dynParams : &defaultDynParams; /* Set up codec parameters */ params->maxWidth = envp->imageWidth; params->maxHeight = envp->imageHeight; params->encodingPreset = XDM_HIGH_SPEED; if (colorSpace == ColorSpace_YUV420PSEMI) { params->inputChromaFormat =XDM_YUV_420SP; } else { params->inputChromaFormat = XDM_YUV_422ILE; } params->reconChromaFormat = XDM_YUV_420SP; params->maxFrameRate = envp->videoFrameRate; /* Set up codec parameters depending on bit rate */ if (envp->videoBitRate < 0) { /* Variable bit rate */ params->rateControlPreset = IVIDEO_NONE; params->maxBitRate = 0; } else { /* Constant bit rate */ params->rateControlPreset = IVIDEO_STORAGE; params->maxBitRate = envp->videoBitRate; } dynParams->targetBitRate = params->maxBitRate; dynParams->inputWidth = params->maxWidth; dynParams->inputHeight = params->maxHeight; dynParams->refFrameRate = params->maxFrameRate; dynParams->targetFrameRate = params->maxFrameRate; dynParams->interFrameInterval = 0; /* Create the video encoder */ hVe1 = Venc1_create(hEngine, envp->videoEncoder, params, dynParams); if (hVe1 == NULL) { ERR("Failed to create video encoder: %s\n", envp->videoEncoder); cleanup(THREAD_FAILURE); } /* Store the output buffer size in the environment */ envp->outBufSize = Venc1_getOutBufSize(hVe1); /* Signal that the codec is created and output buffer size available */ Rendezvous_meet(envp->hRendezvousWriter); /* Signal that initialization is done and wait for other threads */ Rendezvous_meet(envp->hRendezvousInit); while (!gblGetQuit()) { /* Pause processing? */ Pause_test(envp->hPauseProcess); /* Get a buffer to encode from the capture thread */ fifoRet = Fifo_get(envp->hCaptureOutFifo, &hCapBuf); /* Get a buffer to encode to from the writer thread */ fifoRet = Fifo_get(envp->hWriterOutFifo, &hDstBuf); /* Make sure the whole buffer is used for input */ BufferGfx_resetDimensions(hCapBuf); /* Decode the video buffer */ if (Venc1_process(hVe1, hCapBuf, hDstBuf) < 0) { ERR("Failed to encode video buffer\n"); cleanup(THREAD_FAILURE); } /* Send encoded buffer to writer thread for filesystem output */ if (Fifo_put(envp->hWriterInFifo, hDstBuf) < 0) { ERR("Failed to send buffer to display thread\n"); cleanup(THREAD_FAILURE); } /* Return buffer to capture thread */ if (Fifo_put(envp->hCaptureInFifo, hCapBuf) < 0) { ERR("Failed to send buffer to display thread\n"); cleanup(THREAD_FAILURE); } /* Increment statistics for the user interface */ gblIncVideoBytesProcessed(Buffer_getNumBytesUsed(hDstBuf)); frameCnt++; }cleanup: ...... return status;}/****************************************************************************** * end of videoThrFxn ******************************************************************************/
What is the error you are getting ? Is the codec create failing ?
Have you check the TI website for the latest dvsdk availabilty, latest dvsdk is 2.10.01.18 ? You should be able to encode any resolution upto 720P. If you are having trouble with DVTB, you can chek it using the DMAI based demo application also.
Also, With the latesh codec patch, you should be able to encode any resoltution upto 1080P. See http://focus.ti.com/docs/toolsw/folders/print/dm365codecs.html
regards
Yashwant