Auto-Editor is a CLI tool that cuts out the silence in video/audio files.
Auto-Editor was originally written in Python, however, Python is slow and it's easy to make mistakes in C extensions. Nim is very attractive to me because it has system-language performance and powerful high-level conceptions in scripting languages.
Before even considering rewriting to a systems language, I transitioned from untyped Python to typed Python (type annotations check with mypy). Then I rewrote the program in Nim from scratch, submodule by submodule.
Is there some semantic difference between Typed Python and Nim, yes, but it's still 80% the same. This fact, as well as Auto-Editor not being a ginormous project, meant that the rewrite was fast, and I didn't have to write Python-to-Nim bindings.
Basic example:
auto-editor video.mp4
This cuts out the silences. You can adjust the silent threshold:
auto-editor video.mp4 --edit audio:-20dB
You can even set custom actions:
auto-editor video.mp4 --when-silent speed:2.5 --when-normal speed:1.5
This is only scratching the surface, so check out the GitHub and Docs too.
typed Python is just as slow as untyped Python, it just helps catch errors and makes refactoring faster.
Rendering can be up to 2x faster. Analysis can be 8-10x faster.
running example.mp4 is ~72% faster on my machine.