Skip to content

Instantly share code, notes, and snippets.

@ibaaj ibaaj/mirror2.sh
Created Jun 9, 2017

Embed
What would you like to do?
#!/bin/zsh
rm -rf ./frames ./ftop ./fbottom ./final;
mkdir -p {frames,ftop,fbottom,final};
ffmpeg -i IMG_6501.MOV -r 25 -qscale:v 2 frames/%05d.jpg ;
framesNumber=$(ls ./frames/*.jpg |wc -l|tr -d ' ');
C_H=540
H=1080
H_D=$((H - C_H));
for i in {1..${framesNumber}}
do
nb=$(printf %05d ${i});
convert frames/${nb}.jpg -crop 1920x${H_D}+0+${C_H} fbottom/${nb}.jpg;
convert fbottom/${nb}.jpg -flip ftop/${nb}.jpg;
convert fbottom/${nb}.jpg ftop/${nb}.jpg -append final/${nb}.jpg;
done
#convert -layers Optimize frames/*.jpg out.gif;
cat ./final/*.jpg | ffmpeg -f image2pipe -r 25 -vcodec mjpeg -i - -vcodec libx264 out-${C_H}.mp4;
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.