#!/bin/bash URUCHAMIASZ NA WŁASNĄ ODPOWIEDZIALNOŚĆ, I U MNIE DZIAŁA NIE WIEM CZY U CIEBIE echo "remove shit" rm *.bmp rm test.mp4 rm output.mp4 echo "downscale" ffmpeg -y -i $1 -vf "scale=640x480" -r $2 output.mp4 echo "cut into frames" ffmpeg -i output.mp4 %06d.bmp rm output.mp4 ls *.bmp | wc -l read for frame in *.bmp; do i=$(echo "$frame"| sed 's/[^0-9]//g') j=$(echo "$frame"| sed 's/[^0-9]//g'|sed 's/^0\+//') echo "frame $i" & remainder=$(( j % 3 )) echo "$remainder" & [ "$remainder" -eq 0 ] && ffmpeg -i $i.bmp -vf lutrgb="g=0:b=0" c$i.bmp 2>/dev/null & [ "$remainder" -eq 1 ] && ffmpeg -i $i.bmp -vf lutrgb="r=0:b=0" c$i.bmp 2>/dev/null & [ "$remainder" -eq 2 ] && ffmpeg -i $i.bmp -vf lutrgb="g=0:r=0" c$i.bmp 2>/dev/null & [ "$(( j % 124))" -eq 0 ] && echo "wait1" && wait done echo "wait 2" wait ffmpeg -r $2 -f image2 -s 640x480 -i c%06d.bmp -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4 rm *.bmp