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.

Linux/AM5728: ducatimpeg4enc - fails with frame rate of 60fps

Part Number: AM5728

Tool/software: Linux

I have a camera running at 60fps, and I want to compress using ducatimpeg4enc then write to a file.  If I use a gstreamer pipeline with  the framerate stated as 30/1, when the camera is running at 60fps, then it all appears to work, and my output file even gives the frame rate (correctly) as 60fps.

Pipeline that "works":

gst-launch-1.0 v4l2src device=/dev/video1 num_buffers=200  io-mode=4   ! 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=30/1'! vpe num-input-buffers=8  !  'video/x-raw, format=(string)NV12, width=(int)640, height=(int)480' !  queue ! ducatimpeg4enc intra-interval=4 ! queue ! mpeg4videoparse ! mp4mux ! filesink location=test1.mp4

But if I set the stated frame rate to 60/1, then I get the following error:

ERROR: from element /GstPipeline:pipeline0/GstDucatiMPEG4Enc:ducatimpeg4enc0: Could not encode stream.
Additional debug info:
gstducatividenc.c(752): gst_ducati_videnc_handle_frame (): /GstPipeline:pipeline0/GstDucatiMPEG4Enc:ducatimpeg4enc0

Please can you let me know what's going on here, and if my pipeline needs changing?

Best regards,

Bob.

  • Hello Bob,

    If you run command: gst-inspect-1.0 ducatimpeg4enc
    will print the ducatimpeg4enc capabilities and properties. Please refer property level and increase it to 5 or higher.
    You could set this in the same way as you set intra-interval.

    ... ! ... level=level-5 ... !

    Note: The video source that you are using should support 60 fps as well.

    Best Regards,
    Margarita
  • Hi Margarita,

    Thanks for your suggestion. I have tried this, and with the extra property added, the outcome is exactly the same. That is, it runs for stated framerate of 30/1, but fails for stated framerate of 60/1. Actual source is 60fps in both cases.

    Best regards,
    Bob.
  • Hello Bob,

    We are checking this.

    Meanwhile you could test your video capture at 60 fps with this pipeline:
    gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=200 io-mode=4 ! 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=60/1'! vpe num-input-buffers=8 ! 'video/x-raw, format=(string)NV12, width=(int)640, height=(int)480' ! queue ! ducatih264enc ! queue ! h264parse ! mp4mux ! filesink location=test1.mp4

    BR
    Margarita
  • Hello,

    This issue could be reproduced with gstreamer and videnc2test demo ( ./videnc2test 325 288 10 /usr/share/ti/video/airshow_p352x288.yuv out.mpeg 60 6000 mpeg4 simple 3 OMAPDRM) as well. Same extended error is observed.

    To make this work with videnc2test  you must change

       mpeg4enc_params->vopTimeIncrementResolution = 30;

    to

       mpeg4enc_params->vopTimeIncrementResolution = 60;

    To make this work with gstreamer , MPEG4Params must be extended.

    gst_mpeg4enc_configure_vop.patch.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    diff --git a/src/gstducatimpeg4enc.c b/src/gstducatimpeg4enc.c
    index 1efe880..266cb62 100644
    --- a/src/gstducatimpeg4enc.c
    +++ b/src/gstducatimpeg4enc.c
    @@ -231,6 +231,7 @@ gst_ducati_mpeg4enc_configure (GstDucatiVidEnc * videnc)
    GstCaps *caps;
    const char *s;
    gboolean ret = TRUE;
    + IMPEG4ENC_Params* mpeg4enc_params;
    if (!GST_DUCATIVIDENC_CLASS (parent_class)->configure (videnc))
    return FALSE;
    @@ -241,6 +242,25 @@ gst_ducati_mpeg4enc_configure (GstDucatiVidEnc * videnc)
    videnc->dynParams->mvAccuracy = IVIDENC2_MOTIONVECTOR_HALFPEL;
    videnc->dynParams->interFrameInterval = 0;
    + mpeg4enc_params = (IMPEG4ENC_Params*)videnc->params;
    + mpeg4enc_params->useDataPartitioning = 0;
    + mpeg4enc_params->useRvlc = 0;
    + mpeg4enc_params->useShortVideoHeader = 0;
    + mpeg4enc_params->vopTimeIncrementResolution = 60;
    + mpeg4enc_params->nonMultiple16RefPadMethod = IMPEG4_PAD_METHOD_MPEG4;
    + mpeg4enc_params->pixelRange = IMPEG4ENC_PR_0_255;
    + mpeg4enc_params->enableSceneChangeAlgo = IMPEG4ENC_SCDA_DISABLE;
    + mpeg4enc_params->useVOS = 0;
    + mpeg4enc_params->enableMONA = 0;
    + mpeg4enc_params->enableAnalyticinfo = -1;
    + mpeg4enc_params->debugTraceLevel = 0;
    + mpeg4enc_params->lastNFramesToLog = 0;
    +
    + mpeg4enc_params->rateControlParams.rateControlParamsPreset = IMPEG4_RATECONTROLPARAMS_DEFAULT;
    + mpeg4enc_params->interCodingParams.interCodingPreset = IMPEG4_INTERCODING_DEFAULT;
    + mpeg4enc_params->intraCodingParams.intraCodingPreset = IMPEG4_INTRACODING_DEFAULT;
    + mpeg4enc_params->sliceCodingParams.sliceCodingPreset = IMPEG4_SLICECODING_DEFAULT;
    +
    state = videnc->input_state;
    caps = gst_caps_new_simple ("video/mpeg",
    "mpegversion", G_TYPE_INT, 4,
    @@ -264,7 +284,7 @@ gst_ducati_mpeg4enc_allocate_params (GstDucatiVidEnc *
    gint outargs_sz)
    {
    return GST_DUCATIVIDENC_CLASS (parent_class)->allocate_params (videnc,
    - sizeof (IVIDENC2_Params), sizeof (IVIDENC2_DynamicParams),
    + sizeof (IMPEG4ENC_Params), sizeof (IVIDENC2_DynamicParams),
    sizeof (IVIDENC2_Status), sizeof (IVIDENC2_InArgs),
    sizeof (IVIDENC2_OutArgs));
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Please apply this patch. I would recommend you to do this manually or verify it after you apply  it.

    Recompile the gstreamerducati plugin. and cp the new ducati lib to the board.

    Please if you let me know the PSDK version that you are using I could provide you the steps how to  recompile the ducati library.

    Here is the result on my side:

    gst-launch-1.0 videotestsrc num-buffers=200  ! 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=60/1'! vpe num-input-buffers=8   !  queue ! ducatimpeg4enc ! queue ! mpeg4videoparse ! fakesink
    Setting pipeline to PAUSED ...
    [   46.043654] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "pipeline0".
    Execution ended after 0:00:00.882927662
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...

    I am sorry for the inconvenience.

    BR

    Margarita

  • Hi Margarita,

    Thanks again for your support. I can confirm that the h264 pipeline in your earlier response works fine. The PSDK version that I am using is 05.00.00.15.

    Best regards,
    Bob.
  • Hello Bob,

    This is the guide that you must follow:
    software-dl.ti.com/.../Overview.html
    You could use this command MACHINE=am57xx-evm bitbake gstreamer1.0-plugins-ducati instead of MACHINE=<target-board> bitbake arago-core-tisdk-image

    When you build gst-ducati please apply changes from the patch.
    This is the command how to recompile the ducati:
    MACHINE=am57xx-evm bitbake gstreamer1.0-plugins-ducati --force -c compile
    Press ctrl+h and cd in
    tisdk/build/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/gstreamer1.0-plugins-ducati/git-r2.24/git/src/.libs

    There you will find the new libgstducati.so. Copy this on board under /usr/lib/gstreamer-1.0 folder.

    BR
    Margarita
  • Hello,

    Please if this patch fix your issue with ducatimpeg4enc verify the answer.
    If is not, let me know.

    BR
    Margarita
  • Hi Margarita,

    Yes, this patch has solved the issue. Thanks!

    Best regards, Bob.

  • Hello Bob,

    Thank you for the confirmation.
    If you have new questions/issues open a new thread, please.

    BR
    Margarita