## Introduction
Sometimes I want to make a screencapture of a websites behaviour.
In Chrome, I am quite happy doing this with the [Awesome Screenshot: Screen Video Recorder][1] extension.
Besides screenshots, the extension offers the ability to make a recording. (Limited to 30 seconds in the free version).
The recording can be uploaded to Youtube or Google Drive. It can also be downloaded as WebM file.
Often, I want to share the recording with co-workers on Slack.
Besides the fact that Slack does not support WebM, I dislike uploading several MBs of recording.
To remedy this, I convert the recording to a (smaller) GIF and share that on Slack.
## Converting
To convert the WebM to GIF, I use [FFmpeg][2]. I then use [Gifsicle][3] to resize and optimize the created GIF.
I've found that 600 pixels height is a nice compromise between size and readablility (when text is involved).
The command I use for this is:
```bash
sInput='/path/to/file.webm';
sOutput="$(basename ${sInput%.*})";
ffmpeg -i "${sInput}" -pix_fmt rgb8 "${sOutput}.gif" \
&& gifsicle --optimize=3 --output "${sOutput}-optimized.gif" --resize-height 600 "${sOutput}.gif"
```
This will easily turn a 2.5M WebM file to a 600K GIF. Without optimization it would be roughly 3.5M.
I'm sure more optimizations are possible, I might add these later.
It would also be simple to turn the command into a function. I might do _that_ later as well.
<!-- TODO:
## Explaining the command
`--optimize[=level]` Optimize output GIF animations for space. Level determines how much optimization is done; higher levels take longer, but may have better results. There are currently three levels:
- `-O1` Stores only the changed portion of each image. This is the default.
- `-O2` Also uses transparency to shrink the file further.
- `-O3` Try several optimization methods (usually slower, sometimes better results).
-->
[1]: https://chrome.google.com/webstore/detail/awesome-screenshot-screen/nlipoenfbbikpbjkfpfillcgkoblgpmj
[2]: https://www.ffmpeg.org
[3]: https://www.lcdf.org/gifsicle/