CanvasK

Joined December 15, 2019
Documenting my gif making process in case any wants to be as in-control as I like to. This process also works for trimming mp4s and making webms without extra software
(Going to categorize and un-speedy delete the Mii Outfits in about an hour. I won't tag the rips as unused for about a week or two to give time for discussion)
(Documenting my gif making process in case any wants to be as in-control as I like to. This process also works for trimming mp4s and making webms without extra software)
Line 34: Line 34:
|[[User:CanvasK/SpiritBattleTable|SpiritBattleTable]]-->
|[[User:CanvasK/SpiritBattleTable|SpiritBattleTable]]-->
|}
|}
==How to GIF==
There's a lot of sites that make GIFs, however most of them either lack control, add watermarks, or both; ezgif.com has decent control and no watermarks and I recommend it if you don't want to go through with the process below. There are two things that will be needed to make your own GIFs without websites or expensive editing programs: [https://www.ffmpeg.org/ FFmpeg] and [https://www.lcdf.org/gifsicle/ Gifsicle] (optional). Both of these programs are free command-line tools. Below is a command that will work for most situations:
<pre>ffmpeg -ss <start_time> -t <duration> -i <video_file> -vf "crop=<c_width>:<c_height>:<c_topleft_x>:<c_topleft_y>,fps=<framerate>,scale=<width>:<height>:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 <output_file></pre>
Note: if "ffmpeg" or "gifsicle" aren't recognized as commands, find the location of the executable and use that. Example ffmpeg -> "C:\ffmpeg-4.2.2-win64-static\bin\ffmpeg.exe"
<pre>
start_time    = The first frame of the video. Can either be seconds or [HH:]MM:SS[.ms] format
duration      = How far after start_time to go
video_file    = Source file
output_file  = Output file
c_...        = Cropping. The width and height and the top-left corner coordinates
framerate    = The frames per second (fps) of the output. Due to GIF specifications, 50 fps is the technical max framerate possible
width, height = The width and height of the output. Either can be set to -1 to automatically change with the other. iw*x and ih*y can also be used to scale, example iw*.5 = 50% width
Any of the inputs (except video_file and output_file) can be removed if they are unneeded
split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse is to skirt around GIFs limited 256 color limit, either by dithering or creating a new set of 256 colors at a certain point
-loop 0 forces looping. Never tried without it so I don't know what happens without it
Example: ffmpeg -ss 4.0 -t 2.8333 -i "Min Min.mp4" -vf "fps=15,scale=600:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "MinMinOnScreenAppearanceSSBU.gif"
Use "Min Min.mp4", start 4 seconds in, go for 2.8333 seconds, play at 15 fps, scale width to 600, output to MinMinOnScreenAppearanceSSBU.gif.
</pre>
You are effectively done at this point. Afterwards Gifsicle can be used to reduce the filesize.
<pre>
gifsicle -b <gif_file> -O3 --lossy > <output_file>
gif_file    = Source file
output_file = Output file
-O3 lets Gifsicle determine how to optimize the file
--lossy means some data will may be lost. This isn't a concern because GIF's 256 color limit makes it barely noticeable
</pre>
To avoid doing multiple lines, we can "pipe" the FFmpeg output into Gifsicle's input:
<pre>
ffmpeg -ss <start_time> -t <duration> -i <video_file> -vf "crop=<c_width>:<c_height>:<c_topleft_x>:<c_topleft_y>,fps=<framerate>,scale=<width>:<height>:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 -f gif - | gifsicle -O3 --lossy > <output_file>
-f gif tells FFmpeg that the file will be a GIF, which is necessary for Gifsicle to process
Example: Example: ffmpeg -ss 4.0 -t 2.8333 -i "Min Min.mp4" -vf "fps=15,scale=600:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 -f gif - | gifsicle -O3 --lossy > "MinMinOnScreenAppearanceSSBU.gif"
</pre>
This will take care of almost everything you need for GIFs. See [https://ffmpeg.org/ffmpeg.html FFmpeg's] and [https://www.lcdf.org/gifsicle/man.html Gifsicle's] documentation for more details and other commands. And remember, it is pronounced GIF not GIF.


==WebM test==
==WebM test==
30,349

edits