From 45828357c9c541e9f8753c492ad20b61cd5a9ea4 Mon Sep 17 00:00:00 2001 From: kfrn Date: Fri, 31 Mar 2017 16:26:08 +1300 Subject: [PATCH 1/4] Add more info to transcode H.264 command --- index.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 0a13701..235dae4 100644 --- a/index.html +++ b/index.html @@ -153,9 +153,12 @@

Transcode to H.264

In order to use the same basic command to make a higher quality file, you can add some of these presets:

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

-
-preset veryslow
This option tells ffmpeg to use the slowest preset possible for the best compression quality.
-
-crf 18
Specifying a lower CRF will make a larger file with better visual quality. 18 is often considered a “visually lossless” compression.
+
-preset veryslow
This option tells ffmpeg to use the slowest preset possible for the best compression quality.
+ Available presets, from slowest to fastest, are: veryslow, slower, slow, medium, fast, faster, veryfast, superfast, ultrafast.
+
-crf 18
Specifying a lower CRF will make a larger file with better visual quality. The scale ranges between 0-51, with 0 being lossless and 51 the worst possible quality.
+ If no crf is specified, libx264 will use a default value of 23. 18 is often considered a “visually lossless” compression.
+

For more information, see the FFmpeg and H.264 Encoding Guide on the ffmpeg wiki.

@@ -821,7 +824,7 @@

Create GIF

Simpler GIF creation

ffmpeg -ss HH:MM:SS -i input_file -vf "fps=10,scale=500:-1" -t 3 -loop 6 output_file

-

This is a quick and easy method. Dithering is more apparent than the above method using the palette* filters, but the file size will be smaller. Perfect for that “legacy” GIF look.

+

This is a quick and easy method. Dithering is more apparent than the above method using the palette filters, but the file size will be smaller. Perfect for that “legacy” GIF look.

From dca518a9b62ecec8f93f4f831ae7462588508103 Mon Sep 17 00:00:00 2001 From: kfrn Date: Fri, 31 Mar 2017 17:15:24 +1300 Subject: [PATCH 2/4] Add more explanation to GIF creation command --- index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 235dae4..1e75af5 100644 --- a/index.html +++ b/index.html @@ -817,11 +817,20 @@

Create GIF

ffmpeg
starts the command
-ss HH:MM:SS
starting point of the gif. If a plain numerical value is used it will be interpreted as seconds
-i input_file
path, name and extension of the input file
-
-filter_complex "fps=frame rate,scale=width:height,palettegen"
a complex filtergraph using the fps filter to set frame rate, the scale filter to resize, and the palettegen filter to generate the palette. The scale value of -1 preserves the aspect ratio
+
-filter_complex "fps=frame rate,scale=width:height,palettegen"
a complex filtergraph.
+ Firstly, the fps filter sets the frame rate.
+ Then the scale filter resizes the image. You can specify both the width and the height, or specify a value for one and use a scale value of -1 for the other to preserve the aspect ratio. (For example, 500:-1 would create a GIF 500 pixels wide and with a height proportional to the original video). In the first script above, :flags:lanczos specifies that the Lanczos rescaling algorithm will be used to resize the image.
+ Lastly, the palettegen filter generates the palette.
-t 3
duration in seconds (here 3; can be specified also with a full timestamp, i.e. here 00:00:03)
-loop 6
number of times to loop the gif. A value of -1 will disable looping. Omitting -loop will use the default which will loop infinitely
output_file
path, name and extension of the output file
+

The second command has a slightly different filtergraph, which breaks down as follows:

+
+
-filter_complex "[0:v]fps=10,scale=500:-1:flags=lanczos[v],[v][1:v]paletteuse"
+ [0:v]fps=10,scale=500:-1:flags=lanczos[v]: applies the fps and scale filters described above to the first input file (the video).
+ [v][1:v]paletteuse": applies the paletteuse filter, setting the second input file (the palette) as the reference file.
+

Simpler GIF creation

ffmpeg -ss HH:MM:SS -i input_file -vf "fps=10,scale=500:-1" -t 3 -loop 6 output_file

This is a quick and easy method. Dithering is more apparent than the above method using the palette filters, but the file size will be smaller. Perfect for that “legacy” GIF look.

From 6cea5862d670d1a956f07bcd2b1c8b049604ce83 Mon Sep 17 00:00:00 2001 From: kfrn Date: Fri, 31 Mar 2017 17:20:36 +1300 Subject: [PATCH 3/4] Fix typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 1e75af5..6ce5b59 100644 --- a/index.html +++ b/index.html @@ -819,7 +819,7 @@

Create GIF

-i input_file
path, name and extension of the input file
-filter_complex "fps=frame rate,scale=width:height,palettegen"
a complex filtergraph.
Firstly, the fps filter sets the frame rate.
- Then the scale filter resizes the image. You can specify both the width and the height, or specify a value for one and use a scale value of -1 for the other to preserve the aspect ratio. (For example, 500:-1 would create a GIF 500 pixels wide and with a height proportional to the original video). In the first script above, :flags:lanczos specifies that the Lanczos rescaling algorithm will be used to resize the image.
+ Then the scale filter resizes the image. You can specify both the width and the height, or specify a value for one and use a scale value of -1 for the other to preserve the aspect ratio. (For example, 500:-1 would create a gif 500 pixels wide and with a height proportional to the original video). In the first script above, :flags=lanczos specifies that the Lanczos rescaling algorithm will be used to resize the image.
Lastly, the palettegen filter generates the palette.
-t 3
duration in seconds (here 3; can be specified also with a full timestamp, i.e. here 00:00:03)
-loop 6
number of times to loop the gif. A value of -1 will disable looping. Omitting -loop will use the default which will loop infinitely
From bf55928a63a06a63a7f977b727b7ede9ddf3873f Mon Sep 17 00:00:00 2001 From: kfrn Date: Fri, 31 Mar 2017 20:06:20 +1300 Subject: [PATCH 4/4] =?UTF-8?q?Change=20gif=20->=20GIF;=20add=20note=20abo?= =?UTF-8?q?ut=20crf=20scale=20visis-=C3=A0-vis=20chroma=20subsampling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 6ce5b59..e2756f2 100644 --- a/index.html +++ b/index.html @@ -155,7 +155,7 @@

Transcode to H.264

-preset veryslow
This option tells ffmpeg to use the slowest preset possible for the best compression quality.
Available presets, from slowest to fastest, are: veryslow, slower, slow, medium, fast, faster, veryfast, superfast, ultrafast.
-
-crf 18
Specifying a lower CRF will make a larger file with better visual quality. The scale ranges between 0-51, with 0 being lossless and 51 the worst possible quality.
+
-crf 18
Specifying a lower CRF will make a larger file with better visual quality. For H.264 files being encoded with a 4:2:0 chroma subsampling scheme (i.e., using -pix_fmt yuv420p), the scale ranges between 0-51, with 0 being lossless and 51 the worst possible quality.
If no crf is specified, libx264 will use a default value of 23. 18 is often considered a “visually lossless” compression.

For more information, see the FFmpeg and H.264 Encoding Guide on the ffmpeg wiki.

@@ -387,7 +387,7 @@

MKV to MP4

Images to GIF

ffmpeg -f image2 -framerate 9 -pattern_type glob -i "input_image_*.jpg" -vf scale=250x250 output_file.gif

-

This will convert a series of image files into a gif.

+

This will convert a series of image files into a GIF.

ffmpeg
starts the command
-f image2
forces input or output file format. image2 specifies the image file demuxer.
@@ -815,14 +815,14 @@

Create GIF

The first command will use the palettegen filter to create a custom palette, then the second command will create the GIF with the paletteuse filter. The result is a high quality GIF.

ffmpeg
starts the command
-
-ss HH:MM:SS
starting point of the gif. If a plain numerical value is used it will be interpreted as seconds
+
-ss HH:MM:SS
starting point of the GIF. If a plain numerical value is used it will be interpreted as seconds
-i input_file
path, name and extension of the input file
-filter_complex "fps=frame rate,scale=width:height,palettegen"
a complex filtergraph.
Firstly, the fps filter sets the frame rate.
- Then the scale filter resizes the image. You can specify both the width and the height, or specify a value for one and use a scale value of -1 for the other to preserve the aspect ratio. (For example, 500:-1 would create a gif 500 pixels wide and with a height proportional to the original video). In the first script above, :flags=lanczos specifies that the Lanczos rescaling algorithm will be used to resize the image.
+ Then the scale filter resizes the image. You can specify both the width and the height, or specify a value for one and use a scale value of -1 for the other to preserve the aspect ratio. (For example, 500:-1 would create a GIF 500 pixels wide and with a height proportional to the original video). In the first script above, :flags=lanczos specifies that the Lanczos rescaling algorithm will be used to resize the image.
Lastly, the palettegen filter generates the palette.
-t 3
duration in seconds (here 3; can be specified also with a full timestamp, i.e. here 00:00:03)
-
-loop 6
number of times to loop the gif. A value of -1 will disable looping. Omitting -loop will use the default which will loop infinitely
+
-loop 6
number of times to loop the GIF. A value of -1 will disable looping. Omitting -loop will use the default which will loop infinitely
output_file
path, name and extension of the output file

The second command has a slightly different filtergraph, which breaks down as follows: