[GH-ISSUE #404] [Feature request] Invoke recording with CLI #332

Closed
opened 2026-02-26 09:31:02 +03:00 by kerem · 5 comments
Owner

Originally created by @spyoungtech on GitHub (Dec 12, 2018).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/404

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.

Originally created by @spyoungtech on GitHub (Dec 12, 2018). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/404 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.
kerem 2026-02-26 09:31:02 +03:00
Author
Owner

@vatterspun commented on GitHub (Dec 15, 2018):

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.

<!-- gh-comment-id:447603202 --> @vatterspun commented on GitHub (Dec 15, 2018): > 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.
Author
Owner

@spyoungtech commented on GitHub (Dec 15, 2018):

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

<!-- gh-comment-id:447605716 --> @spyoungtech commented on GitHub (Dec 15, 2018): 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 ```powershell 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 ```powershell 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](https://stackoverflow.com/q/30782771/5747944). YMMV
Author
Owner

@vatterspun commented on GitHub (Dec 16, 2018):

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

<!-- gh-comment-id:447613101 --> @vatterspun commented on GitHub (Dec 16, 2018): Glad that suggestion yielded fruit. Also, thanks for detailing your solution, that's very likely to solve the problem for someone in the future.
Author
Owner

@vatterspun commented on GitHub (Feb 27, 2019):

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

<!-- gh-comment-id:467711621 --> @vatterspun commented on GitHub (Feb 27, 2019): 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
Author
Owner

@NickeManarin commented on GitHub (Jun 25, 2021):

Late to the party, but here is it: https://github.com/NickeManarin/ScreenToGif/wiki/Startup-parameters

<!-- gh-comment-id:868149789 --> @NickeManarin commented on GitHub (Jun 25, 2021): Late to the party, but here is it: https://github.com/NickeManarin/ScreenToGif/wiki/Startup-parameters
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#332
No description provided.