<div dir="ltr"><div dir="ltr">HI Karl,<div><br></div><div>I would probably do this with FFMPEG and OpenCV.  </div><div><br></div><div>Step 1: Use FFMPEG to strip the mp4 sound track.</div><div>Step 2: Use OpenCV to convert the video into sequential frames</div><div>Step 3: Read the Frames into a Mat object in OpenCV, detect squares, and then crop over the previous frame.</div><div>Step 4: Use OpenCV to stitch the frames back into an MP4 file.</div><div>Step 5: Use FFMPEG to add back the sound track.</div><div><br></div><div>Gstreamer for video portion you would have two pipelines. Filesrc -> jpegenc -> appsink. You then hookup a callback to appsink store the frames into memory, process them with OpenCV, then feed them into second pipeline  appsrc -> splitmuxsink.<br></div><div><br></div><div>You would probably need a tee to bring in the audio in the second pipeline, but others who are more familiar with this can comment.</div><div><br></div><div>Best regards.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 12, 2023 at 8:04 PM Carl Karsten via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I need to alter video frames, and Python is my happy place.<br>
my gst skills need some help.<br>
<br>
I think I need these 2 things:<br>
<br>
1. pipeline:<br>
read a file,<br>
decode the video,<br>
hook? to read/write pixels,<br>
encode (keep the original audio)<br>
save to disk.<br>
<br>
2. that hook code...<br>
I have done something before: use the wavelevel element to get audio<br>
data and generate static png images.<br>
<a href="https://github.com/CarlFK/veyepar/blob/master/dj/lib/gslevels.py#L72" rel="noreferrer" target="_blank">https://github.com/CarlFK/veyepar/blob/master/dj/lib/gslevels.py#L72</a><br>
<br>
So I am assuming some element / message will give me a frame buffer<br>
thing of data, and somehow i can detect black pixels.<br>
<br>
<br>
End goal: fix some video;s I made of a live event where my setup<br>
introduced black squares - I want to replace the black with the pixels<br>
from the previous frame.<br>
example of what needs fixing:<br>
<a href="https://youtu.be/N5Anbq8vYNk?si=Gl89X3Uk5_2CrMu6&t=148" rel="noreferrer" target="_blank">https://youtu.be/N5Anbq8vYNk?si=Gl89X3Uk5_2CrMu6&t=148</a><br>
<br>
The slide is mostly a static image, so the previous frame will be fine.<br>
<br>
-- <br>
Carl K<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni                </div><div><br></div></div></div></div></div></div></div></div>