Compare commits

...

10 Commits

Author SHA1 Message Date
Katherine Frances Nagels
7c03ae2f80 Add recipes for merging files & cropping video (#277) 2017-11-05 20:13:29 +01:00
Ashley
affae48547 Merge pull request #275 from amiaopensource/break-lines-for-code-blocks
breaks long long lines for code and dt blocks
2017-11-01 11:37:22 -04:00
Ashley Blewer
11ab1ae731 breaks long long lines for code and dt blocks 2017-10-31 22:57:57 -04:00
Ashley
6b324152ac Merge pull request #273 from kfrn/gh-pages
Add max width on example images
2017-10-31 10:45:37 -04:00
kfrn
edaa0a3443 Merge branch 'gh-pages' of https://github.com/amiaopensource/ffmprovisr into gh-pages 2017-10-31 23:33:53 +13:00
kfrn
133f81db8e Add max width on example images 2017-10-31 23:32:32 +13:00
Ashley
634f72213b Merge pull request #272 from kfrn/gh-pages
Fix sizing issue at large resolutions
2017-10-30 22:40:05 -04:00
kfrn
94049d2338 Include CSS grid-template-areas on largest media query 2017-10-31 00:11:42 +13:00
Ashley
46356c3b98 Merge pull request #271 from kfrn/gh-pages
Add entry on stream mapping
2017-10-29 14:27:26 -04:00
kfrn
53d3cf8a74 Add entry on stream mapping 2017-10-30 00:26:37 +13:00
6 changed files with 105 additions and 3 deletions

View File

@@ -61,6 +61,10 @@ html, body {
.grid { .grid {
max-width: 70%; max-width: 70%;
margin: 0 auto; margin: 0 auto;
grid-template-areas:
"header header"
"sidebar content"
"footer footer";
} }
} }
@@ -116,6 +120,8 @@ code {
border-radius: 4px; border-radius: 4px;
word-break: break-all; word-break: break-all;
word-wrap: break-word; word-wrap: break-word;
white-space: normal;
display: inline-block;
} }
dd { dd {
@@ -124,6 +130,10 @@ dd {
dt { dt {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
word-break: break-all;
word-wrap: break-word;
white-space: normal;
display: inline-block;
} }
img { img {
@@ -134,7 +144,17 @@ img {
} }
.sample-image { .sample-image {
margin: 0 auto;
margin-bottom: 18px; margin-bottom: 18px;
max-width: 500px;
text-align: center;
}
.sample-image-small {
margin: 0 auto;
margin-bottom: 18px;
max-width: 250px;
text-align: center;
} }
div { div {

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
img/crop_example_orig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

View File

@@ -117,6 +117,34 @@
</div> </div>
<!-- End Filtergraph explanation --> <!-- End Filtergraph explanation -->
<!-- Stream mapping explanation -->
<label class="recipe" for="stream-mapping">Stream mapping</label>
<input type="checkbox" id="stream-mapping">
<div class="hiding">
<h3>Stream mapping</h3>
<p>Stream mapping is the practice of defining which of the streams (e.g., video or audio tracks) present in an input file will be present in the output file. FFmpeg recognises five stream types:</p>
<ul>
<li><code>a</code> - audio</li>
<li><code>v</code> - video</li>
<li><code>s</code> - subtitle</li>
<li><code>d</code> - data (including timecode tracks)</li>
<li><code>t</code> - attachment</li>
</ul>
<p>Mapping is achieved by use of the <code>-map</code> flag, followed by an action of the type <code>file_number:stream_type[:stream_number]</code>. Numbering is zero-indexed, and it's possible to map by stream type and/or overall stream order within the input file. For example:</p>
<ul>
<li><code>-map 0:v</code> means take all video streams from the first input file.</li>
<li><code>-map 0:3</code> means take the fourth stream from the first input file.</li>
<li><code>-map 0:a:2</code> means take the third audio stream from the first input file.</li>
<li><code>-map 0:0 -map 0:2</code> means take the first and third streams from the first input file.</li>
<li><code>-map 0:1 -map 1:0</code> means take the second stream from the first input file and the first stream from the second input file.</li>
</ul>
<p>To map <i>all</i> streams in the input file to the output file, use <code>-map 0</code>. However, note that not all container formats can include all stream types: for example, .mp4 cannot contain timecode.</p>
<p>When no mapping is specified in an ffmpeg command, the default for video files is to take just one video and one audio stream for the output: other stream types, such as timecode or subtitles, will not be copied to the output file by default. If multiple video or audio streams are present, the best quality one is automatically selected by FFmpeg.</p>
<p>For more information, check out the FFmpeg wiki <a href="https://trac.ffmpeg.org/wiki/Map" target="_blank">Map</a> page, and the official FFmpeg <a href="http://ffmpeg.org/ffmpeg.html#Advanced-options" target="_blank">documentation on <code>-map</code></a>.</p>
<p class="link"></p>
</div>
<!-- End Stream Mapping explanation -->
</div> </div>
<div class="well"> <div class="well">
<h2 id="rewrap">Change container (rewrap)</h2> <h2 id="rewrap">Change container (rewrap)</h2>
@@ -638,6 +666,36 @@
</div> </div>
<!-- ends Make stream properties explicate --> <!-- ends Make stream properties explicate -->
<!-- Crop video -->
<label class="recipe" for="crop_video">Crop video</label>
<input type="checkbox" id="crop_video">
<div class="hiding">
<h3>Crop video</h3>
<p><code>ffmpeg -i <i>input_file</i> -vf "crop=<i>width</i>:<i>height</i>" <i>output_file</i></code></p>
<p>This command crops the input video to the dimensions defined</p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>
<dt>-i <i>input_file</i></dt><dd>path, name and extension of the input file</dd>
<dt>-vf "<i>width</i>:<i>height</i>"</dt><dd>Crops the video to the given width and height (in pixels).<br>
By default, the crop area is centred: that is, the position of the top left of the cropped area is set to x = (<i>input_width</i> - <i>output_width</i>) / 2, y = <i>input_height</i> - <i>output_height</i>) / 2.
</dd>
<dt><i>output_file</i></dt><dd>path, name and extension of the output file</dd>
</dl>
<p>It's also possible to specify the crop position by adding the x and y coordinates representing the top left of your cropped area to your crop filter, as such:</p>
<p><code>ffmpeg -i <i>input_file</i> -vf "crop=<i>width</i>:<i>height</i>[:<i>x_position</i>:<i>y_position</i>]" <i>output_file</i></code></p>
<h3>Examples</h3>
<p>The original frame, a screenshot of the SMPTE colourbars:</p>
<img class="sample-image" src="img/crop_example_orig.png" alt="VLC screenshot of Maggie Cheung">
<p>Result of the command <code>ffmpeg -i <i>smpte_coloursbars.mov</i> -vf "crop=500:500" <i>output_file</i></code>:</p>
<img class="sample-image-small" src="img/crop_example_aftercrop1.png" alt="VLC screenshot of Maggie Cheung, cropped from original">
<p>Result of the command <code>ffmpeg -i <i>smpte_coloursbars.mov</i> -vf "crop=500:500:0:0" <i>output_file</i></code>, appending <code>:0:0</code> to crop from the top left corner:</p>
<img class="sample-image-small" src="img/crop_example_aftercrop2.png" alt="VLC screenshot of Maggie Cheung, cropped from original">
<p>Result of the command <code>ffmpeg -i <i>smpte_coloursbars.mov</i> -vf "crop=500:300:500:30" <i>output_file</i></code>:</p>
<img class="sample-image-small" src="img/crop_example_aftercrop3.png" alt="VLC screenshot of Maggie Cheung, cropped from original">
<p class="link"></p>
</div>
<!-- ends Crop video -->
</div> </div>
<div class="well"> <div class="well">
<h2 id="audio-files">Change or view audio properties</h2> <h2 id="audio-files">Change or view audio properties</h2>
@@ -1938,20 +1996,44 @@
<input type="checkbox" id="split_audio_video"> <input type="checkbox" id="split_audio_video">
<div class="hiding"> <div class="hiding">
<h3>Split audio and video tracks</h3> <h3>Split audio and video tracks</h3>
<p><code>ffmpeg -i <i>input_file</i> -map <i>0:v:0 video_output_file</i> -map <i>0:a:0 audio_output_file</i></code></p> <p><code>ffmpeg -i <i>input_file</i> -map 0:v:0 <i>video_output_file</i> -map 0:a:0 <i>audio_output_file</i></code></p>
<p>This command splits the original input file into a video and audio stream. The -map command identifies which streams are mapped to which file. To ensure that youre mapping the right streams to the right file, run ffprobe before writing the script to identify which streams are desired.</p> <p>This command splits the original input file into a video and audio stream. The -map command identifies which streams are mapped to which file. To ensure that youre mapping the right streams to the right file, run ffprobe before writing the script to identify which streams are desired.</p>
<dl> <dl>
<dt>ffmpeg</dt><dd>starts the command</dd> <dt>ffmpeg</dt><dd>starts the command</dd>
<dt>-i <i>input_file</i></dt><dd>path, name and extension of the input file</dd> <dt>-i <i>input_file</i></dt><dd>path, name and extension of the input file</dd>
<dt>-map <i>0:v:0</i></dt><dd>grabs the first video stream and maps it into:</dd> <dt>-map 0:v:0</dt><dd>grabs the first video stream and maps it into:</dd>
<dt><i>video_output_file</i></dt><dd>path, name and extension of the video output file</dd> <dt><i>video_output_file</i></dt><dd>path, name and extension of the video output file</dd>
<dt>-map <i>0:a:0</i></dt><dd>grabs the first audio stream and maps it into:</dd> <dt>-map 0:a:0</dt><dd>grabs the first audio stream and maps it into:</dd>
<dt><i>audio_output_file</i></dt><dd>path, name and extension of the audio output file</dd> <dt><i>audio_output_file</i></dt><dd>path, name and extension of the audio output file</dd>
</dl> </dl>
<p class="link"></p> <p class="link"></p>
</div> </div>
<!-- ends Split audio and video tracks --> <!-- ends Split audio and video tracks -->
<!-- Merge audio and video tracks -->
<label class="recipe" for="merge_audio_video">Merge audio and video tracks</label>
<input type="checkbox" id="merge_audio_video">
<div class="hiding">
<h3>Merge audio and video tracks</h3>
<p><code>ffmpeg -i <i>video_file</i> -i <i>audio_file</i> -map 0:v -map 1:a -c copy <i>output_file</i></code></p>
<p>This command takes a video file and an audio file as inputs, and creates an output file that combines the video stream in the first file with the audio stream in the second file.</p>
<dl>
<dt>ffmpeg</dt><dd>starts the command</dd>
<dt>-i <i>video_file</i></dt><dd>path, name and extension of the first input file (the video file)</dd>
<dt>-i <i>audio_file</i></dt><dd>path, name and extension of the second input file (the audio file)</dd>
<dt>-map <i>0:v</i></dt><dd>selects the video streams from the first input file</dd>
<dt>-map <i>1:a</i></dt><dd>selects the audio streams from the second input file</dd>
<dt>-c copy</dt><dd>copies streams without re-encoding</dd>
<dt><i>output_file</i></dt><dd>path, name and extension of the output file</dd>
</dl>
<p><b>Note:</b> in the example above, the video input file is given prior to the audio input file. However, input files can be added any order, as long as they are indexed correctly when stream mapping with <code>-map</code>. See the entry on <a href="#stream-mapping">stream mapping</a>.</p>
<h4>Variation:</h4>
<p>Include the audio tracks from both input files with the following command:</p>
<p><code>ffmpeg -i <i>video_file</i> -i <i>audio_file</i> -map 0:v -map 0:a -map 1:a -c copy <i>output_file</i></code></p>
<p class="link"></p>
</div>
<!-- ends Merge audio and video tracks -->
<!-- Create ISO --> <!-- Create ISO -->
<label class="recipe" for="create_iso">Create ISO files for DVD access</label> <label class="recipe" for="create_iso">Create ISO files for DVD access</label>
<input type="checkbox" id="create_iso"> <input type="checkbox" id="create_iso">