   (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

  "Drop audio from all marked videos."
  (interactive)
  (dwim-shell-command--on-marked-files
   "ffmpeg -i <<f>> -c copy -an <<fne>>_no_audio.<<e>>"
   "Drop audio" '("ffmpeg")))

(defun dwim-shell-command ()
  "Execute DWIM shell command."
  (interactive)
  (dwim-shell-command--on-marked-files
   (read-shell-command "DWIM shell command: ") "DWIM shell command" '()))

(defun dwim-shell-command-execute-script (script name files utils &optional post-process-template on-completion)
  "Execute SCRIPT, using buffer NAME, FILES, and bin UTILS."
  (cl-assert (not (string-empty-p script)) nil "Script must not be empty")
  (cl-assert name nil "Script must have a name")
  (let* ((proc-buffer (generate-new-buffer name))
         (template script)
         (script "")
         (files-before)

    (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))
