Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/const.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@

(defparameter +gif-scale+ "640:-1")

(defparameter +gif-fps-divider+ 2.0
"Divider for GIF frame rate (output fps = source fps / divider)")

(defparameter +min-file-size+ 4096
"Minimum file size in bytes to consider a file valid (not corrupt/incomplete)")

4 changes: 2 additions & 2 deletions src/ffmpeg.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:if-does-not-exist nil)
(when stream (file-length stream)))))
;; Delete empty or very small files (header-only, etc.)
(when (and file-size (< file-size 1024))
(when (and file-size (< file-size +min-file-size+))
(delete-file output)
(format t "~a Cleaned up incomplete output file: ~a~%"
(log-tag "info") output)))))
Expand Down Expand Up @@ -55,7 +55,7 @@
"Construct the ffmpeg command list for GIF mode using input filename and target fps."
(let* ((input (visp-options-input opts))
(cmd (list "ffmpeg" "-i" input))
(half-fps (/ fps 2.0))
(half-fps (/ fps +gif-fps-divider+))
(scale-str (format nil "scale=~a" +gif-scale+))
(fps-str (format nil "fps=~2,2f" half-fps))
(filter-complex
Expand Down
2 changes: 2 additions & 0 deletions src/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
:+pixfmt-name-map+
:+allowed-input-extensions+
+gif-scale+
+gif-fps-divider+
+min-file-size+

;; main.lisp
:main
Expand Down