 
 (defn -main
   "I don't do a whole lot ... yet."
-  [cap-frame-cnt clip-interval fps frame-dir clip-dir intermediate-dir]
+  [cap-frame-cnt clip-interval fps frame-dir clip-dir intermediate-dir s3-upload-dir]
   (do (clear-dir frame-dir)
       (clear-dir clip-dir)
       (clear-dir intermediate-dir)
+      (clear-dir s3-upload-dir)
 
       (future (do-cap cap-frame-cnt fps frame-dir))
-      (dotimes [i 10]
+      (dotimes [i 100]
         (do
           (Thread/sleep (read-string clip-interval))
-          (println "make clip")
+          (do-clip fps frame-dir clip-dir (str s3-upload-dir "/" i ".mp4"))
           ))
       ))

      (catch Throwable t
        (println "error: " (.getMessage t))))))

(defn- do-clip [fps frame-dir clip-path] ""
  (let [out (:out (sh "ffmpeg"
                      "-r"
                      fps
                      "-f"
                      "image2"
                      "-s"
                      "1920x1080"
                      "-i"
                      (str frame-dir "/\\%06d")
                      "-vcodec"
                      "libx264"
                      "-crf"
                      "25"
                      "-pix_fmt"
                      "yuv420p"
                      clip-path))]
    out))

(defn- clear-dir [dir]
  (fs/delete-dir dir)

             :as a
             :refer [>! <! >!! <!! go go-loop chan buffer close! thread
                     alts! alts!! timeout]]
            [me.raynes.fs :as fs]
            [clojure.string :as str]))

(defn- move-file [src-file dest-dir] ""
  (println "copying " src-file " to " dest-dir)
  (fs/copy+ src-file dest-dir))

(defn- delete-file [file] ""
  (fs/delete file))

(defn- do-cap [cap-frame-cnt fps frame-dir] ""
  (println "doing capture with total frames: " cap-frame-cnt
