Stopping mixing pipeline when shorter input finishes

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

Stopping mixing pipeline when shorter input finishes

Vladislav Glinsky

Hello,

I'm trying to find a correct way to stop a pipeline that mixes two streams of different lengths after the shorter one finished playing. I encountered this problem while trying to fix an old pygst tutorial that uses videomixer to overlay a PNG image shown with imagefreeze on a video file. I see only two approaches to stop the running pipeline when the video ended:

a) change the num-buffers property of imagefreeze to match the video file length but I see no obvious way to convert video file duration to the number of buffers

b) look for EOS event in the probe on video decoder source pad and send it down to videomixer from imagefreeze (either with gst_element_send_event or with gst_pad_push_event from src pad) but I'm not sure that this doesn't have any synchronization issues

I decided to model use case with two streams of different lengths with two videotestsrc and approach b works perfectly fine. When I replaced "infinite" videotestsrc with imagefreeze for PNG image I found out that application doesn't receive EOS message: gst_element_send_event(imagefreeze, gst_event_new_eos()) returns false while gst_pad_push_event(gst_element_get_static_pad(imagefreeze, "src"), gst_event_new_eos()) pad never returns at all. I've attached Python code that uses approach b to stop pipeline with pair of videotestsrc and with videotestsrc+imagefreeze and PNG file if someone will need to run the code.

I doubt that this is due to some bug in imagefreeze, so the question is what I'm doing wrong and how to solve this problem correctly?

-- 
Best regards,
Vladislav Glinsky

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

stop-looped-video.py (3K) Download Attachment
tvlogo.png (147K) Download Attachment
signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Stopping mixing pipeline when shorter input finishes

Tim Müller
Hi Vladislav,

I might be misunderstanding the problem, but if you're just using videomixer to overlay a PNG image/logo, then using an element like gdkpixbufoverlay instead might be easier.

Cheers
 Tim
-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

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

Re: Stopping mixing pipeline when shorter input finishes

Vladislav Glinsky
On 23.10.20 16:59, Tim Müller wrote:
Hi Vladislav,

I might be misunderstanding the problem, but if you're just using videomixer to overlay a PNG image/logo, then using an element like gdkpixbufoverlay instead might be easier.

Cheers
 Tim
-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

Hi Tim,

Thanks for your answer. I'm aware of gdkpixbufoverlay element and this approach to overlay image is definitely much simpler.

But the question I am trying to find an answer to was "how to stop pipeline on EOS from the shorter stream".

I've replaced both videotestsrc with two video files, and the chosen approach (which looks more like a workaround) didn't work just like with imagefreeze. After looking at the GStreamer documentation again I think that another way to solve the problem is to query  duration of all streams at the beginning and post seek event with "stop" parameter set to longer streams. But that won't work for live streams.

-- 
Best regards,
Vladislav Glinsky

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (499 bytes) Download Attachment