Introducing pyanimenc

For a long time I’ve felt that Linux lacked  Windoze tools like MeGUI, as well as a good AviSynth alternative. I regularly encode anime, usually in batches which is very time consuming, and I’ve grown tired of having to boot into Windoze to do that.

Enter VapourSynth, a native linux frameserver. There aren’t nearly as many filters as on AviSynth yet, but it’s growing fast. Incidentally, VapourSynth scripts are written in Python, so I started (slowly) learning Python 3.

This got me thinking that I could automate all those encoding tasks using Python instead of my Z shell scripts, and eventually I started writing a set of tools not unlike MeGUI.

pyanimenc
pyanimenc

It’s still at an early stage, and since it’s the first time ever I write a program at all, it’s probably a huge mess of heretical nonsenses, so please bear with me. Right now, it can encode videos using x264 (8 or 10bit) and audio using fdkaac or lame, one by one. Adding other encoders is trivial, those happen to be the one I use. There is also an automation tab, which can encode a whole bunch of files using predefined settings, please note that it only accepts MKVs as source files (for now?). The output is also MKVs only. You can’t queue more than one batch ATM because I had the bright idea of using non local variables which will have the wrong data by the time the threaded worker reads them, I’m working on that. Also, please disregard the status bar at the bottom, and the log tab for now. You will need to run pyanimenc in a terminal to monitor what it’s actually doing.

There is a basic VapourSynth script creator, however preview is not ready yet, because VS is written mostly in C. The Python bindings only provide access to a pointer, which I have no idea how to handle, you will have to use vsviewer for now. The script creator can do cropping, resizing (internal filters) and debanding (using the excellent f3kdb). There seems to be only one denoising filter for VS, TemporalSoften which I will probably add in the future, as for deinterlacing, there is a nnedi3 port, but it’s not quite there yet apparently.

I have also written a Matroska chapters editor, but instead of asking for timecodes like other editors, it feeds on  frame numbers, which makes much more sense when you have a frameserver at hand IMHO. The editor will calculate timecodes for you based on the video FPS. This however rules out VFR, but it’s rather uncommon, and pyanimenc encodes in CFR anyway. You can make chapters from scratch or import a simple YAML chapter definition file (example included), importing existing XML or TXT chapters is also planned.

For the brave souls out there who are interested and don’t fear that their computer will explode, sources are hosted on my GitHub: https://github.com/alucryd/pyanimenc
I have also created an AUR package for Arch users: https://aur.archlinux.org/packages/pyanimenc-git/

Enjoy 🙂