mirror of
https://github.com/amiaopensource/ffmprovisr.git
synced 2025-10-15 10:19:56 +02:00
Compare commits
6 Commits
v2018-02-1
...
v2018-04-0
Author | SHA1 | Date | |
---|---|---|---|
|
b2d5fcadf3 | ||
|
05395f4670 | ||
|
078d20824c | ||
|
44c8661e96 | ||
|
13bc9bef10 | ||
|
585e0e1f18 |
100
index.html
100
index.html
@@ -37,6 +37,8 @@
|
||||
<a href="#ocr"><div class="contents-list">Use OCR</div></a>
|
||||
<a href="#perceptual-similarity"><div class="contents-list">Compare similarity of videos</div></a>
|
||||
<a href="#other"><div class="contents-list">Something else</div></a>
|
||||
<a href="#similar-tools"><div class="contents-list">Similar tools: tips & tricks</div></a>
|
||||
<a href="#imagemagick"><div class="contents-list">ImageMagick</div></a>
|
||||
</nav>
|
||||
|
||||
<div class="content">
|
||||
@@ -915,14 +917,14 @@
|
||||
<input type="checkbox" id="join_different_files">
|
||||
<div class="hiding">
|
||||
<h3>Join files together</h3>
|
||||
<p><code>ffmpeg -i input1.avi -i input2.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[video_out][audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p><code>ffmpeg -i input_1.avi -i input_2.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[video_out][audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p>This command takes two or more files of the different file types and joins them together to make a single file.</p>
|
||||
<p>The input files may differ in many respects - container, codec, chroma subsampling scheme, framerate, etc. However, the above command only works properly if the files to be combined have the same dimensions (e.g., 720x576). Also note that if the input files have different framerates, then the output file will be of variable framerate.</p>
|
||||
<p>Some aspects of the input files will be normalised: for example, if an input file contains a video track and an audio track that do not have exactly the same duration, the shorter one will be padded. In the case of a shorter video track, the last frame will be repeated in order to cover the missing video; in the case of a shorter audio track, the audio stream will be padded with silence.</p>
|
||||
<dl>
|
||||
<dt>ffmpeg</dt><dd>starts the command</dd>
|
||||
<dt>-i <i>input1.ext</i></dt><dd>path, name and extension of the first input file</dd>
|
||||
<dt>-i <i>input2.ext</i></dt><dd>path, name and extension of the second input file</dd>
|
||||
<dt>-i <i>input_1.ext</i></dt><dd>path, name and extension of the first input file</dd>
|
||||
<dt>-i <i>input_2.ext</i></dt><dd>path, name and extension of the second input file</dd>
|
||||
<dt>-filter_complex</dt><dd>states that a complex filtergraph will be used</dd>
|
||||
<dt>"</dt><dd>quotation mark to start filtergraph</dd>
|
||||
<dt>[0:v:0][0:a:0]</dt><dd>selects the first video stream and first audio stream from the first input.<br>
|
||||
@@ -954,10 +956,16 @@
|
||||
<p><code>-vf scale=1920:1080:flags=lanczos</code></p>
|
||||
<p>(The Lanczos scaling algorithm is recommended, as it is slower but better than the default bilinear algorithm).</p>
|
||||
<p>The rescaling should be applied just before the point where the streams to be used in the output file are listed. Select the stream you want to rescale, apply the filter, and assign that to a variable name (<code>rescaled_video</code> in the below example). Then you use this variable name in the list of streams to be concatenated.</p>
|
||||
<p><code>ffmpeg -i input1.avi -i input2.mp4 -filter_complex "[0:v:0] scale=1920:1080:flags=lanczos [rescaled_video], [rescaled_video] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [video_out] [audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p><code>ffmpeg -i input_1.avi -i input_2.mp4 -filter_complex "[0:v:0] scale=1920:1080:flags=lanczos [rescaled_video], [rescaled_video] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [video_out] [audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p>However, this will only have the desired visual output if the inputs have the same aspect ratio. If you wish to concatenate an SD and an HD file, you will also wish to pillarbox the SD file while upscaling. (See the <a href="https://amiaopensource.github.io/ffmprovisr/#SD_HD_2">Convert 4:3 to pillarboxed HD</a> command). The full command would look like this:</p>
|
||||
<p><code>ffmpeg -i input1.avi -i input2.mp4 -filter_complex "[0:v:0] scale=1440:1080:flags=lanczos, pad=1920:1080:(ow-iw)/2:(oh-ih)/2 [to_hd_video], [to_hd_video] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [video_out] [audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p>Here, the first input an SD file which needs to be upscaled to match the second input, which is 1920x1080. The scale filter enlarges the SD input to the height of the HD frame, keeping the 4:3 aspect ratio; then, the video is pillarboxed within a 1920x1080 frame.</p>
|
||||
<p><code>ffmpeg -i input_1.avi -i input_2.mp4 -filter_complex "[0:v:0] scale=1440:1080:flags=lanczos, pad=1920:1080:(ow-iw)/2:(oh-ih)/2 [to_hd_video], [to_hd_video] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [video_out] [audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p>Here, the first input is an SD file which needs to be upscaled to match the second input, which is 1920x1080. The scale filter enlarges the SD input to the height of the HD frame, keeping the 4:3 aspect ratio; then, the video is pillarboxed within a 1920x1080 frame.</p>
|
||||
<h4>Variation: concatenating files of different framerates</h4>
|
||||
<p>If the input files have different framerates, then the output file may be of variable framerate. To explicitly obtain an output file of constant framerate, you may wish convert an input (or multiple inputs) to a different framerate prior to concatenation.</p>
|
||||
<p>You can speed up or slow down a file using the <code>fps</code> and <code>atempo</code> filters (see also the <a href="https://amiaopensource.github.io/ffmprovisr/#modify_speed">Modify speed</a> command).</p>
|
||||
<p>Here's an example of the full command, in which input_1 is 30fps, input_2 is 25fps, and 25fps is the desired output speed.</p>
|
||||
<p><code>ffmpeg -i input_1.avi -i input_2.mp4 -filter_complex "[0:v:0] fps=fps=25 [video_to_25fps]; [0:a:0] atempo=(25/30) [audio_to_25fps]; [video_to_25fps] [audio_to_25fps] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [video_out] [audio_out]" -map "[video_out]" -map "[audio_out]" <i>output_file</i></code></p>
|
||||
<p>Note that the <code>fps</code> filter will drop or repeat frames as necessary in order to achieve the desired frame rate - see the FFmpeg <a href="https://ffmpeg.org/ffmpeg-filters.html#fps-1">fps docs</a> for more details.</p>
|
||||
<p>For more information, see the <a href="https://trac.ffmpeg.org/wiki/Concatenate#differentcodec" target="_blank">FFmpeg wiki page on concatenating files of different types</a>.</p>
|
||||
<p class="link"></p>
|
||||
</div>
|
||||
@@ -2303,6 +2311,86 @@
|
||||
</div>
|
||||
<!-- ends View Subprogram info -->
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h2 id="similar-tools">Similar tools: tips & tricks 🎩🐰</h2>
|
||||
<div class="well">
|
||||
<p>This section introduces and explains the usage of some additional command line tools similar to FFmpeg for use in digital preservation workflows (and beyond!).</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h2 id="imagemagick">ImageMagick</h2>
|
||||
|
||||
<!-- About ImageMagick -->
|
||||
<label class="recipe" for="im-basics">About ImageMagick</label>
|
||||
<input type="checkbox" id="im-basics">
|
||||
<div class="hiding">
|
||||
<h3>About ImageMagick</h3>
|
||||
<p>ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files.</p>
|
||||
<p>It's official website can be found <a href="https://www.imagemagick.org/script/index.php">here</a>.</p>
|
||||
<p>Another great resource with lots of supplemental explanations of filters is available at <a href="http://www.fmwconcepts.com/imagemagick/index.php">Fred's ImageMagick Scripts</a>.</p>
|
||||
<p>Unlike many other command line tools, ImageMagick isn't summoned by calling its name. Rather, ImageMagick installs links to several more specific commands: <code>convert</code>, <code>montage</code>, and <code>mogrify</code>, to name a few.</p>
|
||||
<p class="link"></p>
|
||||
</div>
|
||||
<!-- End About ImageMagick -->
|
||||
|
||||
<!-- Resize to width -->
|
||||
<label class="recipe" for="im_resize">Resizes image to specific pixel width</label>
|
||||
<input type="checkbox" id="im_resize">
|
||||
<div class="hiding">
|
||||
<h3>Resize to width</h3>
|
||||
<p><code>convert <i>input_file.ext</i> -resize 750 <i>output_file.ext</i></code></p>
|
||||
<p>This script will also convert the file format, if the output has a different file extension than the input.</p>
|
||||
<dl>
|
||||
<dt>convert</dt><dd>starts the command</dd>
|
||||
<dt>-i <i>input_file.ext</i></dt><dd>path and name of the input file</dd>
|
||||
<dt>-resize 750</dt><dd>resizes the image to 750 pixels wide, retaining aspect ratio</dd>
|
||||
<dt><i>output_file.ext</i></dt><dd>path and name of the output file</dd>
|
||||
</dl>
|
||||
<p class="link"></p>
|
||||
</div>
|
||||
<!-- ends Resize to width -->
|
||||
|
||||
<!-- Create thumbnails -->
|
||||
<label class="recipe" for="im_thumbs">Create thumbnails of images</label>
|
||||
<input type="checkbox" id="im_thumbs">
|
||||
<div class="hiding">
|
||||
<h3>Create thumbnails</h3>
|
||||
<p>Creates thumbnails for all files in a folder and saves them in that folder.</p>
|
||||
<p><code>mogrify -resize 80x80 -format jpg -quality 75 -path thumbs *.jpg</code></p>
|
||||
<dl>
|
||||
<dt>montage</dt><dd>starts the command</dd>
|
||||
<dt>-resize 80x80</dt><dd>resizes copies of original images to 80x80 pixels</dd>
|
||||
<dt>-format jpg</dt><dd>reformats original images to jpg</dd>
|
||||
<dt>-quality 75</dt><dd>sets quality to 75 (out of 100), adding light compression to smaller files</dd>
|
||||
<dt>-path thumbs</dt><dd>specifies where to save the thumbnails -- this goes to a folder within the active folder called "thumbs".<br>
|
||||
Note: You will have to make this folder if it doesn't already exist.</dd>
|
||||
<dt><i>*.jpg</i></dt><dd>The astericks acts as a "wildcard" to be applied to every file in the directory.</dd>
|
||||
</dl>
|
||||
<p class="link"></p>
|
||||
</div>
|
||||
<!-- ends Create thumbnails -->
|
||||
|
||||
<!-- Create grid of images -->
|
||||
<label class="recipe" for="im_grid">Creates grid of images from text file</label>
|
||||
<input type="checkbox" id="im_grid">
|
||||
<div class="hiding">
|
||||
<h3>Create grid of images</h3>
|
||||
<p><code>montage @<i>list.txt</i> -tile 6x12 -geometry +0+0 <i>output_grid.jpg</i></code></p>
|
||||
<dl>
|
||||
<dt>montage</dt><dd>starts the command</dd>
|
||||
<dt>@list.txt</dt><dd>path and name of a text file containing a list of filenames, one per each line</dd>
|
||||
<dt>-tile 6x12</dt><dd>specifies the dimensions of the proposed grid (6 images wide, 12 images long)</dd>
|
||||
<dt>-geometry +0+0</dt><dd>specifies to include no spacing around any of the tiles; they will be flush against each other</dd>
|
||||
<dt><i>output_grid.jpg</i></dt><dd>path and name of the output file</dd>
|
||||
</dl>
|
||||
<p class="link"></p>
|
||||
</div>
|
||||
<!-- ends Create grid of images -->
|
||||
|
||||
|
||||
</div>
|
||||
</div><!-- ends "content" -->
|
||||
|
||||
<!-- sample example -->
|
||||
|
Reference in New Issue
Block a user