Hi all,
I'm trying to implement a function that returns the current frame of playbin2 element as a QImage (Qt data type). When I call the function (for the same video), sometimes it works perfectly, sometimes parts of the frame (bottom rows) are missing. What am I doing wrong? Should I somehow be able to wait for the "convert-frame" operation to finish, or what? You can find my example code below. Thank you for your help! QImage Video::getFrame() { GstBuffer *buffer; GstCaps *caps; caps = gst_caps_new_simple("video/x-raw-rgb","bpp", G_TYPE_INT, 24,"depth", G_TYPE_INT, 24,NULL); g_signal_emit_by_name(player, "convert-frame", caps, &buffer); unsigned char* data=(unsigned char *) GST_BUFFER_DATA (buffer); QImage img(data, width, height, QImage::Format_RGB888); return img; } |
Hi,
On Mon, Jan 3, 2011 at 1:12 PM, vaisaari <[hidden email]> wrote: > > Hi all, > > I'm trying to implement a function that returns the current frame of > playbin2 element as a QImage (Qt data type). When I call the function (for > the same video), sometimes it works perfectly, sometimes parts of the frame > (bottom rows) are missing. What am I doing wrong? Should I somehow be able > to wait for the "convert-frame" operation to finish, or what? You can find > my example code below. Thank you for your help! imo this should not happen, as the signal handler (delegated to playsink) internally calls gst_play_sink_get_last_frame, which locks playsink. Can you post to pastebin the output you get after setting GST_DEBUG=playsink:5 ? Which video decoder are you using? Besides, if you're trying to render a video clip in Qt, you may consider using QtGStreamer.. Regards > > > QImage Video::getFrame() > { > > GstBuffer *buffer; > GstCaps *caps; > > caps = gst_caps_new_simple("video/x-raw-rgb","bpp", G_TYPE_INT, 24,"depth", > G_TYPE_INT, 24,NULL); > > g_signal_emit_by_name(player, "convert-frame", caps, &buffer); > > unsigned char* data=(unsigned char *) GST_BUFFER_DATA (buffer); > QImage img(data, width, height, QImage::Format_RGB888); > > return img; > } > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Getting-converted-frame-from-playbin2-element-tp3171830p3171830.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
> imo this should not happen, as the signal handler (delegated to
> playsink) internally calls gst_play_sink_get_last_frame, which locks > playsink. Can you post to pastebin the output you get after setting > GST_DEBUG=playsink:5 ? You can find the output from here . The output looks the same whether or not the conversion is successful. > Which video decoder are you using? I have tried it with both uncompressed and MPEG4 encoded videos. > Besides, if you're trying to render a video clip in Qt, you may > consider using QtGStreamer.. It looks very promising. At some point, I most certainly will. |
Hi,
looks like my time machine for jumping 11 days in the future eventually works.. (lame excuse for my late reply) Maybe you've already fixed your issue, but I still have a few ideas. On Mon, Jan 10, 2011 at 4:15 PM, vaisaari <[hidden email]> wrote: > >> imo this should not happen, as the signal handler (delegated to >> playsink) internally calls gst_play_sink_get_last_frame, which locks >> playsink. Can you post to pastebin the output you get after setting >> GST_DEBUG=playsink:5 ? > > You can find the output from http://pastebin.com/raw.php?i=HgD1S8Uz here . > The output looks the same whether or not the conversion is successful. yep, it looks good. > >> Which video decoder are you using? > > I have tried it with both uncompressed and MPEG4 encoded videos. > >> Besides, if you're trying to render a video clip in Qt, you may >> consider using QtGStreamer.. > > It looks very promising. At some point, I most certainly will. here: http://doc.qt.nokia.com/qt-maemo-4.7/qimage.html#QImage-4 is stated the validity of the data into memory must last at least as long as the QImage itself and in the list you've reported it appears you're not handling buffer references at all. At best, you're leaking memory like there's no tomorrow, at worst (depending on the pov) the buffer "buffer" gets unreffed somewhere by chances and then you might observed teared images (depending on the color space) or even segfaults. Another good reason for using QtGstreamer ;) Even if it worked, I would anyway not use such an approach to convert all the frames in a clip (check what does the gst_video_convert_frame function do to be convinced). It's imo better to use a color space conversion element (e.g. ffmpegcolorspace) at the end of the pipeline or after a tee and an appsink element. Regards, Marco > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Getting-converted-frame-from-playbin2-element-tp3171830p3207234.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Gaining the trust of online customers is vital for the success of any company > that requires sensitive data to be transmitted over the Web. Learn how to > best implement a security strategy that keeps consumers' information secure > and instills the confidence they need to proceed with transactions. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |