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.

can't modify dynamic params after create

I'm using the encode example on the dm365 and trying to dynamically change the bit rate while the encoder is runing.  In video.c in the while loop i do the following

    dynParams->targetBitRate = 25000000;

    if (VIDENC1_control(Venc1_getVisaHandle(hVe1), XDM_SETPARAMS, (IVIDENC1_DynamicParams *)& dynParams, (IVIDENC1_Status *)& encStatus) != VIDENC1_EOK) {
            printf("no go on the control setup!!!!\n");
        }

 

The function doesn't return successfully, thus I am unable to set the bit rate.

 

any help would be greatly appreciated

  • Maybe the target bitrate is too large, I think you can refer to the DM365 codec user guide to find the maximum bitrate the encoder supports!

    touse

  • I am actually trying to set it to 2.5 Mb not 25 Mb, that was just a typo.

  • I added the following function to Venc1.c in the dmai package so that I could change the dynamic params on the fly from video.c in the encode demo program with the following call:

     

    Venc1_control(hVe, dynParams)

     

    Not sure why I couldn't get it to work the way I was trying originally, probably a memory mapping issue between the CE and user space code or something.

     

    Int32 Venc1_control(Venc1_Handle hVe, VIDENC1_DynamicParams *dynParams)
    {
        VIDENC1_Status          encStatus;
        XDAS_Int32              status;

        if (dynParams == NULL) {
            Dmai_err0("Cannot pass null for dynamic params\n");
            return VIDENC1_EFAIL;
        }

        if (hVe == NULL) {
            Dmai_err0("Failed to allocate space for Venc1 Object\n");
            return VIDENC1_EFAIL;
        }

        if (hVe->hEncode == NULL) {
            Dmai_err0("hVe->hEncode no good\n");
            return VIDENC1_EFAIL;
        }

        /* Set video encoder dynamic parameters */
        encStatus.size = sizeof(VIDENC1_Status);
        encStatus.data.buf = NULL;

        status = VIDENC1_control(hVe->hEncode, XDM_SETPARAMS, dynParams, &encStatus);

        if (status != VIDENC1_EOK) {
            Dmai_err1("XDM_SETPARAMS failed, status=%d\n", status);
            VIDENC1_delete(hVe->hEncode);
            free(hVe);
            return VIDENC1_EFAIL;
        }

        Dmai_dbg0("Made XDM_SETPARAMS control call\n");

        return status;
    }

  • hello,

     

    I have the same problem but I have an error during the compilation (at link time only because I added the header file) with the function added :

    Int32 Venc1_control(VIDENC1_Handle hVe, VIDENC1_DynamicParams *dynParams)

    What did you add to get it compiling ?

     

    Best regards,

    Guillaume

  • Sorry to drag up an old thread, but this same thing is happening to me, you don't by any chance remember how you fixed it do you?

    Thanks

  • Just to follow up on my own thread, I was able to get it compiling just fine.  All the changes were done correctly but I needed to do a big make clean to make sure my build process wasn't going crazy.  It turns out that it was.

     

    Now , there's a new problem.  The VIDENC1_control  command fails when I try to run after the encoder has been created.  I really don't know what could be going wrong, I've even tried doing a XDM_GETBUFINFO and that returns with a status error with extendedError set as:

    Venc1_control: status = 345600.

    ----------------------

    The code I added to Venc1.c is as follows:

    /******************************************************************************
     * Venc1_control
     ******************************************************************************/
    Int32 Venc1_control(Venc1_Handle hVe, VIDENC1_DynamicParams *dynParams)
    {
        VIDENC1_Status          encStatus;
        XDAS_Int32              status;

        assert(hVe);

        if (dynParams == NULL) {
            Dmai_err0("Cannot pass null for dynamic params\n");
            return VIDENC1_EFAIL;
        }

        if (hVe == NULL) {
            Dmai_err0("Failed to allocate space for Venc1 Object\n");
            return VIDENC1_EFAIL;
        }

        if (hVe->hEncode == NULL) {
            Dmai_err0("hVe->hEncode no good\n");
            return VIDENC1_EFAIL;
        }

        /* Set video encoder dynamic parameters */
        encStatus.size = sizeof(VIDENC1_Status);
        encStatus.data.buf = NULL;

        /* Get buffer information from video encoder */
        status = VIDENC1_control(hVe->hEncode, XDM_GETBUFINFO, dynParams, &encStatus);

        printf("%s: status = %lu\n", __FUNCTION__, encStatus.extendedError);
        if (status != VIDENC1_EOK) {
            Dmai_err1("XDM_SETPARAMS failed, status=%d\n", status);
    /*         VIDENC1_delete(hVe->hEncode); */
    /*         free(hVe); */
            return VIDENC1_EFAIL;
        }

        Dmai_dbg0("Made XDM_SETPARAMS control call\n");

        return status;
    }

    This is with dvsdk 3.10.00.19 and dmai 2.10.00.12. 

    What I"m trying to accomplish is to force the encoder to encode an I-Frame with it's next Venc1_process call.  I was able to do this on a previous project using the dm355 and dvsdk 1.00 but clearly something has changed (or broke?) in this dvsdk.  Help is greatly appreciated.

    Thanks,

    BJ