Since it's notable to the thread, VapourSynth has been getting attention lately. Obviously the advanced usage is beyond the scope of the thread and the INSTALL file that comes with the source tells you pretty much everything you need to do to build it, but having a post describing the methodology on Ubuntu specifically might be in order. I actually had this worked out a while ago, but wanted to wait for Quantal to be released so I could verify that the steps still worked.
VapourSynth scripts are written in Python, since VS itself is implemented as a Python module. So they're going to look different than AviSynth scripts.
First, follow the guide on getting FFmpeg compiled here:
https://ffmpeg.org/trac/ffmpeg/wiki/...mpilationGuide
(in the checkinstall step, use 7: in the pkgversion instead of 5: - otherwise, the system will try to replace it whenever libav-tools has an update)
You can probably use libav, but since I don't I'm not going to comment on it.
Installing the dependencies and building an up-to-date version of Cython:
Code:
sudo apt-get install libqtcore4 python3 python3-dev wget subversion
wget "http://pypi.python.org/packages/source/C/Cython/Cython-0.17.1.tar.gz#md5=f0bd2494dbe080a1185b61fa358135f2" -O - | tar -xzvf -
cd Cython-0.17.1
sudo python3 setup.py install
Building and installing VapourSynth itself:
Code:
svn checkout http://vapoursynth.googlecode.com/svn/trunk vapoursynth
cd vapoursynth
./bootstrap.py
./waf configure
./waf build
sudo ./waf install
sudo ./setup.py install
sudo ldconfig
Building and installing FFMS2:
Code:
svn checkout http://ffmpegsource.googlecode.com/svn/trunk ffms2
cd ffms2
./autogen.sh
./configure --enable-shared
make
sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-svn" --backup=no --deldoc=yes --fstrans=no --default
sudo ldconfig
The ./autogen.sh step is only necessary until the next time the build system for FFMS2 is regenerated officially. If you don't perform the autogen step, the VapourSynth interface won't get built.
Now, for the script. You could just look at the documentation, since it's explained there, but for the sake of making a complete post:
Code:
#!/usr/bin/python3
import vapoursynth as vs
import sys
core = vs.Core()
core.std.LoadPlugin("/usr/local/lib/libffms2.so")
ret = core.ffms2.Source("inputvideo.avi")
ret.output(sys.stdout, y4m=True)
As you can see, it's Python. The #!/usr/bin/python3 line forces the script to be interpreted by the correct version of Python (since 12.10 still ships with Python 2.7.3, you're going to have two different versions of Python installed, and this ensures you're using 3.2).
The syntax is explained at greater length in the official documentation.
To use it with something, first make the script (we'll call it vstestscript.vpy) executable:
Code:
chmod +x vstestscript.vpy
Now feed it to mplayer:
Code:
./vstestscript.vpy | mplayer -
Or this would work, if mplayer accepted ffmpeg's extended Y4M format that VS uses. To get around this, pipe it through ffmpeg first (part of the reason I advise to use bona-fide ffmpeg, and not libav):
Code:
./vstestscript.vpy | ffmpeg -i - -f yuv4mpegpipe - | mplayer -
In x264's case, support for the extended Y4M format is in the x264-devel branch, so hopefully there'll be an update soon that pushes it into the main branch. For those wondering, the reason for the extended format is because VS supports high bit depths, and so does the extended Y4M format. I have my doubts about the 'running it through ffmpeg first' thing actually preserving these higher bit depths (and possibly colorspaces), so hopefully we can get direct support of the extended Y4M or .vpy scripts into all of this stuff soon.
Seeing as the scripts are just normal Python, you could do more exotic things with them. Not that I know how to accomplish that, but the option is there.
Bookmarks