Snapshot on a pipeline

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Snapshot on a pipeline

gnosis
Hi,

I've got a pipeline that can play either a live video from the network or a video file
and send it either on the network or in a video file, this pipeline can be set to pause.

How can do a snapshot  of the flux sent : send a frame of the flux sent into a picture file?

Thanks for helping, I'm really stuck...


Gnosis
Reply | Threaded
Open this post in threaded view
|

Re: Snapshot on a pipeline

William Manley
On 23/08/12 07:45, gnosis wrote:
> Hi,
>
> I've got a pipeline that can play either a live video from the network or a
> video file
> and send it either on the network or in a video file, this pipeline can be
> set to pause.
>
> How can do a snapshot  of the flux sent : send a frame of the flux sent into
> a picture file?

The way I've done it before is to tee the pipeline off into an appsink
with drop=true and max-buffers=1.  You can then use the pull-buffer
action signal to get a buffer.

e.g. if before you had

     souphttpsrc ! filesink

You could change it to

     souphttpsrc ! tee name=t ! filesink t. ! decodebin2 ! appsink
name=screenshot max-buffers=1 drop=1

You then get the screenshot element and call gst_app_sink_pull_buffer to
get the buffer which you can save to disk after appropriate conversion
to png, jpg, etc.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Snapshot on a pipeline

gnosis
Thank you very much for your help. I'm going to try this right now
I will let you know if it's OK!

Thanks again!!!
Reply | Threaded
Open this post in threaded view
|

Re: Snapshot on a pipeline

gnosis
In reply to this post by William Manley
Hi again,

I think it't ok for the first part but now, I don't know how to convert the GstBuffer get into a png or jpeg file.

How can I do that?

Thanks!!

Gnosis
Reply | Threaded
Open this post in threaded view
|

Re: Snapshot on a pipeline

William Manley
On 23/08/12 15:31, gnosis wrote:
> Hi again,
>
> I think it't ok for the first part but now, I don't know how to convert the
> GstBuffer get into a png or jpeg file.
>
> How can I do that?

I have an example in Python[1].  I think there is an example of this in
C somewhere in the gstreamer source code but I don't know where.

[1]:https://github.com/drothlis/stb-tester/blob/3e85e190/stbt.py#L98-116


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Snapshot on a pipeline

gnosis
OK, now everything is working, I got one last question just in order to understand.

I got my pipeline that I play, then I turn it to "PAUSE" and wait. Then I do the snapshot and I wait again
and then I stop the pipeline.

The image stored during the snapshot is not exactly the same as the one I see when the pipeline is on pause state.

In fact, for my tests I use a video that got 1 differents image every (1/24) sec. There are 2 or 3 pictures of lag between
the picture shown in the paused pipeline and the snapshot.

What is the reason of that?

Thanks again!!

Gnosis