Compare commits

...

21 Commits

Author SHA1 Message Date
Ashley
f0e0cf8ed3 Merge pull request #286 from amiaopensource/life
adds game of life to test files
2017-12-04 14:31:08 -05:00
Ashley
5c1c336d77 adds extra linebreak 2017-12-04 14:30:35 -05:00
Ashley
d71793583e Merge pull request #285 from amiaopensource/link-to-site-locally
links to website permalink even when loading locally
2017-12-04 14:26:54 -05:00
Ashley
6705bdf41d Merge pull request #282 from amiaopensource/smpte-sine
smpte_sinewave should not end in .wav
2017-12-04 14:26:38 -05:00
Ashley
25e779a59f Merge pull request #284 from amiaopensource/streaming-vs-saving
explains difference between streaming w ffplay and saving w ffmpeg
2017-12-03 21:10:48 -05:00
Ashley
ba0852a957 Merge pull request #287 from amiaopensource/http-patch
link without http wasn't cutting it; threw error
2017-12-03 21:10:25 -05:00
Ashley
88024c040f link without http wasn't cutting it; threw error 2017-12-03 20:02:32 -05:00
Ashley Blewer
3d9b9edf1c adds game of life to test files 2017-12-03 13:31:03 -05:00
Ashley Blewer
c0326ad7d9 links to website permalink even when loading locally 2017-12-03 12:14:33 -05:00
Ashley Blewer
0cb6827b39 explains difference between streaming w ffplay and saving w ffmpeg 2017-12-03 11:52:51 -05:00
Reto Kromer
0d68614c04 Merge pull request #283 (removes extra colon in BRNG recipe description) 2017-12-03 00:08:36 +01:00
Ashley
1e86b70ba4 removes extra colon in BRNG recipe description 2017-12-01 17:55:54 -05:00
Ashley
ced142a215 Merge pull request #281 from amiaopensource/rm-breakall
lifts the break-all and sets a max-width on code for long lines
2017-11-30 16:52:15 -05:00
Ashley
bf301daa71 smpte_sinewave should not end in .wav 2017-11-30 16:23:24 -05:00
Ashley Blewer
278ac2baae allows code to break for small screens only 2017-11-28 16:16:50 -05:00
Ashley Blewer
10b8e4c941 lifts the break-all and sets a max-width on code for long lines 2017-11-28 16:06:43 -05:00
Ashley
1d1b3e4eac Merge pull request #280 from amiaopensource/andrew
adds andrew as maintainer
2017-11-28 14:11:16 -05:00
Ashley Blewer
5a3e437d76 adds andrew as maintainer 2017-11-28 12:38:41 -05:00
Ashley
75a7aa1299 Merge pull request #278 from amiaopensource/modern_HTML
use modern HTML
2017-11-13 15:57:46 +01:00
Reto Kromer
cf13529485 use modern HTML 2017-11-13 15:31:07 +01:00
Katherine Frances Nagels
7c03ae2f80 Add recipes for merging files & cropping video (#277) 2017-11-05 20:13:29 +01:00
9 changed files with 117 additions and 11 deletions

View File

@@ -44,6 +44,9 @@ html, body {
"content"
"footer";
}
code {
word-break: break-all;
}
}
@media only screen and (min-width: 1000px) {
@@ -118,8 +121,8 @@ code {
color: #c7254e;
background-color: #f9f2f4;
border-radius: 4px;
word-break: break-all;
word-wrap: break-word;
max-width: 800px;
white-space: normal;
display: inline-block;
}
@@ -150,6 +153,13 @@ img {
text-align: center;
}
.sample-image-small {
margin: 0 auto;
margin-bottom: 18px;
max-width: 250px;
text-align: center;
}
div {
font-family: 'Merriweather', serif;
color: white;

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

BIN
img/life.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

View File

@@ -83,6 +83,20 @@
</div>
<!-- End Basic structure of an FFmpeg command -->
<!-- Streaming vs. Saving -->
<label class="recipe" for="streaming-saving">Streaming vs. Saving</label>
<input type="checkbox" id="streaming-saving">
<div class="hiding">
<h3>Streaming vs. Saving</h3>
<p>FFplay allows you to stream created video and FFmpeg allows you to save video.</p>
<p>The following command creates and saves a 10-second video of SMPTE bars:</p>
<code>ffmpeg -f lavfi -i smptebars=size=640x480 -t 5 output_file</code>
<p>This command plays and streams SMPTE bars but does not save them on the computer:</p>
<code>ffplay -f lavfi smptebars=size=640x480</code>
<p>The main difference is small but significant: the <code>-i</code> flag is required for FFmpeg but not required for FFplay. Additionally, the FFmpeg script needs to have <code>-t 5</code> and <code>output.mkv</code> added to specify the length of time to record and the place to save the video.</p>
<p class="link"></p>
</div>
<!-- End Streaming vs. Saving -->
</div>
<div class="well">
<h2 id="concepts">Learn about more advanced FFmpeg concepts</h2>
@@ -666,6 +680,36 @@
</div>
<!-- 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 class="well">
<h2 id="audio-files">Change or view audio properties</h2>
@@ -1387,7 +1431,7 @@
<dt>"</dt><dd>quotation mark to start the lavfi filtergraph</dd>
<dt>movie='<i>input.mp4</i>'</dt><dd>declares video file source to apply filter</dd>
<dt>,</dt><dd>comma signifies closing of video source assertion and ready for filter assertion</dd>
<dt>signalstats=out=brng:</dt><dd>tells ffplay to use the signalstats command, output the data, use the brng filter</dd>
<dt>signalstats=out=brng</dt><dd>tells ffplay to use the signalstats command, output the data, use the brng filter</dd>
<dt>:</dt><dd>indicates theres another parameter coming</dd>
<dt>color=cyan[out]</dt><dd>sets the color of out-of-range pixels to cyan</dd>
<dt>"</dt><dd>quotation mark to end the lavfi filtergraph</dd>
@@ -1471,7 +1515,7 @@
<dt>-show_data</dt><dd>adds a short “hexdump” to show_streams command output</dd>
<dt>-print_format</dt><dd>Set the output printing format (in this example “xml”; other formats include “json” and “flat”)</dd>
</dl>
<p>See also the <a href="www.ffmpeg.org/ffprobe.html" target="_blank"> FFmpeg documentation on ffprobe</a> for a full list of flags, commands, and options.</p>
<p>See also the <a href="http://www.ffmpeg.org/ffprobe.html" target="_blank"> FFmpeg documentation on ffprobe</a> for a full list of flags, commands, and options.</p>
<p class="link"></p>
</div>
<!-- ends Pull specs -->
@@ -1826,7 +1870,7 @@
<dt>-c:a pcm_s16le</dt><dd>encodes the audio codec in <code>pcm_s16le</code> (the default encoding for wav files). <code>pcm</code> represents pulse-code modulation format (raw bytes), <code>16</code> means 16 bits per sample, and <code>le</code> means "little endian"</dd>
<dt>-t 10</dt><dd>specifies recording time of 10 seconds</dd>
<dt>-c:v ffv1</dt><dd>Encodes to <a href="https://en.wikipedia.org/wiki/FFV1" target="_blank">FFV1</a>. Alter this setting to set your desired codec.</dd>
<dt><i>output_file</i>.wav</dt><dd>path, name and extension of the output file</dd>
<dt><i>output_file</i></dt><dd>path, name and extension of the output file</dd>
</dl>
<p class="link"></p>
</div>
@@ -1850,6 +1894,31 @@
</div>
<!-- ends Broken File -->
<!-- Game of Life -->
<label class="recipe" for="game_of_life">Conway's Game of Life</label>
<input type="checkbox" id="game_of_life">
<div class="hiding">
<h3>Conway's Game of Life</h3>
<p>Simulates <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway's Game of Life</a></p>
<p><code>ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800</code></p>
<dl>
<dt>ffplay</dt><dd>starts the command</dd>
<dt>-f lavfi</dt><dd>tells ffplay to use the <a href="http://ffmpeg.org/ffmpeg-devices.html#lavfi" target="_blank">Libavfilter</a> input virtual device</dd>
<dt>life=s=300x200</dt><dd>use the life filter and set the size of the video to 300x200</dd>
<dt>:</dt><dd>indicates theres another parameter coming</dd>
<dt>mold=10:r=60:ratio=0.1</dt><dd>sets up the rules of the game: cell mold speed, video rate, and random fill ratio</dd>
<dt>:</dt><dd>indicates theres another parameter coming</dd>
<dt>death_color=#C83232:life_color=#00ff00</dt><dd>specifies color for cell death and cell life; mold_color can also be set</dd>
<dt>,</dt><dd>comma signifies closing of video source assertion and ready for filter assertion</dd>
<dt>scale=1200:800</dt><dd>scale to 1280 width and 800 height</dd>
</dl>
<img src="img/life.gif" alt="GIF of above command">
<p>To save a portion of the stream instead of playing it back infinitely, use the following command:</p>
<p><code>ffmpeg -f lavfi -i life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800 -t 5 <i>output_file</i></code></p>
<p class="link"></p>
</div>
<!-- ends Game of Life -->
</div>
<div class="well">
<h2 id="ocr">Use OCR</h2>
@@ -1966,20 +2035,44 @@
<input type="checkbox" id="split_audio_video">
<div class="hiding">
<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>
<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>-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>-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>
</dl>
<p class="link"></p>
</div>
<!-- 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 -->
<label class="recipe" for="create_iso">Create ISO files for DVD access</label>
<input type="checkbox" id="create_iso">

View File

@@ -3,10 +3,11 @@ $(document).ready(function() {
// open recipe window if a hash is found in URL
if(window.location.hash) {
id = window.location.hash
console.log(id.substring(1))
document.getElementById(id.substring(1)).checked = true;
$('html, body').animate({ scrollTop: $(id).offset().top}, 1000);
$(id).closest('div').find('.link').empty();
$(id).closest('div').find('.link').append("<small>Link to this command: <a href="+window.location.href+">"+window.location.href+"</a></small>");
$(id).closest('div').find('.link').append("<small>Link to this command: <a href='https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"'>https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"</a></small>");
}
// add hash URL when recipe is opened
@@ -14,7 +15,7 @@ $(document).ready(function() {
id = $(this).attr("for");
window.location.hash = ('#' + id)
$('#' + id).closest('div').find('.link').empty();
$('#' + id).closest('div').find('.link').append("<small>Link to this command: <a href="+window.location.href+">"+window.location.href+"</a></small>");
$('#' + id).closest('div').find('.link').append("<small>Link to this command: <a href='https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"'>https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"</a></small>");
});
});

View File

@@ -44,7 +44,7 @@ You can read our contributor code of conduct [here](https://github.com/amiaopens
## Maintainers
[Ashley Blewer](https://github.com/ablwr), [Katherine Frances Nagels](https://github.com/kfrn), [Kieran O'Leary](https://github.com/kieranjol) and [Reto Kromer](https://github.com/retokromer)
[Ashley Blewer](https://github.com/ablwr), [Katherine Frances Nagels](https://github.com/kfrn), [Kieran O'Leary](https://github.com/kieranjol), [Reto Kromer](https://github.com/retokromer) and [Andrew Weaver](https://github.com/privatezero)
## Contributors
* Gathered using [octohatrack](https://github.com/LABHR/octohatrack)
@@ -104,4 +104,6 @@ All Contributors: 22
## License
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/80x15.png" /></a><br />This <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" rel="dct:type">work</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://amiaopensource.github.io/ffmprovisr/" property="cc:attributionName" rel="cc:attributionURL">ffmprovisr</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://github.com/amiaopensource/ffmprovisr" rel="dct:source">https://github.com/amiaopensource/ffmprovisr</a>.
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/80x15.png"></a><br>
This <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" rel="dct:type">work</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://amiaopensource.github.io/ffmprovisr/" property="cc:attributionName" rel="cc:attributionURL">ffmprovisr</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.<br>
Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://github.com/amiaopensource/ffmprovisr" rel="dct:source">https://github.com/amiaopensource/ffmprovisr</a>.