Re: Python access to video frames
Mathieu Duponchelle via gstreamer-devel <[email protected]> Fri, 13 Oct 2023 10:26:51 +0200
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hey, I figure the most elegant solution here would be for you to implement this as a GstVideoFilter[1] subclass. You would implement transform_frame_ip to both store older, "correct" images, then write into the incorrect images as needed. You might encounter issues with the bindings / annotations however, I have only implemented BaseTransform subclasses personally[2]. Good luck! [1]: https://gstreamer.freedesktop.org/documentation/video/gstvideofilter.html?gi-language=c [2]: http://mathieuduponchelle.github.io/2018-02-15-Python-Elements-2.html On Thu, 2023-10-12 at 19:03 -0500, Carl Karsten via gstreamer-devel wrote: > I need to alter video frames, and Python is my happy place. > my gst skills need some help. > > I think I need these 2 things: > > 1. pipeline: > read a file, > decode the video, > hook? to read/write pixels, > encode (keep the original audio) > save to disk. > > 2. that hook code... > I have done something before: use the wavelevel element to get audio > data and generate static png images. > https://github.com/CarlFK/veyepar/blob/master/dj/lib/gslevels.py#L72 > > So I am assuming some element / message will give me a frame buffer > thing of data, and somehow i can detect black pixels. > > > End goal: fix some video;s I made of a live event where my setup > introduced black squares - I want to replace the black with the > pixels > from the previous frame. > example of what needs fixing: > https://youtu.be/N5Anbq8vYNk?si=Gl89X3Uk5_2CrMu6&t=148 > > The slide is mostly a static image, so the previous frame will be > fine. >