Recently Written · git

librivox

Automated youtube uploading of audiobooks

git clone https://github.com/equwal/librivox

Log | Files | Refs


commit 1dcdb15681bbea38b4e3cfe1d580189111018904
jose <jose@linux-q5ep.lan>
2018-11-12 08:14:11 -0800

Downloads.

 src/ffmpeg.lisp | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/ffmpeg.lisp b/src/ffmpeg.lisp
index 8455b60..fa1ba2e 100644
--- a/src/ffmpeg.lisp
+++ b/src/ffmpeg.lisp
@@ -34,24 +34,18 @@
      (m3u-down input)
      (run-line* "for f in *.mp3; do echo \"file '$f'\" >> concat.txt; done")
      (run-line* "ffmpeg -f concat -safe 0 -i concat.txt -c copy output1.mp3")
-     (let ((seconds (run-line*-integer-output "mp3info -p \"%S\" output1.mp3")))
-       (if (>= *max-seconds* seconds)
-	   (progn (run-line* (format nil "ffmpeg -loop 1 -i ~A -t ~D -c mjpeg temp.mp4" ;
-				     image seconds))
-		  (run-line* (format nil "ffmpeg -i temp.mp4 -i output1.mp3 -c copy output.mp4")))
-	   (mvbind (times rem) (ceiling (/ seconds 4200))
-		   (let ((rem (1+ rem)))
-		     (dotimes (n times)
-		       (let ((duration (if (= times (1+ n))
-					   (* rem *max-seconds*)
-					   *max-seconds*)))
-			 (run-line* (format nil "ffmpeg -loop 1 -i ~A -t ~D -c mjpeg temp-~D.mp4"
-					    image duration n))
-			 (run-line* (format nil "ffmpeg -ss ~D -t ~D -i output1.mp3 -c copy output-~D.mp3"
-					    (* n *max-seconds*) duration n))
-			 (run-line* (format nil "ffmpeg -i temp-~D.mp4 -i output-~:*~D.mp3 -c copy output-~:*~D.mp4"
-					    n))
-			 (run-line* (format nil "rm temp-~D.mp4" n)))))))))))
+     (mvbind (times rem) (ceiling (/ (run-line*-integer-output "mp3info -p \"%S\" output1.mp3") *max-seconds*))
+	     (dotimes (n times)
+	       (let ((duration (if (= times (1+ n))
+				   (* (1+ rem) *max-seconds*)
+				   *max-seconds*)))
+		 (run-line* (format nil "ffmpeg -loop 1 -i ~A -t ~D -c mjpeg temp-~D.mp4"
+				    image duration n))
+		 (run-line* (format nil "ffmpeg -ss ~D -t ~D -i output1.mp3 -c copy output-~D.mp3"
+				    (* n *max-seconds*) duration n))
+		 (run-line* (format nil "ffmpeg -i temp-~D.mp4 -i output-~:*~D.mp3 -c copy output-~:*~D.mp4"
+				    n))
+		 (run-line* (format nil "rm temp-~D.mp4" n))))))))
 (defun pathname-type? (path type)
   (string-equal (pathname-type path) type))
 (defun image-type? (path)