   (let ((factor (string-to-number
                  (completing-read "Speed up x times: " '("1" "1.5" "2" "2.5" "3" "4")))))
     (dwim-shell-command--on-marked-files
+     "Speed up gif"
      (format "gifsicle -U <<f>> <<frames>> -O2 -o <<fne>>_x%s.<<e>>" factor)
-     "Speed up gif" '("gifsicle" "identify")
-     (lambda (script file)
+     :check-extensions "gif"
+     :check-utils '("gifsicle" "identify")
+     :post-process-template (lambda (script file)
        (string-replace "<<frames>>" (dwim-shell-command--gifsicle-frames-every factor file) script)))))
 
 (defun dwim-shell-command-pdf-password-protect ()
   "Speeds up gif(s)."
   (interactive)
   (dwim-shell-command--on-marked-files
+   "Password protect pdf"
    (format "qpdf --verbose --encrypt '%s' '%s' 256 -- <<f>> <<fne>>_enc.<<e>>"
            (read-passwd "user-password: ")
            (read-passwd "owner-password: "))
-   "Password protect pdf" '("qpdf")))
+   :check-utils "qpdf"))
 
 (defun dwim-shell-command--gifsicle-frames-every (skipping-every file)
   (string-join

  "Convert all marked audio to mp3(s)."
  (interactive)
  (dwim-shell-command--on-marked-files
   "ffmpeg -stats -n -i <<f>> -acodec libmp3lame <<fne>>.mp3"
   "Convert to mp3" '("ffmpeg")))

(defun dwim-shell-command-convert-image-to-jpg ()
  "Convert all marked images to jpg(s)."
  (interactive)
  (dwim-shell-command--on-marked-files
   "convert -verbose <<f>> <<fne>>.jpg"
   "Convert to jpg" '("convert")))

(defun dwim-shell-command-convert-image-to-png ()
  "Convert all marked images to png(s)."
  (interactive)
  (dwim-shell-command--on-marked-files
   "convert -verbose <<f>> <<fne>>.png"
   "Convert to png" '("convert")))

(defun dwim-shell-command-convert-to-gif ()
  "Convert all marked videos to optimized gif(s)."
  (interactive)
  (dwim-shell-command--on-marked-files
   "ffmpeg -loglevel quiet -stats -y -i <<f>> -pix_fmt rgb24 -r 15 <<fne>>.gif"
   "Convert to gif" '("ffmpeg")))

(defun dwim-shell-command-convert-to-optimized-gif ()
  "Convert all marked videos to optimized gif(s)."
  (interactive)
  (dwim-shell-command--on-marked-files
   "ffmpeg -loglevel quiet -stats -y -i <<f>> -pix_fmt rgb24 -r 15 <<fne>>.gif
    gifsicle -O3 <<fne>>.gif --lossy=80 -o <<fne>>.gif"
   "Convert to optimized gif" '("ffmpeg" "gifsicle")))

(defun dwim-shell-command-unzip ()
  "Unzip all marked archives (of any kind) using `atool'."
  (interactive)
  (dwim-shell-command--on-marked-files
   "atool --extract --explain <<f>>" "Unzip" '("atool")))

(defun dwim-shell-command-speed-up-gif ()
  "Speeds up gif(s)."

    (seq-do (lambda (util)
              (cl-assert (executable-find util) nil
                         (format "%s not installed" util)))
            check-utils)
    (with-current-buffer proc-buffer
      (require 'shell)
      (shell-mode))
