[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to subtract timestamp in elisp?
From: |
stardiviner |
Subject: |
How to subtract timestamp in elisp? |
Date: |
Sat, 04 Jul 2020 19:11:29 +0800 |
User-agent: |
mu4e 1.4; emacs 28.0.50 |
I'm find an Elisp solution to subtract timestamps like "00:12:35".
I hope a function can subtract two timestamps:
00:12:35 - 00:10:45 = 00:01:50
Is there some hints or suggestion like function name or Emacs library or
package?
Or can convert timestamp into another format then convert back to timestamp.
I use those timestamps in "ffmpeg" command video cut clip command option "-ss"
and "-t".
Or Linux command is acceptable. I can write a function to execute shell command
then parse the result.
Here is my current code:
#+begin_src emacs-lisp
(defun ffmpeg-cut-clip (input-filename start-timestamp end-timestamp
output-filename)
(interactive (list
(read-file-name "FFmpeg input filename: ")
(read-string "FFmpeg start timestamp: ")
(read-string "FFmpeg time timestamp: ")
(read-file-name "FFmpeg output filename: ")))
(let ((time-timestamp (FUNC start-timestamp end-timestamp)))
(make-process
:name "ffmpeg cut clip"
;; "ffmpeg -i input-filename -ss start-timestamp -t time-timestamp -codec
copy output-filename"
:command (list "ffmpeg"
"-i" input-filename
"-ss" start-timestamp
"-t" time-timestamp
"-codec copy"
output-filename)
:buffer "*ffmpeg-cut-clip*"
:sentinel (lambda (proc event)
(message "FFmpeg cut video clip finished.")))))
#+end_src
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
- How to subtract timestamp in elisp?,
stardiviner <=