I'm having problems sending multiple frames thru TIImgenc1 element to jpeg encode them. I've tried this on omap3530 and dm3730 (Overo gumstix and BB-xm), using the current dvsdk.
Here is an example pipeline:
gst-launch -v videotestsrc pattern=snow num-buffers=5 ! TIImgenc1 iColorSpace=UYVY oColorSpace=YUV420P qValue=75 numOutputBufs=3 genTimeStamps=1 ! fakesink
You will see from the output of fakesink, that the first frame from the jpeg encoder is correct, but all subsequent frames are around 570 bytes.
I've tried turning on debug messages from gst and codec engine, but I can't figure out the cause.
This was also reported here:
https://gforge.ti.com/gf/project/gstreamer_ti/forum/?action=ForumBrowse&forum_id=187&thread_id=3754&_forum_action=ForumMessageBrowse
Any help?
Does anyone have any input on this issue?
Thanks.
Hi Chris,
I have the same problem as you.
Take a look at : http://e2e.ti.com/support/embedded/f/354/p/134076/486099.aspx
Maybe you will be more lllucky than i am. Let me know if you find a solution !
I noticed in your example pipeline from the other thread you didn't have numOutputBufs=3. Without this, my pipeline stalls. When it is added, the pipeline runs, but outputs garbage after the first frame.
So the comment about buffers not being freed may relate to that, and be a totally different issue. I would think a buffer allocation problem would result in nothing coming out of the pipeline rather than bad data? I need to run again with more debug turned on and attach the output here.
thanks.
Chris,
I investigate our problem with this cmd line :
CE_DEBUG=3 GST_DEBUG=5 gst-launch videotestsrc -v ! 'video/x -raw-yuv, width=320 , height=240, format=(fourcc)UYVY' ! TIImgenc1 engineName=co decServer codecName=jpegenc iColorSpace=UYVY oColorSpace=YUV420P qValue=75 numOu tputBufs=3 resolution=320x240 frameRate=30 displayBuffer=TRUE genTimeStamps=TRUE ! fakesink
I noticed only this mistake :
[ColorSpace] Unknown color space format (4) during Ienc1_process...
This patch has corrected my format bug :
https://gforge.ti.com/gf/project/gstreamer_ti/tracker/?action=TrackerItemEdit&tracker_item_id=1043
gst-launch -v videotestsrc ! TIImgenc1 engineName=codecServe r codecName=jpegenc ! fakesink
But i still have the same problem as above :
Pipeline is PREROLLED ... Setting pipeline to PLAYING ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 8235 bytes, timestamp: none, duration: none, offset: -1, offset_end: -1, flags: 0) 0x128ce8" New clock: GstSystemClock /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 575 bytes, timestamp: none, duration: none, offset: -1, offset_end: -1, flags: 0) 0x128db8" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 573 bytes, timestamp: none, duration: none, offset: -1, offset_end: -1, flags: 0) 0x128e88"
Any advice ???
I needed to make Mjpeg encoding.
I resolved this issue by modifing 3 files (I don't why we lost the params config but for now it's resolve our problem, already it's not an optimize solution...) :
Modifing TIImgenc1 in encode_thread function :
/*re-set of params because we lost them*/ imgenc1->hIe = Ienc1_control(imgenc1->hIe,&imgenc1->dynParams); /* Invoke the image encoder */ GST_LOG("invoking the image encoder\n"); ret = Ienc1_process(imgenc1->hIe, imgenc1->hInBuf, hDstBuf);
Adding Ienc1_control function in Ienc1.c in DMAI to re-set params :
/****************************************************************************** * Ienc1_control ******************************************************************************/Ienc1_Handle Ienc1_control(Ienc1_Handle hIe, IMGENC1_DynamicParams *dynParams){ IMGENC1_Handle hEncode; IMGENC1_Status encStatus; XDAS_Int32 status; hEncode = Ienc1_getVisaHandle(hIe); /* Set dynamic parameters */ encStatus.data.buf = NULL; encStatus.size = sizeof(IMGENC1_Status); status = IMGENC1_control(hEncode, XDM_SETPARAMS, dynParams, &encStatus); if (status != IMGENC1_EOK) { Dmai_err1("XDM_SETPARAMS failed, status=%d\n", status); IMGENC1_delete(hEncode); free(hIe); return NULL; } return hIe;}
In Ienc1.h adding declaration:
extern Ienc1_Handle Ienc1_control(Ienc1_Handle hIe, IMGENC1_DynamicParams *dynParams);
I'm working on gstreamer_svn 962 on a DM6467T.
If someone can give me return about my modification !
I forgot to say what you need to recompile DMAI before recompile gstreamer_ti !
I tried with success the TIImgenc1 with color input : UYVY and YUV420P.
I had the same problem on a DM6446 with the dmaienc_mjpeg element from the DDOMPE branch. The fix works there as well, with a slight modification:
In gstimgenc1.c I added:
dmaienc->hCodec = Ienc1_control(dmaienc->hCodec,(IMGENC1_DynamicParams*)dmaienc->dynParams);
and modified Ienc1.c/h according to the post.
Thanks,
Jan
I can confirm that this fixed the problem for me as well. I'm using DDOMPE branch of the ti plugin.
Thanks for posting this!
Hi,
I am using DM3730 with DVSDK 4.02. I want to encode NTSC input into MJPEG using DSP. I tried the above changes as suggested but they did not work for me. I can only see first frame and no JPEG frame afterwards. Following is the output:
gst-launch-0.10 v4l2src device=/dev/video0 -v !\ video/x-raw-yuv,format=\(fourcc\)UYVY,framerate=\(fraction\)30000/1001,width=720,height=480 !\ TIImgenc1 engineName=codecServer codecName=jpegenc iColorSpace=UYVY oColorSpace=YUV420P qValue=75 numOutputBufs=3 genTimeStamps=1 displayBuffer=true !\ fakesink-----------------------------------------------------------------------------------------------------------------------------------------------------------------------/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstTIImgenc1:tiimgenc10.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 [R=====================================W ] [ B |] /GstPipeline:pipeline0/GstTIImgenc1:tiimgenc10.GstPad:src: caps = video/x-jpeg, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-jpeg, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "preroll ******* " /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0, stop=(gint64)-1, position=(gint64)0;) 0xf1920" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (37187 bytes, timestamp: 0:00:00.067413330, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x2ab08" [ R=====================================W] [ B] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 575 bytes, timestamp: 0:00:00.100779996, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x104808" [--------------------------------------W R] [ B |] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 573 bytes, timestamp: 0:00:00.134146662, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x1048c8" [ R=====================================W] [ B] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 573 bytes, timestamp: 0:00:00.167513328, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x104988" -----------------------------------------------------------------------------------------------------------------------------------------------------------------------Applying all changes, compiling & installing dmai, compiling & installing gstreamer
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstTIImgenc1:tiimgenc10.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 [R=====================================W ] [ B |] /GstPipeline:pipeline0/GstTIImgenc1:tiimgenc10.GstPad:src: caps = video/x-jpeg, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-jpeg, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "preroll ******* " /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0, stop=(gint64)-1, position=(gint64)0;) 0xf1920" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (36972 bytes, timestamp: 0:00:00.069549562, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x2ab08" [ R=====================================W] [ B] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 575 bytes, timestamp: 0:00:00.102916228, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x104808" [--------------------------------------W R] [ B |] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 573 bytes, timestamp: 0:00:00.136282894, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x1048c8" [ R=====================================W] [ B] /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < ( 573 bytes, timestamp: 0:00:00.169649560, duration: 0:00:00.033366666, offset: -1, offset_end: -1, flags: 0) 0x104988" -----------------------------------------------------------------------------------------------------------------------------------------------------------------------Following is the output when I encode using ARM:gst-launch-0.10 v4l2src device=/dev/video0 -v !\ video/x-raw-yuv,format=\(fourcc\)UYVY,framerate=\(fraction\)30000/1001,width=720,height=480 !\ jpegenc quality=75 ! fakesink-----------------------------------------------------------------------------------------------------------------------------------------------------------------------/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:src: caps = image/jpeg, width=(int)720, height=(int)480, framerate=(fraction)30000/1001, pixel-aspect-ratio=(fraction)1/1 /GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)UYVY, framerate=(fraction)30000/1001, width=(int)720, height=(int)480 /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = image/jpeg, width=(int)720, height=(int)480, framerate=(fraction)30000/1001, pixel-aspect-ratio=(fraction)1/1 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "preroll ******* " /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event ******* E (type: 102, GstEventNewsegment, update=(boolean)false, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0, stop=(gint64)-1, position=(gint64)0;) 0xfa520" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (43304 bytes, timestamp: 0:00:00.075195313, duration: 0:00:00.000000000, offset: 0, offset_end: 1, flags: 0) 0xf62d0" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (40952 bytes, timestamp: 0:00:00.132659912, duration: 0:00:00.000000000, offset: 1, offset_end: 2, flags: 0) 0xf6380" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (40836 bytes, timestamp: 0:00:00.183685304, duration: 0:00:00.000000000, offset: 2, offset_end: 3, flags: 0) 0xfe860" /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain ******* < (41120 bytes, timestamp: 0:00:00.233337404, duration: 0:00:00.000000000, offset: 3, offset_end: 4, flags: 0) 0xfe910" -----------------------------------------------------------------------------------------------------------------------------------------------------------------------However, for better speed I want to use DSP for encoding and not ARM processor. With ARM processor the output frame rate decreases as quality increases due to endcoding delays. Please let me know how to solve this issue.
Hi Vivek Jain,
Try to use DMAI_DEBUG=2 or CE_DEBUG=3 in the begginning of your pipeline (ex: DMAI_DEBUG=2 gst-launch ....) to check if call Ienc1_control and if the SETPARAMS is called to.
I don't see other issue, only you are not re-setting the codec dynparams after the process call.
Mika
Hi Mike,
Thank you for your prompt response. The solution worked for me as well. We are using gstreamer svn 962 version and not the one which came with the kit. So, when I compiled and installed gstreamer, all files were installed in gstreamer and gstreamer_demo folders in /opt directory, however, the executable were running from old installation. So, I set the path variables correctly and the only error left was 'cs.x64P not found' for which I created the symbolic link to the actual file and everything worked.
Vivek
Many times after stopping the gstreamer, when I start again, I get the following error:
-----------------------
ERROR: Pipeline doesn't want to pause.ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not get bu ffers from device '/dev/video0'. Additional debug info: gstv4l2bufferpool.c(390): gst_v4l2_buffer_pool_new (): /GstPipeline:pipeline0/Gs tV4l2Src:v4l2src0: error requesting 2 buffers: Device or resource busy Setting pipeline to NULL ... Freeing pipeline ...
------------------------
Looks like buffers are not released properly when we stop the gstreamer by presssing crtl+c. (This problem does not arrises when I use ARM, jpegenc to do MJPEG encoding). Please let me know how to solve this issue. I am using the following pipeline:
gst-launch-0.10 v4l2src device=/dev/video0 -v always-copy=false !\ video/x-raw-yuv,format=\(fourcc\)UYVY,framerate=\(fraction\)30000/1001,width=720,height=480 !\ TIImgenc1 engineName=codecServer codecName=jpegenc iColorSpace=UYVY oColorSpace=YUV420P qValue=75 resolution=720x480 numOutputBufs=3 genTimeStamps=1 displayBuffer=true !\ rtpjpegpay pt=26 ! udpsink host=192.168.1.101 port=5000