Skip to content

Instantly share code, notes, and snippets.

@ibaaj
Created June 9, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibaaj/fec3fe71afbd435d52e80d7990cf38ce to your computer and use it in GitHub Desktop.
Save ibaaj/fec3fe71afbd435d52e80d7990cf38ce to your computer and use it in GitHub Desktop.
#!/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