pastebin

Untitled
  1. #!/bin/bash
  2. echo "remove shit"
  3. rm *.bmp
  4. rm test.mp4
  5. rm output.mp4
  6. echo "downscale"
  7. ffmpeg -y -i $1 -vf "scale=640x480" -r $2 output.mp4
  8. echo "cut into frames"
  9. ffmpeg -i output.mp4   %06d.bmp
  10. rm output.mp4
  11. ls *.bmp | wc -l
  12. read
  13. for frame  in  *.bmp; do
  14.         i=$(echo "$frame"| sed 's/[^0-9]//g')
  15.         j=$(echo "$frame"| sed 's/[^0-9]//g'|sed 's/^0\+//')
  16.         echo "frame $i"
  17.         remainder=$(( j % 3 ))
  18.         echo "$remainder"        
  19.         [ "$remainder" -eq 0 ] && ffmpeg -i $i.bmp -vf lutrgb="g=0:b=0" c$i.bmp 2>/dev/null &
  20.         [ "$remainder" -eq 1 ] && ffmpeg -i $i.bmp -vf lutrgb="r=0:b=0" c$i.bmp 2>/dev/null &
  21.         [ "$remainder" -eq 2 ] && ffmpeg -i $i.bmp -vf lutrgb="g=0:r=0" c$i.bmp 2>/dev/null &
  22.         [ "$(( j % 128 ))" -eq 0 ] && echo "wait1" && wait
  23. done
  24. echo "wait 2"
  25. wait
  26. ffmpeg -r $2 -f image2 -s 640x480 -i c%06d.bmp -vcodec libx264 -crf 25  -pix_fmt yuv420p test.mp4
  27. rm *.bmp
Parsed in 0.021 seconds