|
| 1 | +--- |
| 2 | +title: "Embedding videos in Google Slides as GIFs" |
| 3 | +author: Tamas Nagy |
| 4 | +layout: post |
| 5 | +tags: [science, productivity] |
| 6 | +--- |
| 7 | + |
| 8 | +In my field, systems biology, it's pretty common to take time-lapse movies |
| 9 | +to get the dynamics of how the system behaves. And we like showing them |
| 10 | +off. This makes Google Slides[^1] inability to embed videos (without |
| 11 | +uploading them to Youtube) pretty annoying and inconvenient. Slides does, |
| 12 | +on the other hand, have good support for embedding GIFs. I came up with |
| 13 | +the following pipeline (based on notedible's comment on |
| 14 | +[Stackoverflow](https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality)). |
| 15 | +First, make sure to install `libav` and `imagemagick`. On Debian-based |
| 16 | +systems, you can run |
| 17 | + |
| 18 | +``` |
| 19 | +sudo apt-get install libav-tools imagemagick |
| 20 | +``` |
| 21 | + |
| 22 | +and on MacOS[^2] the easiest way to install them is via |
| 23 | +[homebrew](http://brew.sh). Then I use the following command to create the GIF: |
| 24 | + |
| 25 | +``` |
| 26 | +cat some_movie.m4v | avconv -i pipe: -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - gif:- | convert -layers Optimize - output.gif |
| 27 | +``` |
| 28 | + |
| 29 | +where `some_movie.m4v` is the video file. This creates an optimized GIF |
| 30 | +version called `output.gif`, which you can then upload to Google Slides. |
| 31 | +The last niggle is that the GIFs play continuously and sometimes it's |
| 32 | +helpful to be able to stop/start the playback. Enter the [Toggle Animated |
| 33 | +Gifs](https://addons.mozilla.org/en-US/firefox/addon/toggle-animated-gifs/) |
| 34 | +extension for Firefox (I'm sure there's something comparable for Chrome), |
| 35 | +which lets you do just that. |
| 36 | + |
| 37 | + |
| 38 | +[^1]: I like Google Slides for a variety of reasons, but the main ones are |
| 39 | +its simplicity, portability, and collaboration features. Hard to beat for |
| 40 | +presentations. |
| 41 | + |
| 42 | +[^2]: OS X dammit |
0 commit comments