SHARE
TWEET

mkvideo.sh

h8rt3rmin8r Jul 22nd, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # This is a script to create a video from series of JPEG images
  4. # Call it in a folder full of JPEGs that you want to turn into a video.
  5. # Written on 2013-01-08 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
  6. # Check <https://gist.github.com/4572552> for newer versions.
  7.  
  8. # Resources
  9. # * http://www.itforeveryone.co.uk/image-to-video.html
  10. # * http://spielwiese.la-evento.com/hokuspokus/index.html
  11. # * http://ffmpeg.org/trac/ffmpeg/wiki/Create%20a%20video%20slideshow%20from%20images
  12. # * http://wiki.ubuntuusers.de/FFmpeg
  13.  
  14. set -x
  15.  
  16. FRAMERATE=4
  17. RESOLUTION=1920x1080
  18.  
  19. # Rename the images into a sequence
  20. # http://www.ralree.com/2008/08/06/renaming-files-sequentially-with-bash/
  21. EII=1
  22. # If sorting according to the file date, copy them using   cp -a ../*.JPG ./
  23. for i in $(ls -tr *.JPG); do
  24.   ls $i
  25.   NEWNAME=IMG_`printf "%05d" $EII`.JPG
  26.   #echo Renaming $i to $NEWNAME
  27.   mv $i $NEWNAME
  28.   EII=`expr $EII + 1`
  29. done
  30.  
  31. # Resize the images (replaces the files)
  32. mogrify -resize $RESOLUTION *.JPG
  33.  
  34. # Now create the video using ffmpeg
  35. cat *.JPG | ffmpeg -f image2pipe -r $FRAMERATE -vcodec mjpeg -i - -vcodec libx264 out_$FRAMERATE.mp4
  36. #ffmpeg -f image2 -r $RATE -i IMG_%05d.JPG movie_$RATE.mp4
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top