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.
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,
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.
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)); }
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,
Yes, this patch has solved the issue. Thanks!
Best regards, Bob.