问题
I want to make a GStreamer application which takes image data as source instead of a file location. My intention is to display image received through tcp. When tcp got an image data(byte array) it should pass the data to the gstreamer plugin directly with out saving it locally.
回答1:
The multifilesrc should do the work.
Description
Reads buffers from sequentially named files. If used together with an image decoder, one needs to use the "caps" property or a capsfilter to force to caps containing a framerate. Otherwise image decoders send EOS after the first picture. We also need a videorate element to set timestamps on all buffers after the first one in accordance with the framerate.
File names are created by replacing "%d" with the index using printf().
Example launch line
gst-launch-1.0 multifilesrc location="img.%04d.png" index=0 caps="image/png,framerate=\(fraction\)12/1" ! \ pngdec ! videoconvert ! videorate ! theoraenc ! oggmux ! \ filesink location="images.ogg"This pipeline creates a video file "images.ogg" by joining multiple PNG files named img.0000.png, img.0001.png, etc.
Source : http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-multifilesrc.html
So if your using gstreamer by the command line this should do the trick. You just need to speficiy the file and "loop" on the file when its received.
Otherwise it's not so complicated to code a gstreamer pipeline that use a multifilesrc as source.
来源:https://stackoverflow.com/questions/22625117/image-data-as-source-in-gstreamer