Use Gifski (Homebrew Package) to Convert a Video File to a Gif Image

I actually fixed that as well with version 1.1 which is in my initial post. :wink:

Thank you very much for your feedback and willingness to test it! You helped me polish it :grin:

1 Like

Thanks. I didn't expect that to work, because I originally installed it using Homebrew, and not until after I saw your macro post. But sometimes the versions cross in the ether, so I tried "brew reinstall gifski", but that didn't work. I made copies of the later versions of the aliases in the ffmpeg lib folder and gave them the names listed in the error messages (yeah, that's hacking), but it must not be compatible, because then I ended up with the abort 6 trap. It'll be updated eventually, and I'll try it again.

Ah man I'm sorry that didn't work for you! To be honest it sounds like your knowledge of shell scripts and Homebrew is quite beyond mine so I'm not sure what else to do to help. :frowning:

But please do post when you're able to figure it out in case anybody else runs into a similar issue!

No worries, it's still a great macro! And Gif Brewery 3 still works fine when I need it. Thanks!

1 Like

Would you be willing to help me track the variables in this shortcut? I don't understand why, I guess it's just my memory, but I can't seem to string together the realized contents of the variables. I'm not even able to view the variables' values in the Inspector, and I'm confused about why. I've used both """, "%" but no success. I thought it would be related to tokens vs. variables, but no.

I'm able to use Gifski without error when running a command according to its man entry in Terminal, but your shortcut still fails with references to libraries, so I want to see the actual command that's being constructed. I've managed this before quite easily with other commands in KM editor, but there must be something about the way KM editor works that is contrary to my approach, because if I leave it for a week or two then come back, I'm simply vacant. Thanks.

Yea no problem! Let me take a look at it and get back to you shortly. FWIW, all the variables are local so they will not show up in the Values Inspector.

EDIT: @Lantro please place this group of actions above the shell script (and ideally just disable the shell script for the time being).

They will set your clipboard to the complete shell script string as well as display it in a window.

Debugging options for Gifski ideo to GIF conversion macro (for Lantro).kmmacros (3.9 KB)

Macro screenshot (click to expand/collapse)

On another note, whenever I am building and/or debugging a macro, I use global variables prepended with debug__ that way I can see them in real-time in the Value Inspector.

If you're interested, I have a macro set that will automatically populate the VI with any variables used in a macro that @coordinated and I corroborated on a month or so ago. Here's the link to the topic we were discussing it on. I'm not sure of the current status of the macro in post 1, but the last refinements I made to my personal copy (which are in the last post, that's linked to below) have proven to be rock solid.

1 Like

Thanks. That looks exactly like one of the macros I created. I'll try again.

1 Like

OK, this is what your macro generated for me:
gifski --fps 12 --width 320 -o ~/Desktop/moviedesktop.gif~/Desktop/moviedesktop.mov

This is the command line that worked:
gifski -r 12 -W 320 -o ~/Desktop/moviedesktop.gif ~/Desktop/moviedesktop.mov

I substituted the path designation of course, but it's exactly the same for all occurrences. Notice the single space needed between the two paths. Noticed the case sensitive, single letter options. I can send the reconstructed macro if you like. Thanks again.

Lantro

1 Like

Ah ok, I might know what the issue is. Is that the file path the debug group outputs? If so you may need to remove the tilde from the file path. I thought I had an optional action in there to do that if necessary, but perhaps not. Let me double check real quick.

EDIT: I removed that action apparently. I won't have time to look at it any more tonight but I'll jump on it again in the morning.

No problem.

No, I adjusted the paths (inserted the tllde instead of the spelled out home folder), but made the same adjustment to each occurrence. Your output was correct regarding basic path, it's the other stuff that gifski didn't like.

Uh-oh, one thing I left out: Sandboxing. You must preface the executable name with the full path to the executable. If it's installed by Homebrew in the land of arch -x86_64, it's probably "/usr/local/bin/gifski". If it's distilled along with that new, strange brew, it's probably "/opt/homebrew/bin/gifski". May require checking between the two or even more if there's an another compiled version. The "which" command should help. (It's a good "which", not "whick-ed".)

Is that not something that is accomplished by setting the ENV_PATH variable?

Apparently not in every case. I use oh-my-zsh, and that's pretty common, I think. I believe that targeting the correct executable was mostly what was needed for me.

Here's my path, though.

/opt/homebrew/bin

/opt/homebrew/sbin

/Library/Apple/usr/bin

/Users/me/.pyenv/shims

/Users/me/perl5/perlbrew/bin

/bin

/opt/X11/bin

/sbin

/usr/bin

/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims

/usr/local/MacGPG2/bin

/usr/local/bin

/usr/local/git/bin

/usr/local/opt/bison/bin

/usr/local/sbin

/usr/sbin

@Lantro thats good to know. You obviously have a lot more experience with shell scripts than I do… and this macro is part of my learning process, so how could I go about making my macro more foolproof for when the ENV_PATH doesn’t return the right location?

I'm not the expert that I'd like to be, but when I run the script "which gifski", it returns the path for the executable that I can provide for the macro.

1 Like

Excellent, I'll look into how I can incorporate that in. Thanks!

Someone update me on this one, is it "buggy" as my very quick glimpse implies or is this a hidden gem I need? :smiley:

Hey there Jesse, most of the "bugs" pertain to the initial setup since this macro uses HomeBrew and each persons computer may be set up differently. But beyond that the macro works fine. I've been using it consistently (at least several times a week if not several times a day) since I built it and have not had it fail once.

If you're interested in trying it out, but run into problems with the initial setup, don't hesitate to reach out and we can help walk you through it.

-Chris

I'm having a problems with Homebrew and Gifski. I need the head version of ffmpeg, but Gifski wants ffmpeg 6.1.1. I can't seem to make Gifski accept the head version of ffmpeg. It complains about the library files. Do you by any chance know if there's a way to keep the head version and let Gifski work too? I'm no Homebrew expert, so don't worry about insulting me, I'm used to it. Thanks.