<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Hi, I am new to GStreamer and I am developing a program with it, and I am struggling to translate my logic to the pipeline paradigm.</span>
<div><br>
</div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">My program is a screen recorder that keeps a 30s backlog of video. When the user presses a button, the backlog is saved to a file.</span></div>
<div><br>
</div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">My idea to solve this was to have a pipeline like this:</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">windowsrc -> videoconvert -> nvenc -> h264parse -> queue -> tee​</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">The queue serves as the backlog, and I dynamically attach a mp4mux/filesink after the tee when the button is pressed.</span></div>
<div><br>
</div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">This seems to work, however the video takes 30s to save since it has to wait until the queue spitted out 30s of video.</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I thought about simply emptying the whole queue at once, but then I wouldn't be able to press the button multiple times in less than 30s.</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I looks to me as if I need to somehow copy the queue and its data along with it to let the copy empty all at once in the filesink while keeping the backlog
 intact.</span></div>
<div><br>
</div>
<span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Is it possible to do this? Do I need a different pipeline architecture? Or will I have to use appsinks and appsrcs and patch together my own ring buffer implementation?</span><br>
</div>
</body>
</html>