Skip to content

Instantly share code, notes, and snippets.

@aahnik
Last active November 10, 2020 07:09
Show Gist options
  • Save aahnik/6ee62e9f9b08b33632958bad4604ee18 to your computer and use it in GitHub Desktop.
Save aahnik/6ee62e9f9b08b33632958bad4604ee18 to your computer and use it in GitHub Desktop.
Ubuntu records 30s .webm screencasts in Videos Folder via Ctrl+Shift+Alt+R, automatically convert them to GIF in Pictures Folder, and delete video file

Make GIF ScreenCasts of 30s

Ubuntu records 30s .webm screencasts in Videos Folder via Ctrl+Shift+Alt+R, automatically convert them to GIF in Pictures Folder, and delete video file

Make sure to have ffmpeg installed

  • Save the toGIF.sh in your Videos folder, link
  • make it executable chmod +x ~/Videos/toGIF.sh
  • Go to Settings ---> Keyboard Shortcuts ---> New ShortCut
  • Set a new shortcut like this

Screenshot from 2020-09-10 22-22-16

note: the command should be the path to shell script

  • now whenever you take short screencasts, via default Ctrl+Shift+Alt+R, execute the Shift+Ctrl+ALt+G
  • the script will run in background and convert all .webm in Videos folder to .gif in Pictures Folder, and delete video file.
  • Please let the screencast finish, and then initiate the conversion to GIF, otherwise, the GIF will be incomplete and the video will get deleted before its 30s duration.

Please take a look below for better understanding.

Step 1

Screencast from 10-09-20 10:41:39 PM IST webm_gif

Step 2

Screencast from 10-09-20 10:42:49 PM IST webm_gif

#!/bin/bash
cd /home/aahnik/Videos
for f in *.webm;
do
ffmpeg -i "$f" ../Pictures/"$f"_gif.gif;
rm "$f";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment