Getting frames from appsink
maxilase
zenos_22 at hotmail.com
Thu Jul 2 05:30:44 PDT 2015
Hello GStreamers !
I am stuck on a difficult problem : I am working on Windows 7 with the Qt
library and trying to get frames from and appsink.
In the end I do get "some frames" from my pipeline but there is multiple
problems :
1) I seem capped to 20 FPS (which is decent but I think that it can be
improve)
2) When i change my source to and RTSP one, i see a delay (and a big one,
from 2 to 6/10 seconds ! and always rising)
I am stuck on it since a pretty long moment so I had time to investigate :
1) I think that the buffer I am using always grow and never drop frames (and
yes i did put TRUE in gst_app_sink_set_drop(); )
2) At first I was using the signal "new-sample" in order to get my frames
but I read that it is consuming, so I changed for the
gst_app_sink_pull_sample(); method, but problems persist.
3) Here is how I fetch my frames from the appsink element, I think there is
a problem in my code, maybe I am not properly getting the frame.
<pipeline>
"videotestsrc name=testSrc pattern=ball ! appsink name=sink
caps=\"video/x-raw,format=RGBx,framerate=1/1\"";
</pipeline>
<code>
void GStreamer::pullFrame()
{
int width, height;
GstSample *sinkSample =
gst_app_sink_pull_sample(GST_APP_SINK(m_gstSink));
if(sinkSample == NULL)
return;
/*CAPS*/
GstCaps *caps = gst_sample_get_caps(sinkSample);
QString strCaps = gst_caps_to_string(caps);
qDebug() << "strCAPS=" << strCaps;
GstStructure *capsStruct = gst_caps_get_structure(caps,0);
gst_structure_get_int(capsStruct,"width",&width);
gst_structure_get_int(capsStruct,"height",&height);
/*BUFFER*/
GstBuffer *sampleBuffer = gst_sample_get_buffer(sinkSample);
GstMapInfo bufferInfo;
gst_buffer_map(sampleBuffer,&bufferInfo,GST_MAP_READ);
qDebug() << "Buffer info: size" << QString::number(bufferInfo.size) <<
"maxsize=" << QString::number(bufferInfo.maxsize);
guint8 *rawFrame = bufferInfo.data;
m_pulledImg = new QImage(rawFrame,width,height,QImage::Format_RGBX8888);
emit newFrame(m_pulledImg);
}
</code>
As you can see, I have been searching into the sample, what information I
could get...
My questions are:
1) Is one sample mandatory one frame ? Or may it be a set of the last frames
received ?
a) I tried to use the function gst_sample_get_buffer_list () but it is no
found in my environment.
2) Why am I experiencing so many delays ? I have changed "max-buffers" and
"drop" parameters but nothing changes...
a) I understood what does "drop" changes in the behaviour, but what about
max-buffer ? Is it the number of frame stored ? the number of bytes allowed
?
b) At some moment, I could see a real time frame, but it get wiped out
right away by a older one, and the frame regulary do this (when drop is
TRUE)
3) How can I map a fixed buffer for GStreamer to write in ? And can I use
multiple buffering (storing 2/3 frames and taking only the most recent
one...)
Regards,
Maxwell
-----
They did not know it was impossible, so they did it!
Mark Twain
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Getting-frames-from-appsink-tp4672539.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list