I'm working on creating GIF from video clips automatically on the server using MoviePy. The library helped in various transformations and trimming of video to create GIFs.
In my current project, I have a video clip with lots of moving objects making it difficult to do automatic tracking of the region of interest. (A quick gif below shows the scene, though the background there can be easy to eliminate and do the tracking of object. But let's say tracking object is out of scope of the project).
As shown in the gif below the red rectangle is the region of interest which moves from left to right with time. I want to crop that region and create a GIF.
I'm using MoviePy where I cropped a rectangle from a video to create a gif. But the rectangle is fixed at its original coordinates position. I'm looking for a way to move that rectangle with time and crop it to create a GIF.
clip = (VideoFileClip("my_video.mp4")
.subclip((1,10.1),(1,14.9))
.resize(0.5)
.crop(x1=145,y1=110,x2=400,y2=810))
clip.write_gif("my_gif.gif")
How to add time factor so that this coordinates change with the time.
Any suggestions welcome.
vfx
? – Volgograd