Multimidia课的lab3“视频生产实例”要使用非线性编辑软件vapoursynth,助教给的是win下面的教程,就自己在ubuntu下面尝试了一下,因为有好用的预编译的包,所以整体比较简单。(相比之下前两个lab要求的软件编译的我头疼,and我上回不小心删掉了lab1的.md源码,暴哭了!)
Ubuntu16.04 install vapoursynth via apt vapour最新版是R45,通过apt安装的预编译版本是R43,如果有需要的话可以通过源码编译安装R45,有官方文档。
1 2 3 4 5 6 sudo add-apt-repository ppa:djcj/hybrid sudo apt-get update sudo apt-get install vapoursynth vapoursynth-editor sudo apt-get install vapoursynth-dev sudo apt-get install vapoursynth-extra-plugins
安装完成:
1 2 3 4 5 6 7 8 9 10 sparta:~$ sudo dpkg -l |grep vapour ii libvapoursynth 43-1~xenial amd64 frameserver for the 21st century ii libvapoursynth-dev 43-1~xenial amd64 frameserver for the 21st century - development files ii libvapoursynth-script0 43-1~xenial amd64 frameserver for the 21st century - VSScript runtime ii vapoursynth 43-1~xenial amd64 frameserver for the 21st century ii vapoursynth-editor 16-2~xenial amd64 editor for VapourSynth scripts ii vapoursynth-extra-plugins 20180415-1~xenial amd64 Additional plugins for VapourSynth ii vapoursynth-python3 43-1~xenial amd64 frameserver for the 21st century - Python 3 module ii vapoursynth-viewer 8+git18-1~xenial1 amd64 modified version of the original Vapoursynth Editor ii vapoursynth-waifu2x-models 20160430-1~xenial all model files for the waifu2x VapourSynth plugin
善用sudo dpkg -L xxx
查看apt安装到的位置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 sparta:~$ sudo dpkg -L libvapoursynth-dev /usr/share/doc/libvapoursynth-dev/examples /usr/share/doc/libvapoursynth-dev/examples/invert_example.c.gz /usr/share/doc/libvapoursynth-dev/examples/filter_skeleton.c /usr/share/doc/libvapoursynth-dev/examples/vsscript_example.c sparta:~$ sudo dpkg -L vapoursynth-extra-plugins /usr/lib/x86_64-linux-gnu/vapoursynth /usr/lib/x86_64-linux-gnu/vapoursynth/deblock.so ... /usr/lib/python3/dist-packages/vsscripts sparta:vapoursynth$ cd /usr/lib/python3/dist-packages/vsscripts sparta:vsscripts$ ls adjust.py knlm.py nnedi3_rpow2.py supersampledantialiasing.py dehalo_alpha.py MaskDetail.py psharpen.py temporalsoften2.py edgecleaner.py mcdegrainsharp.py rangeutils.py VAutoDeint.py fastlinedarken.py MCDenoise.py resamplehq.py vshelpers.py finesharp.py mpls.py scoll.py vsTAAmbk.py havsfunc.py mvsfunc.py sharpaamcmod.py hdr2sdr.py nnedi3_resample.py showdiff.py sparta:vapoursynth$ cd /usr/lib/x86_64-linux-gnu/vapoursynth sparta:vapoursynth$ ls addgrain.so eedi3.so libocr.so tc2cfr.so awarpsharp2.so f3kdb.so libremovegrain.so tcanny.so bifrost.so ffms2.so libsubtext.so tcomb.so bilateral.so fft3dfilter.so libvinverse.so tdeintmod.so bm3d.so fieldhint.so libvivtc.so templinearapproximate.so cnr2.so fillborders.so lsmashsource.so temporalsoften2.so combmask.so fluxsmooth.so models temporalsoften.so convo2d.so fmtconv.so msmoosh.so tnlmeans.so ctmf.so genericfilters.so mvtools.so ttempsmooth.so d2vscan.pl histogram.so nnedi3.so vaguedenoiser.so d2vsource.so hqdn3d.so rawsource.so vautodeint.so damb.so imagereader.so readmpls.so videoscope.so dctfilter.so it.so reduceflicker.so w3fdif.so deblock.so knlmeanscl.so retinex.so waifu2x-opt.so degrainmedian.so libeedi3.so sangnommod.so waifu2x-w2xc.so delogo.so libimwri.so scenechange.so wwxd.so depan.so libinvert.so scrawl.so yadifmod.so dfttest.so libmiscfilters.so scxvid.so eedi2.so libmorpho.so ssiq.so
插件编写编译 vapoursynth有给出example,可以按照那个来添加插件与接口。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 spartazhc:~$ cd /usr/share/doc/libvapoursynth-dev/examples sparta:examples$ ll 总用量 20 drwxr-xr-x 2 root root 4096 5月 19 21:00 ./ drwxr-xr-x 3 root root 4096 5月 19 21:00 ../ -rw-r--r-- 1 root root 2004 2月 1 2018 filter_skeleton.c -rw-r--r-- 1 root root 3452 2月 1 2018 invert_example.c.gz -rw-r--r-- 1 root root 3607 2月 1 2018 vsscript_example.c sparta:examples$ sudo gzip -d invert_example.c.gz sparta:examples$ ll 总用量 28 drwxr-xr-x 2 root root 4096 5月 19 21:16 ./ drwxr-xr-x 3 root root 4096 5月 19 21:00 ../ -rw-r--r-- 1 root root 2004 2月 1 2018 filter_skeleton.c -rw-r--r-- 1 root root 8724 2月 1 2018 invert_example.c -rw-r--r-- 1 root root 3607 2月 1 2018 vsscript_example.c sparta:examples$ sudo vim invert_example.c
1 2 3 4 sparta:examples$ sudo gcc -shared -fPIC -O2 invert_example.c -o libinvert.so sparta:examples$ sudo cp libinvert.so /usr/lib/x86_64-linux-gnu/vapoursynth/
invert插件使用 修改.vpy 文件使用插件
1 2 3 4 5 6 7 8 import vapoursynth as vscore = vs.get_core() clip = core.ffms2.Source(source = 'input.m2ts' ) clip = core.invert.Filter(clip) clip.set_output()