Gstreamer save frame to multifilesink produces 0 KB image

Nicolas Dufresne nicolas at ndufresne.ca
Thu Aug 26 20:05:31 UTC 2021


Le jeudi 26 août 2021 à 15:31 -0400, Dwight Kulkarni a écrit :
> Hi all,
> 
> It seems that multifile sink pipeline below did work the second time. The
> first time for some reason the frames were blank, possibly I was too hasty in
> terminating the program ?
> 
> I have a followup question.  Is there a way for me to retrieve the result into
> memory rather than in a filesink. I am calling gstreamer in a C++ program. Can
> I have Gstreamer return a handle for each frame so that I can directly access
> the JPEG rather than having to write it to file ?

Sure, you can end you pipeline with appsink, and use appsink public API to pull
the GstSamples.

> 
> Thanks in advance.
> 
> On Thu, Aug 26, 2021 at 12:25 PM Nicolas Dufresne <nicolas at ndufresne.ca>
> wrote:
> > Le jeudi 26 août 2021 à 11:14 -0400, Dwight Kulkarni via gstreamer-devel a
> > écrit :
> > > Hi all,
> > > 
> > > I am using gstreamer and try the following two pipelines:
> > > 
> > > gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=1920,
> > > height=1080, framerate=15/1 ! autovideosink
> > > 
> > > When I run this command, a window opens up and shows me the camera output.
> > > 
> > > Now I want to convert this stream to jpeg and save it to file, so I use
> > the
> > > following:
> > > 
> > > gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=1920,
> > > height=1080, framerate=15/1 ! jpegenc ! multifilesink
> > > location=/home/myuser/mytestfolder/img_%06d.jpg
> > > 
> > > 
> > > I run the second command for a few seconds then terminate with Ctrl C. I
> > see
> > > files img_00001.jpg etc. but the size of the file is 0 KB.
> > > 
> > > Can anyone suggest what I might be doing wrong ?
> > > 
> > 
> > This is strange, I ran this here, gst 1.18.4, and it just worked. Perhaps
> > you
> > should set GST_DEBUG=2 to get warnings printed if any, might help ? Also,
> > consider adding videoconvert, in case your cam does not produce a pixel
> > format
> > compatible with jpegenc ?
> > 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210826/fd4b64ef/attachment.htm>


More information about the gstreamer-devel mailing list