Loading

Paste #pippfnj8s

  1. #!/bin/bash
  2.  
  3. # Script to convert mjpeg files into a sequence of jpg images
  4. # Usage: mjpeg2jpg video [basename_images]
  5. #
  6. # Requirements: avconv
  7. # (c) 2013 Ingo von Borstel
  8.  
  9. if [ -z "$1" ]; then
  10.     echo "Usage: `basename $0` [videofile_pattern] output_basename"
  11.     exit 1
  12. fi
  13.  
  14. eval basename=\${$#}
  15. videofile=${basename}.mjpeg
  16.  
  17. if [ $# -eq 1 ]; then
  18.     for i in `ls -v1 *.mjpeg`; do
  19.         cat $i >> ${videofile}
  20.     done
  21. else
  22.     while (($# > 1)); do
  23.         cat $1 >> ${videofile}
  24.         echo "Processing $1"
  25.         shift
  26.     done
  27. fi
  28.  
  29. avconv -i ${videofile} -c:v copy $1_image%4d.jpg

Comments