|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file:
;; http://anggtwu.net/elisp/waveform.el.html
;; http://anggtwu.net/elisp/waveform.el
;; (find-angg "elisp/waveform.el")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;;
;; (defun e () (interactive) (find-angg "elisp/waveform.el"))
(defun subed-waveform--ffmpeg-args (filename from to width height)
"An internal function used by `subed-waveform--from-file'."
(append
(list "-accurate_seek"
"-ss" (format "%s" from)
"-to" (format "%s" to))
(list "-i" filename)
(list
"-loglevel"
"0"
"-filter_complex"
(format "volume=%s,showwavespic=s=%dx%d%s"
subed-waveform-volume
width height
(cond
((functionp subed-waveform-ffmpeg-filter-args)
(funcall subed-waveform-ffmpeg-filter-args width height))
((stringp subed-waveform-ffmpeg-filter-args)
subed-waveform-ffmpeg-filter-args)
(t "")))
"-frames:v" "1"
"-c:v" "png"
"-f" "image2" "-")))
(defun subed-waveform--from-file (filename from to width height)
"Returns a string representing the image data in PNG format.
FILENAME is the input file, FROM and TO are time positions, WIDTH
and HEIGHT are dimensions in pixels."
(let* ((args (subed-waveform--ffmpeg-args filename from to width height)))
(with-temp-buffer
(apply 'call-process subed-waveform-ffmpeg-executable nil t nil args)
(encode-coding-string (buffer-string) 'binary))))
;; (find-hvariable 'subed-waveform-svg-map)
;; (find-hvariable 'subed-waveform-minor-mode-map)
;; Local Variables:
;; coding: utf-8-unix
;; End: