I have several short videos (about 10 seconds each) that I loop and switch smoothly in GStreamer.
This works fine — I just change the video content and seek the pipeline back to 0.
Now, I want to add an overlay video that should play on top during the transition between two videos.
The overlay video is about 2 seconds long.
What I want:
Start the overlay video at second 9 of video X
Keep it playing until second 1 of video X+1
However, when I seek the main pipeline back to 0, the overlay video also restarts.
Question:
Is there a way to keep the overlay video running continuously (without being affected by the main pipeline seek), while the base video loops?
Hello. At which point in the pipeline are you sending the seek from, and which seek are you using?
If you are sending the seek from downstream of the compositor then I think the seek event will travel up all ‘branches’ and do a seek on both videos.
I’ve had success doing exactly what you are trying to do by manually creating a seek event(gst_event_new_seek()), and then sending it on a specific pad(gst_pad_push_event()) on the ‘branch’ that I want to seek. It works as long as it’s not a flushing seek.
I have 2 videos through:
filesrc → decodebin → videoconvert
The videoconvert src pad is attached to the compositor.
What is the best moment in time to send the event to make sure there is a smooth transition with the next video?
When I wait for the decodebin pad for EOS event, the pads are ‘closed’.
Right, sending it on the pad was just one possible way. If you were using gst_element_seek() before, have you tried simply sending it to the decoder instead of the pipeline? Because that function takes a GstElement, so you can use it either on the entire pipeline(which won’t work because of the compositor) or directly on an element in the pipeline.
I don’t know the best moment in time to send the seek as there are many ways to do it. If sending a seek to the correct element on EOS like you did before works then that would be great. And the decodebin3 has a signal called “about-to-finish” that you could attach a callback function to, it even passes itself as a GstElement argument so you could send a seek right back to it.