Is there a way to record code typing and execution (as a video, gif etc) in RStudio?

I'd like to mimic the below demonstration of rcmdcheck used in its README. Is there a way (say, through an add-in) to do this in RStudio?

https://github.com/r-lib/rcmdcheck/raw/master/inst/rcmdcheck.gif

4 Likes

I just use Quicktime and convert afterwards with Handbrake or ffmpeg. There are alternatives, like Giphy Capture.

As far R packages, shinysense, which lets you access webcams, is under development, but I haven't seen anything for screencapture directly. I suspect writing a cross-platform solution would be complicated.

2 Likes

To follow up on this, if you're on Windows 10 the Windows Game Bar can be used to record your screen (even if you're not playing a game).

1 Like

You can see asciinema as a way to share your terminal session: https://asciinema.org/. See the GitHub - romainfrancois/rsciinema: r and asciinema for and R package backend but not done yet for RStudio.

1 Like

AFAIR I made this with asciinema and then https://github.com/marionebl/svg-term-cli to convert it to SVG. (Later converted to GIF.)

You cannot do this at the RStudio console, I believe, but you can use an RStudio terminal. Or any other terminal I guess.

1 Like

Thanks for sharing these resources. This inspired me to play with gifs and discover https://www.screentogif.com/. It's portable so you can install it even without admin privileges. Recording and editing is super easy. The output can be uploaded to imgur. You can include the imgur link in an .Rmd file as usual with ![](imgur-link-goes-here).

4 Likes

In my limited experience the Loom browser plugin is incredibly easy. You can get it here: https://www.useloom.com/

And watch me use it here:

1 Like

For what it's worth, my workflow is to use Quicktime to create a screen recording, then a magical command line invocation using ImageMagick's convert + ffmpeg to convert that to .gif for easy sharing:

# Use ffpmeg to quickly convert a .mov to a .gif.
# Primarily used for quickly converting screencasts
# into gifs (which can then be viewed online easily)
mov2gif () {

	if [ "$#" -eq 0 ]; then
		echo "Usage: mov2gif input [output]"
		return 1
	fi

	if [ "$#" -eq 1 ]; then
		OUTPUT="${1%.mov}".gif
	else
		OUTPUT="$2"
	fi

	ffmpeg -i "$1" -r 20 -f image2pipe -vcodec ppm - | \
		convert -delay 5 -fuzz 1% -layers Optimize -loop 0 - "${OUTPUT}"
}

I have this in my .bash_profile so I can easily use it in my terminal sessions.

5 Likes

ohhhhhh... that's nice!

If you are on Ubuntu (or derivatives) you can use Peek, which is stupidly easy and effective:

Peek%202019-05-14%2015-222

It will save directly to gif, APNG, WebM or MP4.

To install:

sudo add-apt-repository ppa:peek-developers/stable
sudo apt update
sudo apt install peek

Link:

The only drawback is that you cannot record the topmost part of your screen :\ .