Add basic command explanation; relocate filtergraph explanation

- New section at top: 'Getting started with ffmpeg'. Added basic command explanation under this heading.
- New section at bottom: 'Advanced ffmpeg concepts'. Filtergraph explanation moved there.
This commit is contained in:
kfrn 2017-10-07 21:25:18 +13:00
parent 71e68b5e2e
commit 61681c8dd3

View File

@ -42,8 +42,8 @@
<div class="well col-md-8 col-md-offset-0">
<div class="well">
<h3>What do you want to do?</h3>
<p class="select-from">Click one of the following categories to see possible commands of that type:</p>
<a href="#concepts"><button type="button" class="btn contents-list">Understand ffmpeg concepts</button></a>
<p class="select-from">Click one of the following categories to see commands of that type:</p>
<a href="#getting-started"><button type="button" class="btn contents-list">Learn about the basics of ffmpeg</button></a>
<a href="#rewrap"><button type="button" class="btn contents-list">Change container (rewrap)</button></a>
<a href="#transcode"><button type="button" class="btn contents-list">Change codec (transcode)</button></a>
<a href="#properties"><button type="button" class="btn contents-list">Change video properties</button></a>
@ -60,42 +60,39 @@
<a href="#test-files"><button type="button" class="btn contents-list">Generate test files</button></a>
<a href="#repair"><button type="button" class="btn contents-list">Repair a file</button></a>
<a href="#ocr"><button type="button" class="btn contents-list">Use OCR</button></a>
<a href="#concepts"><button type="button" class="btn contents-list">Understand more advanced ffmpeg concepts</button></a>
<a href="#other"><button type="button" class="btn contents-list">Something else</button></a>
</div>
<div class="well">
<h2 id="concepts">FFmpeg concepts</h2>
<h2 id="getting-started">Getting started with ffmpeg</h2>
<!-- Filtergraph explanation -->
<span data-toggle="modal" data-target="#filtergraphs"><button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Filtergraphs">Filtergraphs</button></span>
<div id="filtergraphs" class="modal fade" tabindex="-1" role="dialog">
<!-- Basic structure of an ffmpeg command -->
<span data-toggle="modal" data-target="#basic-structure"><button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Basic structure of an ffmpeg command">Basic structure of an ffmpeg command</button></span>
<div id="basic-structure" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="well">
<h3>Filtergraphs</h3>
<p>Many ffmpeg commands use filters that manipulate the video or audio stream in some way: for example, <a href="http://ffmpeg.org/ffmpeg-filters.html#hflip">hflip</a> to horizontally flip a video, or <a href="http://ffmpeg.org/ffmpeg-filters.html#amerge-1">amerge</a> to merge two or more audio tracks into a single stream.</p>
<p>The use of a filter is signalled by the flag <code>-vf</code> (video filter) or <code>-af</code> (audio filter), followed by the name and options of the filter itself. For example, take the <a href="#convert-colourspace">convert colourspace</a> command:</p>
<p><code>ffmpeg -i <i>input_file</i> -c:v libx264 -vf colormatrix=<i>src</i>:<i>dst</i> <i>output_file</i></code>
<p>Here, <a href="http://ffmpeg.org/ffmpeg-filters.html#colormatrix">colormatrix</a> is the filter used, with <i>src</i> and <i>dst</i> representing the source and destination colourspaces. This part following the <code>-vf</code> is a <b>filtergraph</b>.</p>
<p>It is also possible to apply multiple filters to an input, which are sequenced together in the filtergraph. A chained set of filters is called a filter chain, and a filtergraph may include multiple filter chains. Filters in a filterchain are separated from each other by commas (<code>,</code>), and filterchains are separated from each other by semicolons (<code>;</code>). For example, take the <a href="#inverse-telecine">inverse telecine</a> command:</p>
<p><code>ffmpeg -i <i>input_file</i> -c:v libx264 -vf "fieldmatch,yadif,decimate" <i>output_file</i></code></p>
<p>Here we have a filtergraph including one filter chain, which is made up of three video filters.</p>
<p>It is often prudent to enclose your filtergraph in quotation marks; this means that you can use spaces within the filtergraph. Using the inverse telecine example again, the following filter commands are all valid and equivalent:
<ul>
<li><code>-vf fieldmatch,yadif,decimate</code></li>
<li><code>-vf "fieldmatch,yadif,decimate"</code></li>
<li><code>-vf "fieldmatch, yadif, decimate"</code></li>
</ul>
but <code>-vf fieldmatch, yadif, decimate</code> is not valid.</p>
<p>Straight quotation marks ("like this") rather than curved quotation marks (“like this”) should be used.</p>
<p><b>Note:</b> if the command involves more than one input or output, you must use the flag <code>-filter_complex</code> instead of <code>-vf</code>.</p>
<p>For more information, check out the ffmpeg wiki <a href="https://trac.ffmpeg.org/wiki/FilteringGuide">Filtering Guide</a>.</p>
<h3>Basic structure of an ffmpeg command</h3>
<p>At its basis, an ffmpeg command is relatively simple. After you have installed ffmpeg (see instructions <a href="https://avpres.net/FFmpeg/#ch1">here</a>), the program is invoked simply by typing <code>ffmpeg</code> at the command prompt.</p>
<p>Subsequently, each instruction that you supply to ffmpeg is actually a pair: a flag, which designates the <i>type</i> of action you want to carry out; and then the specific action itself.</p>
<p>For example, with the instruction <code>-i <i>input_file.ext</i></code>, the <code>-i</code> flag tells ffmpeg that you are supplying an input file, and <code>input_file.ext</code> states which file it is.</p>
<p><b>Note:</b> flags are always prepended with a hyphen.</p>
<p>A very basic ffmpeg command looks like this:</p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>
<dt>-i <i>input_file.ext</i></dt><dd>path and name of the input file<br></dd>
<dt><i>-flag some_action</i></dt><dd>tell ffmpeg to do something, by supplying a valid flag and action</dd>
<dt><i>output_file.ext</i></dt><dd>path and name of the output file.<br>
Because this is the last part of the command, the filename you type here does not have a flag designating it as the output file.</dd>
</dl>
<p class="link"></p>
</div>
</div>
</div>
</div>
<!-- End Filtergraph explanation -->
<!-- End Basic structure of an ffmpeg command -->
</div>
<div class="well">
@ -2425,6 +2422,41 @@ foreach ($file in $inputfiles) {
</div>
<!-- ends View Subprogram info -->
</div>
<div class="well">
<h2 id="concepts">Advanced ffmpeg concepts</h2>
<!-- Filtergraph explanation -->
<span data-toggle="modal" data-target="#filtergraphs"><button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Filtergraphs">Filtergraphs</button></span>
<div id="filtergraphs" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="well">
<h3>Filtergraphs</h3>
<p>Many ffmpeg commands use filters that manipulate the video or audio stream in some way: for example, <a href="http://ffmpeg.org/ffmpeg-filters.html#hflip">hflip</a> to horizontally flip a video, or <a href="http://ffmpeg.org/ffmpeg-filters.html#amerge-1">amerge</a> to merge two or more audio tracks into a single stream.</p>
<p>The use of a filter is signalled by the flag <code>-vf</code> (video filter) or <code>-af</code> (audio filter), followed by the name and options of the filter itself. For example, take the <a href="#convert-colourspace">convert colourspace</a> command:</p>
<p><code>ffmpeg -i <i>input_file</i> -c:v libx264 -vf colormatrix=<i>src</i>:<i>dst</i> <i>output_file</i></code>
<p>Here, <a href="http://ffmpeg.org/ffmpeg-filters.html#colormatrix">colormatrix</a> is the filter used, with <i>src</i> and <i>dst</i> representing the source and destination colourspaces. This part following the <code>-vf</code> is a <b>filtergraph</b>.</p>
<p>It is also possible to apply multiple filters to an input, which are sequenced together in the filtergraph. A chained set of filters is called a filter chain, and a filtergraph may include multiple filter chains. Filters in a filterchain are separated from each other by commas (<code>,</code>), and filterchains are separated from each other by semicolons (<code>;</code>). For example, take the <a href="#inverse-telecine">inverse telecine</a> command:</p>
<p><code>ffmpeg -i <i>input_file</i> -c:v libx264 -vf "fieldmatch,yadif,decimate" <i>output_file</i></code></p>
<p>Here we have a filtergraph including one filter chain, which is made up of three video filters.</p>
<p>It is often prudent to enclose your filtergraph in quotation marks; this means that you can use spaces within the filtergraph. Using the inverse telecine example again, the following filter commands are all valid and equivalent:
<ul>
<li><code>-vf fieldmatch,yadif,decimate</code></li>
<li><code>-vf "fieldmatch,yadif,decimate"</code></li>
<li><code>-vf "fieldmatch, yadif, decimate"</code></li>
</ul>
but <code>-vf fieldmatch, yadif, decimate</code> is not valid.</p>
<p>Straight quotation marks ("like this") rather than curved quotation marks (“like this”) should be used.</p>
<p><b>Note:</b> if the command involves more than one input or output, you must use the flag <code>-filter_complex</code> instead of <code>-vf</code>.</p>
<p>For more information, check out the ffmpeg wiki <a href="https://trac.ffmpeg.org/wiki/FilteringGuide">Filtering Guide</a>.</p>
<p class="link"></p>
</div>
</div>
</div>
</div>
<!-- End Filtergraph explanation -->
</div>
<!-- sample example -->