Skip to content

Instantly share code, notes, and snippets.

View keijiro's full-sized avatar

Keijiro Takahashi keijiro

View GitHub Profile
half3 Hue2RGB(half h)
{
h = frac(saturate(h)) * 6 - 2;
half3 rgb = saturate(half3(abs(h - 1) - 1, 2 - abs(h), 2 - abs(h - 2)));
#ifndef UNITY_COLORSPACE_GAMMA
rgb = GammaToLinearSpace(rgb);
#endif
return rgb;
}
@keijiro
keijiro / ffmpeg.bat
Created October 9, 2016 05:51
ffmpeg cheatsheet
:: Trim from 2″ for 3 seconds, and encode into a "Twitter friendly" format.
ffmpeg -i source.mp4 -pix_fmt yuv420p -an -ss 2 -t 3 temp.mp4
:: Make a palette for GIF.
ffmpeg -i temp.mp4 -vf palettegen=max_colors=24 palette.png
:: Make a GIF with the palette.
ffmpeg -i temp.mp4 -i palette.png -filter_complex "scale=400:-1:flags=lanczos[x];[x][1:v]paletteuse" -r 30 out.gif