Screentogif: [Feature request] Invoke recording with CLI

Created on 12 Dec 2018  路  4Comments  路  Source: NickeManarin/ScreenToGif

Hi there, thanks for providing this great tool.

I have a use case where I'd like to automate the capture of gifs in my CI builds.
Something that would be useful is a way to invoke ScreenToGif, specifying the recording area, output file path, and (optionally?) length of time to record.

This has a few applications, including recording selenium webdriver tests, and automatically generating gifs for project documentation.

CLI parameters for settings, or perhaps a way this can be provided with a prepared file, would be useful, too.

If there are existing methods I can use to achieve this, any pointers would be much appreciated.

All 4 comments

If there are existing methods I can use to achieve this, any pointers would be much appreciated.

I think FFMPEG has some functionality to do CLI screen recording that outputs to GIF or APNG.

Good idea @vatterspun

I was able to accomplish this with the ffmpeg command from powershell specifying recording area (by x/y offsets and video size) for 10 seconds like so

ffmpeg -f gdigrab `
       -framerate 20 `
       -offset_x 100 `
       -offset_y 100 `
       -video_size 800x400 `
       -show_region 1 `
       -t 10 `
       -i desktop output.gif

Or to capture a window for 5 seconds

ffmpeg -f gdigrab `
       -f framerate 20 `
       -t 5 `
       -i title="Windows Powershell" output.gif

Only complaint is the output size, but I think I can tweak the parameters to get it optimal.

I also had to add -async 1 and -vsync 1 to avoid some repeating warning message. YMMV

Glad that suggestion yielded fruit. Also, thanks for detailing your solution, that's very likely to solve the problem for someone in the future.

Just a note that the also open source Captura screen recording software lists support for running from the command line: https://mathewsachin.github.io/Captura/changelog

Was this page helpful?
0 / 5 - 0 ratings