church_archive_script/Programs/doc/gettingstarted.html
2023-11-29 16:12:35 +00:00

187 lines
No EOL
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Getting Started &mdash; VapourSynth R64 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Python Reference" href="pythonreference.html" />
<link rel="prev" title="Installation" href="installation.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
VapourSynth
</a>
<div class="version">
R64
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#example-script">Example Script</a></li>
<li class="toctree-l2"><a class="reference internal" href="#preview">Preview</a></li>
<li class="toctree-l2"><a class="reference internal" href="#output-with-vspipe">Output with VSPipe</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pythonreference.html">Python Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions.html">Function Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="output.html">Output</a></li>
<li class="toctree-l1"><a class="reference internal" href="applications.html">Applications and Libraries</a></li>
<li class="toctree-l1"><a class="reference internal" href="apireference.html">VapourSynth C API Reference</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">VapourSynth</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Getting Started</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/gettingstarted.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this heading"></a></h1>
<p>So you managed to install VapourSynth. Now what?</p>
<p>If you dont know the basics of Python, you may want to check out a
<a class="reference external" href="https://learnxinyminutes.com/docs/python3/">tutorial</a>.</p>
<p>You can “play around” in the python interpreter if you want, but thats not how
most scripts are created.</p>
<section id="example-script">
<h2>Example Script<a class="headerlink" href="#example-script" title="Permalink to this heading"></a></h2>
<p>It all starts with a <em>.vpy</em> script.
Heres a sample script to be inspired by, it assumes that <a class="reference external" href="https://github.com/vapoursynth/bestsource">BestSource</a>
is installed and <a class="reference internal" href="installation.html"><span class="doc">auto-loaded</span></a>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">vapoursynth</span> <span class="kn">import</span> <span class="n">core</span> <span class="c1"># Get an instance of the core</span>
<span class="n">clip</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">bs</span><span class="o">.</span><span class="n">VideoSource</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;filename.mkv&#39;</span><span class="p">)</span> <span class="c1"># Load a video track in mkv file</span>
<span class="n">clip</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">std</span><span class="o">.</span><span class="n">FlipHorizontal</span><span class="p">(</span><span class="n">clip</span><span class="p">)</span> <span class="c1"># Flip the video clip in the horizontal direction</span>
<span class="n">clip</span><span class="o">.</span><span class="n">set_output</span><span class="p">()</span> <span class="c1"># Set the video clip to be accessible for output</span>
</pre></div>
</div>
<p>Audio is also supported, use <a class="reference external" href="https://github.com/vapoursynth/bestsource">BestSource</a> to load your audio file.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">vapoursynth</span> <span class="kn">import</span> <span class="n">core</span> <span class="c1"># Get an instance of the core</span>
<span class="n">clip</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">bs</span><span class="o">.</span><span class="n">AudioSource</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;filename.mkv&#39;</span><span class="p">)</span> <span class="c1"># Load an audio track in mkv file</span>
<span class="n">clip</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">std</span><span class="o">.</span><span class="n">AudioGain</span><span class="p">(</span><span class="n">clip</span><span class="p">,</span><span class="n">gain</span><span class="o">=</span><span class="mf">2.0</span><span class="p">)</span> <span class="c1"># Gain all channels 2x</span>
<span class="n">clip</span><span class="o">.</span><span class="n">set_output</span><span class="p">()</span> <span class="c1"># Set the audio clip to be accessible for output</span>
</pre></div>
</div>
<p>You can combine 2 operations in one script.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">vapoursynth</span> <span class="kn">import</span> <span class="n">core</span>
<span class="n">video</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">bs</span><span class="o">.</span><span class="n">VideoSource</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;filename.mkv&#39;</span><span class="p">)</span>
<span class="n">audio</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">bs</span><span class="o">.</span><span class="n">AudioSource</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s1">&#39;filename.mkv&#39;</span><span class="p">)</span>
<span class="n">video</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">std</span><span class="o">.</span><span class="n">FlipHorizontal</span><span class="p">(</span><span class="n">video</span><span class="p">)</span>
<span class="n">audio</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">std</span><span class="o">.</span><span class="n">AudioGain</span><span class="p">(</span><span class="n">audio</span><span class="p">,</span><span class="n">gain</span><span class="o">=</span><span class="mf">2.0</span><span class="p">)</span>
<span class="n">video</span><span class="o">.</span><span class="n">set_output</span><span class="p">(</span><span class="n">index</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="n">audio</span><span class="o">.</span><span class="n">set_output</span><span class="p">(</span><span class="n">index</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>Remember that most VapourSynth objects have a quite nice string representation
in Python, so if you want to know more about an instance just call <code class="docutils literal notranslate"><span class="pre">print()</span></code>.</p>
</section>
<section id="preview">
<h2>Preview<a class="headerlink" href="#preview" title="Permalink to this heading"></a></h2>
<p>Its possible to directly open the script in <a class="reference external" href="https://github.com/YomikoR/VapourSynth-Editor">VapourSynth Editor</a>
or <a class="reference external" href="https://sourceforge.net/projects/vdfiltermod/">VirtualDub FilterMod</a> for previewing.</p>
</section>
<section id="output-with-vspipe">
<h2>Output with VSPipe<a class="headerlink" href="#output-with-vspipe" title="Permalink to this heading"></a></h2>
<p>VSPipe is very useful to pipe the output to various applications, for example x264 and flac for encoding.</p>
<p>Here are some examples of command lines that automatically pass on most video and audio attributes.</p>
<p>For x264:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vspipe</span> <span class="o">-</span><span class="n">c</span> <span class="n">y4m</span> <span class="n">script</span><span class="o">.</span><span class="n">vpy</span> <span class="o">-</span> <span class="o">|</span> <span class="n">x264</span> <span class="o">--</span><span class="n">demuxer</span> <span class="n">y4m</span> <span class="o">-</span> <span class="o">--</span><span class="n">output</span> <span class="n">encoded</span><span class="mf">.264</span>
</pre></div>
</div>
<p>For flac:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vspipe</span> <span class="o">-</span><span class="n">c</span> <span class="n">wav</span> <span class="n">script</span><span class="o">.</span><span class="n">vpy</span> <span class="o">-</span> <span class="o">|</span> <span class="n">flac</span> <span class="o">-</span> <span class="o">-</span><span class="n">o</span> <span class="n">encoded</span><span class="o">.</span><span class="n">flac</span>
</pre></div>
</div>
<p>For FFmpeg:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vspipe</span> <span class="o">-</span><span class="n">c</span> <span class="n">y4m</span> <span class="n">script</span><span class="o">.</span><span class="n">vpy</span> <span class="o">-</span> <span class="o">|</span> <span class="n">ffmpeg</span> <span class="o">-</span><span class="n">i</span> <span class="o">-</span> <span class="n">encoded</span><span class="o">.</span><span class="n">mkv</span>
</pre></div>
</div>
<p>For mpv:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vspipe</span> <span class="o">-</span><span class="n">c</span> <span class="n">y4m</span> <span class="n">script</span><span class="o">.</span><span class="n">vpy</span> <span class="o">-</span> <span class="o">|</span> <span class="n">mpv</span> <span class="o">-</span>
<span class="n">vspipe</span> <span class="o">-</span><span class="n">c</span> <span class="n">wav</span> <span class="n">script</span><span class="o">.</span><span class="n">vpy</span> <span class="o">-</span> <span class="o">|</span> <span class="n">mpv</span> <span class="o">-</span>
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="installation.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="pythonreference.html" class="btn btn-neutral float-right" title="Python Reference" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2012-2023, Fredrik Mellbin.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>