From e02054502256d08cc0d26df6e2c360ad1740c981 Mon Sep 17 00:00:00 2001 From: kfrn Date: Wed, 1 Mar 2017 04:39:08 +1300 Subject: [PATCH] Tidy up: links, spacing, -> , -> --- index.html | 82 +++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/index.html b/index.html index c242a3f..0ea094f 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@

Each button displays helpful information about how to perform a wide variety of tasks using FFmpeg. To use this site, click on the task you would like to perform. A new window will open up with a sample command and a description of how that command works. You can copy this command and understand how the command works with a breakdown of each of the flags.

Tutorials

For FFmpeg basics, check out the program’s official website.

-

For instructions on how to install FFmpeg on Mac, Linux, and Windows, refer to Reto Kromer’s installation instructions.

+

For instructions on how to install FFmpeg on Mac, Linux, and Windows, refer to Reto Kromer’s installation instructions.

For Bash and command line basics, try the Command Line Crash Course. For a little more context presented in an ffmprovisr style, try explainshell.com!

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

@@ -364,7 +364,7 @@
ffmpeg
starts the command
-f image2
forces input or output file format. image2 specifies the image file demuxer.
-framerate 9
sets framerate to 9 frames per second
-
-pattern_type glob
tells ffmpeg that the following mapping should "interpret like a glob" (a "global command" function that relies on the * as a wildcard and finds everything that matches)
+
-pattern_type glob
tells ffmpeg that the following mapping should "interpret like a glob" (a "global command" function that relies on the * as a wildcard and finds everything that matches)
-i "input_image_*.jpg"
maps all files in the directory that start with input_image_, for example input_image_001.jpg, input_image_002.jpg, input_image_003.jpg... etc.
(The quotation marks are necessary for the above "glob" pattern!)
-vf scale=250x250
filter the video to scale it to 250x250; -vf is an alias for -filter:v
@@ -391,18 +391,18 @@
ffmpeg
starts the command
-i concat:input files
lists the input VOB files and directs ffmpeg to concatenate them. Each input file should be separated by a backslash and a pipe, like so:
-i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB
- The backslash is simply an escape character for the pipe (|).
+ The backslash is simply an escape character for the pipe (|).
-c:v libx264
sets the video codec as H.264
-c:a copy
audio remains as-is (no re-encode)
output_file.mp4
path and name of the output file
-

It’s also possible to adjust the quality of your output by setting the -crf and -preset values:

+

It’s also possible to adjust the quality of your output by setting the -crf and -preset values:

ffmpeg -i concat:input_file1\|input_file2\|input_file3 -c:v libx264 -crf 18 -preset veryslow -c:a copy output_file.mp4

-
-crf 18
sets the constant rate factor to a visually lossless value. Libx264 defaults to a crf of 23, considered medium quality; a smaller crf value produces a larger and higher quality video.
-
-preset veryslow
A slower preset will result in better compression and therefore a higher-quality file. The default is medium; slower presets are slow, slower, and veryslow.
+
-crf 18
sets the constant rate factor to a visually lossless value. Libx264 defaults to a crf of 23, considered medium quality; a smaller crf value produces a larger and higher quality video.
+
-preset veryslow
A slower preset will result in better compression and therefore a higher-quality file. The default is medium; slower presets are slow, slower, and veryslow.
-

Bear in mind that by default, libx264 will only encode a single video stream and a single audio stream, picking the ‘best’ of the options available. To preserve all video and audio streams, add -map parameters:

+

Bear in mind that by default, libx264 will only encode a single video stream and a single audio stream, picking the ‘best’ of the options available. To preserve all video and audio streams, add -map parameters:

ffmpeg -i concat:input_file1\|input_file2 -map 0:v -map 0:a -c:v libx264 -c:a copy output_file.mp4

-map 0:v
encodes all video streams
@@ -424,7 +424,7 @@

Transcode to H.265/HEVC

ffmpeg -i input_file -c:v libx265 -pix_fmt yuv420p -c:a copy output_file

This command takes an input file and transcodes it to H.265/HEVC in an .mp4 wrapper, keeping the audio codec the same as in the original file.

-

Note: ffmpeg must be compiled with libx265, the library of the H.265 codec, for this script to work. (Add the flag --with-x265 if using brew install ffmpeg method).

+

Note: ffmpeg must be compiled with libx265, the library of the H.265 codec, for this script to work. (Add the flag --with-x265 if using brew install ffmpeg method).

ffmpeg
starts the command
-i input file
path, name and extension of the input file
@@ -434,7 +434,7 @@
output file
path, name and extension of the output file

The libx265 encoding library defaults to a ‘medium’ preset for compression quality and a CRF of 28. CRF stands for ‘constant rate factor’ and determines the quality and file size of the resulting H.265 video. The CRF scale ranges from 0 (best quality [lossless]; largest file size) to 51 (worst quality; smallest file size).

-

A CRF of 28 for H.265 can be considered a medium setting, corresponding to a CRF of 23 in encoding H.264, but should result in about half the file size.

+

A CRF of 28 for H.265 can be considered a medium setting, corresponding to a CRF of 23 in encoding H.264, but should result in about half the file size.

To create a higher quality file, you can add these presets:

ffmpeg -i input_file -c:v libx265 -pix_fmt yuv420p -preset veryslow -crf 18 -c:a copy output_file

@@ -455,7 +455,7 @@
-

Note: Converting between colourspaces with ffmpeg can be done via either the colormatrix or colorspace filters, with colorspace allowing finer control (individual setting of colourspace, transfer characteristics, primaries, range, pixel format, etc). See this entry on the ffmpeg wiki, and the ffmpeg documentation for colormatrix and colorspace.

+

Note: Converting between colourspaces with ffmpeg can be done via either the colormatrix or colorspace filters, with colorspace allowing finer control (individual setting of colourspace, transfer characteristics, primaries, range, pixel format, etc). See this entry on the ffmpeg wiki, and the ffmpeg documentation for colormatrix and colorspace.


Convert colourspace and embed colourspace metadata

-

ffmpeg -i input_file -c:v libx264 -vf colormatrix=src:dst -color_primaries val -color_trc val -colorspace val output_file

+

ffmpeg -i input_file -c:v libx264 -vf colormatrix=src:dst -color_primaries val -color_trc val -colorspace val output_file

ffmpeg
starts the command
-i input file
path, name and extension of the input file
-c:v libx264
encode video as H.264
-
-vf colormatrix=src:dst
the video filter colormatrix will be applied, with the given source and destination colourspaces.
-
-color_primaries val
tags video with the given colour primaries.
+
-vf colormatrix=src:dst
the video filter colormatrix will be applied, with the given source and destination colourspaces.
+
-color_primaries val
tags video with the given colour primaries.
Accepted values include smpte170m (Rec.601, 525-line/NTSC version), bt470bg (Rec.601, 625-line/PAL version), bt709 (Rec.709), and bt2020 (Rec.2020). -
-color_trc val
tags video with the given transfer characteristics (gamma).
+
-color_trc val
tags video with the given transfer characteristics (gamma).
Accepted values include smpte170m (Rec.601, 525-line/NTSC version), gamma28 (Rec.601, 625-line/PAL version)1, bt709 (Rec.709), bt2020_10 (Rec.2020 10-bit), and bt2020_12 (Rec.2020 12-bit).
-
-colorspace val
tags video as being in the given colourspace.
+
-colorspace val
tags video as being in the given colourspace.
Accepted values include smpte170m (Rec.601, 525-line/NTSC version), bt470bg (Rec.601, 625-line/PAL version), bt709 (Rec.709), bt2020_cl (Rec.2020 constant luminance), and bt2020_ncl (Rec.2020 non-constant luminance).
output file
path, name and extension of the output file
@@ -534,8 +534,8 @@ MediaInfo screenshots of colourspace metadata

Using this command it is possible to add Rec.709 tags to a file that is actually Rec.601 (etc), so apply with caution!

These commands are relevant for H.264 and H.265 videos, encoded with libx264 and libx265 respectively.

-

Note: If you wish to embed colourspace metadata without changing to another colourspace, omit -vf colormatrix=src:dst. However, since it is libx264/libx265 that writes the metadata, it's not possible to add these tags without reencoding the video stream.

-

For all possible values for -color_primaries, -color_trc, and -colorspace, see the ffmpeg documentation on codec options.

+

Note: If you wish to embed colourspace metadata without changing to another colourspace, omit -vf colormatrix=src:dst. However, since it is libx264/libx265 that writes the metadata, it's not possible to add these tags without reencoding the video stream.

+

For all possible values for -color_primaries, -color_trc, and -colorspace, see the ffmpeg documentation on codec options.


1. Out of step with the regular pattern, -color-trc doesn't accept bt470bg; it is instead here referred to directly as gamma.
In the Rec.601 standard, 525-line/NTSC and 625-line/PAL video have assumed gammas of 2.2 and 2.8 respectively.

@@ -1017,13 +1017,13 @@
for file in *.MXF
starts the loop, and states what the input files will be. Here, the ffmpeg command within the loop will be applied to all files with an extension of .MXF.
The word ‘file’ is an arbitrary variable which will represent each .MXF file in turn as it is looped over.
do ffmpeg -i "$file"
carry out the following ffmpeg command for each input file.
- Per Bash syntax, within the command the variable is referred to by “$file”. The dollar sign is used to reference the variable ‘file’, and the enclosing quotation marks prevents reinterpretation of any special characters that may occur within the filename, ensuring that the original filename is retained.
+ Per Bash syntax, within the command the variable is referred to by “$file”. The dollar sign is used to reference the variable ‘file’, and the enclosing quotation marks prevents reinterpretation of any special characters that may occur within the filename, ensuring that the original filename is retained.
-map 0
retain all streams
-c copy
enable stream copy (no re-encode)
"${file%.MXF}.mov";
retaining the original file name, set the output file wrapper as .mov
done
complete; all items have been processed.
-

Note: the shell script (.sh file) and all .MXF files to be processed must be contained within the same directory, and the script must be run from that directory.
+

Note: the shell script (.sh file) and all .MXF files to be processed must be contained within the same directory, and the script must be run from that directory.
Execute the .sh file with the command sh Rewrap-MXF.sh.

Modify the script as needed to perform different transcodes, or to use with ffprobe. :)

The basic pattern will look similar to this:
@@ -1043,8 +1043,8 @@