Quantcast

Using the valve plugin correctly in a gstreamer pipeline

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using the valve plugin correctly in a gstreamer pipeline

xargon
This post was updated on .
I am trying to use the `valve` plugin to basically block one branch of a `tee` in a gstreamer pipeline but this is setting my whole pipeline to `PAUSED`. So, what I am doing is basically saving H264 encoded video from my camera stream and also displaying it on the screen at the same time.

I try to use the `valve` plugin to block off a branch as follows;

    gst-launch-1.0 -v autovideosrc ! 'video/x-raw, width=1920, height=1080' ! 
    tee name = t ! queue ! valve drop=1 ! x264enc tune=zerolatency ! 
    'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! 
    filesink location=test.mp4 t. ! queue ! videoscale ! video/x-raw, 
    width=480,height=270 ! xvimagesink -e sync=false 

However, this basically seems to set the whole pipeline to PAUSED rather than just the branch. I was still expecting to see the camera stream on the display but that is not the case.

EDIT

Adding `async=false` to the pipeline plays it correctly but it has issues sending the EOS then and my pipeline output looks like:

    Interrupt: Stopping pipeline ...
    EOS on shutdown enabled -- Forcing EOS on the pipeline
    0:00:04.962334345 16857      0x22f9270 WARN          v4l2bufferpool gstv4l2bufferpool.c:748:gst_v4l2_buffer_pool_start:<autovideosrc0-actual-src-v4l:pool:src> Uncertain or not enough buffers, enabling copy threshold
    Waiting for EOS...

And here it just waits for the EOS event.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using the valve plugin correctly in a gstreamer pipeline

Yi-Lung Tsai
The pipeline state is changed step-by-step, “NULL” -> “READY” -> “PAUSED” -> “PLAYING”.
From my understanding, all sink elements need to be changed to “PAUSED” state then whole pipeline successfully changes to “PAUSED” state.
Normally a “sink” element needs to received one buffer (preroll) to go to “PAUSED” state.
Now there is a “valve” in front of filesink (in your case).
The filesink never receives a buffer so it cannot go to “PAUSED” state.
As a result, the whole pipeline is waiting for filesink to change its state forever.

There are two options to overcome this situation.

1. Do not add filesink in the beginning.
Add filesink only when you want to save video to file and do not forget to not drop in valve.

2. Lock state of filesink by gst_element_set_locked_state(filesink, TRUE);
Then state of filesink is not sync with parent (pipeline).
And you need to change its state manually.


--
Yi-Lung (Bruce) Tsai





On May 3, 2017, at 11:45 PM, xargon <[hidden email]> wrote:

I am trying to use the `valve` plugin to basically block one branch of a
`tee` in a gstreamer pipeline but this is setting my whole pipeline to
`PAUSED`. So, what I am doing is basically saving H264 encoded video from my
camera stream and also displaying it on the screen at the same time.

I try to use the `valve` plugin to block off a branch as follows;



However, this basically seems to set the whole pipeline to PAUSED rather
than just the branch. I was still expecting to see the camera stream on the
display but that is not the case.




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Using-the-valve-plugin-correctly-in-a-gstreamer-pipeline-tp4682904.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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

Re: Using the valve plugin correctly in a gstreamer pipeline

xargon
Thanks for your reply. I quickly tested removing the filesink and it works!

I will try it with the C++ and doing this ynamically but I am sure it works!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: Using the valve plugin correctly in a gstreamer pipeline

Thornton, Keith
In reply to this post by xargon
Hi,
I gave up using valve because it blocks events as well as buffers (you won't get EOS). If you use valve you have to set drop to false at the start and then when the pipeline has prerolled you can set it to true. However I would recommend using pad probes instead. You have much finer control over your pipeline. Sebastian has written a good guide if you google dynamic pipelines.
Grüße

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von xargon
Gesendet: Mittwoch, 3. Mai 2017 17:46
An: [hidden email]
Betreff: Using the valve plugin correctly in a gstreamer pipeline

I am trying to use the `valve` plugin to basically block one branch of a `tee` in a gstreamer pipeline but this is setting my whole pipeline to `PAUSED`. So, what I am doing is basically saving H264 encoded video from my camera stream and also displaying it on the screen at the same time.

I try to use the `valve` plugin to block off a branch as follows;



However, this basically seems to set the whole pipeline to PAUSED rather than just the branch. I was still expecting to see the camera stream on the display but that is not the case.




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Using-the-valve-plugin-correctly-in-a-gstreamer-pipeline-tp4682904.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AW: Using the valve plugin correctly in a gstreamer pipeline

Baby Octopus
Why dont you consider adding fakesink instead of filesink+valve? When you need the actual recording to be done, set the pipeline to PAUSED, swap fakesink with filesink, and then set it to playing.
Loading...