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.

How to set PAL in dvrrdk

Hi,all:

Our camera is PAL mode, but the default of software seem to be NTSC mode. 

And if plug the video signal in after the application start, the video still be NTSC mode. 

If  I force the return value of  Vcap_isPalMode to TRUE, there is a grey slice in the bottom of the video if one channel have no signal. 

Sometimes the slice will flash. 

My platform is DVRRDK_03.00.00.00, Would you please tell me how to modify to PAL mode, thanks!

  • Hi,

     

    Before you start the application, can you make sure your all input is in PAL mode?

     

    Thanks,

    Brijesh Jadav

  • Hi,

         Brijesh, thanks your help!  I mean if all 16 channels signal are good, the video have no problem also. But if one of channels have no signal, or signal is abnormal, a slice will disppear the bottom of the video, and the video is NTSC mode. And I replug the signal of PAL mode after application start, the video still be NTSC mode.

    It seems after application start, the software don't deal with the signal change.

    The video mode info will got in VLC, 720*480 50Hz, and I transimit 16 channels D1 in RTSP, Thanks!

  • There are two issues:

    Due to bug in RDK we detect NTSC/PAL only if channel 0 (TVP 0) is NTSC/PAL and assume the remaining channels are same configuration.If no video is detected , it is assumed to be NTSC.

    The info of PAL mode of NTSC mode is passed to CaptureLink at create time and so the buffers are allocated for NTSC. Runtime changes to PAL is not currently supported.

  • Thanks Badri !

             I see. I think you mean that the video must be ready before power on, and after start signal change will not support. When no video input, I tired to force to PAL in Vcap_isPalMode,  there is a slice in the bottom of black screen, and find some video data transmit to RTSP. I want to know whether this grey slice can be removed, thanks! 

  • -- Is the define SYSTEM_USE_VIDEO_DECODER enabled. Pls check /dvr_rdk/mcfw/interfaces/link_api/system_debug.h

    -- When you are creating capture link , is    capturePrm->isPalMode = TRUE before creating capture link

    -- What are the params passed to Vcap_configVideoDecoder() function. Particularly what is the value of vidDecVideoModeArgs.videoSystem . Is it DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_AUTO_DETECT ?

    -- Can you try changing vidDecVideoModeArgs.videoSystem to DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_PAL and check if you still see the grey strip ?

    Pls share the full console logs including capture create logs.

  • 7446.rtsp_16d1_1026_auto_detect.log7115.rtsp_16d1_1026_pal.log

    Thanks Badri !

     These are my set:
     1: SYSTEM_USE_VIDEO_DECODER disabled
     2: yes, return TRUE always
     3: 
     for(i = 0; i < NUM_CAPTURE_DEVICES; i++)
        {
            vidDecVideoModeArgs[i].videoIfMode        = DEVICE_CAPT_VIDEO_IF_MODE_8BIT;
            vidDecVideoModeArgs[i].videoDataFormat    = SYSTEM_DF_YUV422P;
            vidDecVideoModeArgs[i].standard           = SYSTEM_STD_MUX_4CH_D1;
            vidDecVideoModeArgs[i].videoCaptureMode   =
                        DEVICE_CAPT_VIDEO_CAPTURE_MODE_MULTI_CH_PIXEL_MUX_EMBEDDED_SYNC;
            vidDecVideoModeArgs[i].videoSystem        =
                                          DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_AUTO_DETECT;
                                         //DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_PAL;
            vidDecVideoModeArgs[i].videoCropEnable    = FALSE;
            vidDecVideoModeArgs[i].videoAutoDetectTimeout = -1;
        }

     Vcap_configVideoDecoder(vidDecVideoModeArgs, NUM_CAPTURE_DEVICES);

     4: yes, there is no grey strip after set DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_PAL,but the

    video info in VLC still are 720*480 50Hz if there is no video detect, and after I plug in PAL

    video, this info don't change, and the video is shorter than other channel.

    Other function set to NTSC in dvrrdk or VLC issue?


    The log info attached:
    rtsp_16d1_1026_auto_detect.log--DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_AUTO_DETECT
    rtsp_16d1_1026_pal.log--DEVICE_VIDEO_DECODER_VIDEO_SYSTEM_PAL

  • Can you share the  logs of Vsys_printDetailedStatistics(). Give "i" option in the rdk demo cmd line

  • 1256.rtsp_16d1_10261.log

    Thanks Badri!

                I don't use the rdk demo so I change monitorTskEntry as follow:

    static Void *monitorTskEntry(void * prm)
    {
        ST_WRITER_STATUS *d = &gStatusHDD;
     UInt32 msec = 30000;
        int i;
       
        //OSA_semWait(&d->sem_id, OSA_TIMEOUT_FOREVER);
       
        while(d->exitMonitorThread == FALSE)
        {
    /*
      printf("\n");
      dbgSystemTime();

      printf("(W) - ");
      for (i = 0; i < MAX_DVR_CHANNELS; i++)
       printf("%4u ",d->arRecordBps[i] / (msec/1000) * 8 / 1024);
      printf(", ");
      for (i = 0; i < MAX_DVR_CHANNELS; i++)
       printf("%2u ",d->arRecordFps[i] / (msec/1000));
      printf("\n");
    */
      Vsys_printDetailedStatistics() ;

           // memset(d, 0x00, sizeof(ST_WRITER_STATUS));

            OSA_waitMsecs(msec);
        printf("\n");
        }
    }

     Attached the log info, thanks!

  • Statistics indicate it is processing frames of 704 x 576 correctly. Can you print the values of VCODEC_BITSBUF_S.frameWidth  & VCODEC_BITSBUF_S.frameHeight of buffers received from Venc_getBitstreamBuffer() and confirm it is 720 x 480

  • Thanks Badri!

    VCODEC_BITSBUF_S.frameHeight of channel 0 change from 576 to 480 by unknow reason, pls check attached logs.

    By the way, channel0 to channel3 no video, and others have PAL video, thanks!

    6874.rtsp_16d1_10262.log

  • Can you comment out call to

    CaptureLink_drvDetectVideo in function CaptureLink_drvProcessData()

    CaptureLink_drvProcessData()

       //CaptureLink_drvDetectVideo(pObj, TRUE, FALSE);

    and rebuild m3 firmware and check if  you still see the issue.

  • Thanks Badri!

               I still see the issue after comment out the CaptureLink_drvDetectVideo.

  • Can you add the below code in captureLink_drv.c

     

    static Void CaptureLink_setFrameWallTime(CaptureLink_Obj * pObj,
                                             FVID2_Frame  *frame)
    {
        System_FrameInfo *frameInfo;

        frameInfo = frame->appData;
        if (frameInfo)
        {
         if (frameInfo->height != 288)
      {
          Vps_printf("CAPTURE:Frame height changed forchId %d",frame->channelNum);
      }
            #ifdef SYSTEM_DEBUG_AVSYNC_DETAILED_LOGS
            AvsyncLink_logCaptureTS(frame->channelNum,frameInfo->ts64);
            #endif
        }
    }

    Recompile vpss m3 firmware and share console logs if you see above print. This will give some info if the frame height is getting modified in capture link or somewhere else.   

  • Sorry for no response in time for weeken.

              But I didn't find height  in struct System_FrameInfo. And I print Vps_CaptRtParams.captureOutHeight, System_LinkChInfo.height,  they are all 0 for 16 channels.

    typedef struct {

        Vps_CaptRtParams captureRtParams;

        UInt32 captureChannelNum;

        UInt32 nsfChannelNum;

        UInt32 displayHwMsRepeatCount;

        UInt32 dupCount;

        FVID2_Frame *pDupOrgFrame;

        Void *pOrgListMPElem;

        UInt32 mergeChannelNum;

        volatile UInt32 vdecRefCount;

        FVID2_Frame *pVdecOrgFrame;

        UInt32 allocPoolID;

        UInt32 invalidFrame;

        /**< Pool frame from which buf was originally alloced */

        UInt32 rtChInfoUpdate;

        System_LinkChInfo rtChInfo;

        UInt64 ts64; /* 64-bit timestamp in units of msecs */

        UInt32 swMsBlankOutBuf; /* Flag to indicate if

                                 * SwMs needs to blank

                                 * the output buffer */

        UInt32 isPlayBackChannel; /* Flag to indicate if

                                 * Frame belongs to

                                 * playback channel.

                                 * If FALSE it indicates

                                 * this is a live channel

                                 */

        UInt32 selectOrgChannelNum; /* original channeNum at input of select Link */

        UInt32 seqId;            /* Display sequence id

                                  * associated with the frame.

                                  * Video backend will display

                                  * a frame if frame sequenceid

                                  * matches the current display

                                  * sequence id configured by

                                  * application via Avsync API

                                  */

        UInt32 isMpFrame; /* Flag used to indicate if the frame is Mega Pixel frame.

                           * If an MP Frame, 31st bit would be set and 0-30 would

                           * have the associated channel number

                           */

        UInt32 isDataTypeChange;

    } System_FrameInfo;

  • Sorry it is

    System_FrameInfo.rtChInfo.height

  • I had printed rtChInfo.height also, it always be zero for all 16 channels, thanks!

  • Can you confirm that you added the print in CaptureLink_setFrameWallTime() function.

    To check if it is dei that is changing resoltuion pls add print in

    /dvr_rdk/mcfw/src_bios6/links_m3vpss/dei/deiLink_drv.c

    DeiLink_drvUpdateInputRtPrm()

                #if SYSTEM_DEBUG_DEI_RT
                    Vps_printf(" %d: DEI: CH%d: Input Picture Size is changed to width = %d, height = %d!!\n",
                               Utils_getCurTimeInMsec(),
                               chId,
                               pInFrameInfo->rtChInfo.width,
                               pInFrameInfo->rtChInfo.height
                              );
                #endif
    change to

                #if 1
                    Vps_printf(" %d: DEI: CH%d: Input Picture Size is changed to width = %d, height = %d!!\n",
                               Utils_getCurTimeInMsec(),
                               chId,
                               pInFrameInfo->rtChInfo.width,
                               pInFrameInfo->rtChInfo.height
                              );
                #endif

  • Sorry, I didn't find DeiLink_drvUpdateInputRtPrm   in deiLink_drv.c. And SYSTEM_DEBUG_DEI_RT in my dvrrdk_03.00.00.00 is define, but not used. Attached print info in CaptureLink_setFrameWallTime.

    8054.rtsp_16d1_1029.log

  • HI grace.

    i'm a customer of ti. 

    i had a the same problem like you. i made Vcap_init_signal , then using this function instead of Vcap_init.

    i dont' know, it's a correct thing. but It works good. 

    src_linux/mcfw_api/ti_vcap.c

    // kisung cho start
    Int32 Vcap_init_signal(VCAP_PARAMS_S * pContext, int isPal)
    {
    Int32 ret;
    ret = Vcap_init(pContext);
    gVcapModuleContext.isPalMode = isPal;
    return ret;
    }
    // kisung cho end

  • Thanks Kisung!

             I tried your solution, but  there are some problem if one of channels no video.

  • Ok sorry. Looks like the code is not present in the codebase you have.

    Can you add print in

    /dvr_rdk/mcfw/src_bios6/links_m3video/iva_enc/encLink_common.c

    EncLink_codecDynamicResolutionChange()

    if (rtParamUpdatePerFrame == TRUE)

    {

        Vps_printf("ENCLINK: Resolution change chId[%d]:frameHeight[%d]",chId, pFrameInfo->rtChInfo.height);

    }

  • Thanks Badri!

                 This line had been printed.

                  Attached print info.

              4061.rtsp_16d1_1030.log

  • Can you explain your data flow. I see you are having a select link. How is select link used in your usecase.IN the codebase you have capture and dei do not support runtime resolution change.So it must be some other link which is changing resolution runtime.

  • Select link has been added in 03 version, after capturelink and before deilink. The usecase I used is VSYS_USECASE_MULTICHN_PROGRESSIVE_VCAP_VDIS_VENC_VDEC. Attached usecase file. Thanks!

    1425.multich_progressive_vcap_venc_vdec_vdis.c

  • The usecase file is fine. Unfortunately I am unable to figure out which component is changing the resolution. You have confirmed

    - SYSTEM_USE_VIDEO_DECODER is disabled

    - CaptureLink_drvDetectVideo is commented.

    The only option is to add prints for resolution change similar to what was added in encLink at each link.Print SystemFrameInfo.rtChannelInfo.height in

    - CaptureLink output (Already done)

    - DeiLink  output

    - ipcOutM3 link output

  • Thanks Badri!

                  I checked application again and found lib_dvr_app.c called DVR_setCaptureResolution() after detected video status, then set NTSC if no video detected. This routine set Dei resolution dynamically after all links started. I comment out DVR_setCaptureResolution() , the video is normal.

    Thanks your help again!!!