Search code examples
gstreamerv4l2gst-launch

Gst-launch: Saving every image of a video stream while watching it


I'm currently trying to save a video stream into files using gst-launch while simultaneously watching the video itself (using v4l2src). As of now I got this by doing a work around with saving the images to files using ! multifilesink while having a tcl-script that automatically shows the newest file in one folder in an X windows. This works but has of course a bit of a delay I would like to reduce.

Is there a possibility to do this with only using gst-launch? I'm not very experienced with gstreamer unfortunately. Could it be done saving the files with multifilesink while showing them using multifilesrc? Or is it impossible with only gst-launch?


Solution

  • It is possible, there is the 'tee' element that will replicate the stream in its source pads.

    So, for example:

    gst-launch-1.0 v4l2src ! tee name=t ! queue ! videoconvert ! autovideosink t. ! queue ! videoconvert ! jpegenc ! multifilesink location=image_%06d.jpg
    

    This should have it displaying and saving to jpg with multifilesink.

    Also, it seems that you are using gstreamer 0.10, it is (2 years?) obsolete and unmantained. Please move to 1.x