Programmatic Video Editing with Python
github.com
github.com
It's been around for ~9 years and has a relatively large community around it, most visibly found on the Doom9 forums: http://forum.doom9.org/forumdisplay.php?f=82
I'm personally still mostly using Avisynth these days since it's what I'm most familiar with, but I've also used Vapoursynth and it's definitely the one to learn if you want to get into programmatic video processing these days.
Not a full blown GUI, but it shows you a video preview, syntax highlighting, function definitions for plugins, etc. It doesn't support Vapoursynth, but you can program macros in Python.
See: https://zulko.github.io/moviepy/getting_started/quick_presen...
The Gallery section has more advanced demos on vector/3D animations & audio mixing: https://zulko.github.io/moviepy/gallery.html
I was tinkering with moviepy over the weekend to add subtitles to my standup comedy routine. I used a hand edited simple ".srt" file. It was easy and fun to implement.
Here is the finished result, https://fb.watch/v/17oesJhB3/
Personally I think that makes sense - because sometimes when I read code, I just have no idea where something comes from.
But I've seen import star everywhere, couple of examples:
Doc for this product
FastAI's course
Bing ads code base
So I'm guessing it is more of accepted than I expected? What does HackerNews think?
Like patterns, anti-patterns are context sensitive. “from lib import *” is usually an anti-pattern, but doing it exactly once in a source file, especially a short one, and especially for demonstration code for the library so imported, is not a problem.
But if you do it two or more times in the same source file...
When using Python interactively, esp. if the interactive session is to be thrown away at the end, then import-star can be fine and can be a good time-saver. Video editing is a great example of when this is appropriate. See also manim. Other examples might be one-off html parsing or one-off data manipulation tasks.
Similar to "import-star" is multiple inheritance. Just like import-star, multiple inheritance can make it ambiguous where methods come from, and imo it should similarly be avoided by default unless there's a compelling reason to use it.
For example, this is mymod.py:
import numpy as np
def f(x): return 2*x
And here it is imported: from mymod import *
f(10) # Works as expected.
np.sum([10, 20]) # Works, but shouldn't work.Docs: https://docs.python.org/3/tutorial/modules.html#importing-fr...
The `from x import y` syntax is unaffected
import numpy as _np # numpy will be hidden
def f(x): return x * 2
def _g(x): return _np.array([x, x]) # _g is a non-public functionUnless no one can see.
Somewhat more seriously, don’t do it in anything other than one-off code once you’ve experimented enough to get the result you want unless you aren’t scared of the people who will yell at you about circular imports.
Does this one do it?
I found it super useful to write a quick Python script to auto-generate JSON in the format it wants, combining screenshots, headers, footers, and such into a nice demo-video.
The use-case is mostly audio conversations converted to video with the relevant speaker's face shown prominently, based on timestamp data.
1. Stabilize footage
2. Cut out silent moments from clips with dialog.
3. I have spikes in audio from handling the camera. These are very distinctive spikes. Some automated way of getting rid of these audio peaks or lowering their volume.
I just want to throw the clips in a folder, and pre process them in the background, before I add them to a final cut project.
Have video templates then render them on the cloud filling the template placeholders with images, text, etc.
It‘s more data driven motion graphics instead of non-linear video editing, but it looks like that‘s what pirsonal is doing pretty much.
Both have their own scripting language based on JavaScript and After Effects also uses plain JS.
There are also a number of paid plugins which provide varying levels of no-code automation. For example there is one which connects to Google Sheets and creates a new AE comp from each spreadsheet row, replacing text, images from URLs, changing dimensions of objects, etc. all based on the values of the spreadsheet cells.