Live data from Hacker News

Programmatic Video Editing with Python

github.com

31–40 of 44 posts

Re: Programmatic Video Editing with Python

#31
Can I use python projects to do any of these in an automated way:

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.

Re: Programmatic Video Editing with Python

#34
post #16

I've always thought "from lib import star" is somewhat of a anti-pattern. 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?

Side question: how do you prevent import statements from being imported by "from lib import star"? (Without explicitly mentioning all the stuff that is not import statements). 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.

You could use names starting with _ (underscore) for things that you don't want to export. Your module would look like this:

    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 function

Re: Programmatic Video Editing with Python

#35
I happened to be looking for a programming-based video editor last night. It's hard to reuse patterns in conventional video editors. MoviePy is great but it looks like it's lacking maintainers and many wanted features are not available, such as GPU accerlation.

Re: Programmatic Video Editing with Python

#36
post #3

What are some good / mature / performant libraries to programmatically achieve compositions of text, audio and image files, perhaps with a timeline in which these can be declared at various timestamps, and the output is a video file? Does this one do it?

Maybe Narakeet?

https://news.ycombinator.com/item?id=24737405

Re: Programmatic Video Editing with Python

#37
post #9

I've always thought "from lib import star" is somewhat of a anti-pattern. 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?

Here's my take: Don't use "import-star" in library code. Like you say, it obscures where elements of the namespace came from. 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 dat…

I don’t import-star in the console or notebooks (PyCharm, specifically) because autocomplete works better with the module to scope the search. So I end up doing a lot of aliased imports like “import numpy as np”

Re: Programmatic Video Editing with Python

#38
post #3

What are some good / mature / performant libraries to programmatically achieve compositions of text, audio and image files, perhaps with a timeline in which these can be declared at various timestamps, and the output is a video file? Does this one do it?

Just curious, what is your use case? I had to do some stuff like this for a school project a while ago, wrangled with ffmpeg whilst cursing under my breathe. Curious what other people do this for

Re: Programmatic Video Editing with Python

#39
post #3

What are some good / mature / performant libraries to programmatically achieve compositions of text, audio and image files, perhaps with a timeline in which these can be declared at various timestamps, and the output is a video file? Does this one do it?

Just curious, what is your use case? I had to do some stuff like this for a school project a while ago, wrangled with ffmpeg whilst cursing under my breathe. Curious what other people do this for

Essentially the same thing - ffmpeg syntax is very complex to maintain so I wanted to find out if there are better approaches to implementing this kind of solution.

The use-case is mostly audio conversations converted to video with the relevant speaker's face shown prominently, based on timestamp data.

Re: Programmatic Video Editing with Python

#40
post #20

If you're interested in high performance video processing with Python and want something more than just a fancy ffmpeg wrapper, then I can highly recommend checking out Vapoursynth: https://www.vapoursynth.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 the…

The documentation shows ffmpeg is used only for encoding/decoding, composition/animation/effects are driven by openCV/numpy/scipy/PIL

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

Post reply on HN