Display a PNG image using gstreamer

Thiago Sousa Santos thiagossantos at gmail.com
Thu Jul 9 22:59:32 UTC 2020


On Thu, Jul 9, 2020 at 3:18 PM Victor Rollinger <
victor.rollinger at na.denso.com> wrote:

> I need to display a PNG image using gstreamer.
>
>
>
> From reading the documentation, this command should work:
>
>
>
> gst-launch-1.0 -v filesrc location=filename.png ! pngdec ! imagefreeze !
> 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=(fraction)30/1'
> ! waylandsink
>
>
>
> However, when I enter the command, I get the following output on the
> console:
>
>
>
> Setting pipeline to PAUSED ...
>
> Pipeline is PREROLLING ...
>
> /GstPipeline:pipeline0/GstPngDec:pngdec0.GstPad:src: caps = video/x-raw,
> format=(string)RGBA, width=(int)640, height=(int)384,
> interlace-mode=(string)progressive, multiview-mode=(string)mono,
> multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono,
> pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)sRGB,
> framerate=(fraction)0/1
>
> ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal
> data stream error.
>
> Additional debug info:
>
> ../../../../git/libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop ():
> /GstPipeline:pipeline0/GstFileSrc:filesrc0:
>
> streaming stopped, reason not-negotiated (-4)
>
> ERROR: pipeline doesn't want to preroll.
>
> Setting pipeline to NULL ...
>
> Freeing pipeline ...
>
>
>
> Note that the following command works:
>
>
>
> gst-launch-1.0 -v videotestsrc !
> 'video/x-raw,format=(string)YUY2,width=640,height=480,framerate=(fraction)30/1'
> ! waylandsink
>
>
>
> How do I display the PNG file without getting the “Internal data stream
> error”?
>

Hi, the error mentions "not-negotiated" and this means something along your
pipeline have incompatible formats. If you check the output caps from
pngdec you can see that the format it outputs is RGBA and it has a
different height than the capsfilter you are using before waylandsink.

I'd suggest that you either:
1) Update your capsfilter to the expected values coming out of pngdec
(assuming wayland sink can handle it and that you can predict it for your
input)
2) Add more elements to the conversions to the format you like before it
reaches your capsfilter. You need a videoscale to update the height to what
you want as well as a videoconvert for converting between RGBA and YUY2
that you specified. This makes your pipeline more robust and able to handle
different input sizes and formats, at the cost of possible extra operations
on your images. If you add them before imagefreeze they will be done only
on the original image and it shouldn't matter much.




>
>
> Thanks.
>
>
>
> Victor
>
>
> _______________________________________________
> gstreamer-embedded mailing list
> gstreamer-embedded at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-embedded
>


-- 
Thiago Sousa Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-embedded/attachments/20200709/dcd16c3b/attachment.htm>


More information about the gstreamer-embedded mailing list