I have managed to wrap VapourSynth. Just the bare minimum to get something 
working. It has been a good exercise to learn Nim and to start loving the 
language. Thank you all for your support.

The code is crappy (my code I mean), but the result really surprised me.

VapourSynth aims to have compatibility with 
[AviSynth](http://avisynth.nl/index.php/Main_Page). I would say that 
[VapourSynth](http://www.vapoursynth.com/) aims to be a replacement keeping 
compatibility with all the filters and scripts from AviSynth.

AviSynth has his own scripting language. You can see how it looks 
[here](https://forum.nim-lang.org/t/3299#20786).

There is a **python wrapper** for VapourSynth which makes it look like (from 
[here](http://www.vapoursynth.com/doc/gettingstarted.html#example-script)):
    
    
    from vapoursynth import core
    video = core.ffms2.Source(source='Rule6.mkv')
    video = core.std.Transpose(video)
    video.set_output()
    
    Run

then you can play it with **vspipe** and **ffmpeg** (or compress it):
    
    
    vspipe --y4m script.vpy - | ffmpeg -i pipe: encoded.mkv
    
    Run

So, how can Nim improve from there? Well, the equivalent Nim script looks like:
    
    
    import src/vapoursynth
    Source("test/2sec.mkv").Transpose.Pipey4m
    
    Run

you compile it (into myfile for example) an play it back by means of:
    
    
    ./myfile | mplayer -idx -
    
    Run

the myfile takes just 250kb.

So all this effort to get this:

I almost forgot, the link to the code: 
[VapourSynth.nim](https://github.com/mantielero/VapourSynth.nim).

Lot of work ahead.

Reply via email to