Last active
December 27, 2016 15:22
-
-
Save rizky/1b6f7ec4ccee25a5925e0affe8fd8632 to your computer and use it in GitHub Desktop.
FFMPEG script to preprocess caffe-heatmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Squared and resize the video | |
ffmpeg -i all.mp4 -vf "scale=256:256:force_original_aspect_ratio=decrease,pad=256:256:(ow-iw)/2:(oh-ih)/2" all_square.mp4 | |
#Convert video to gif | |
ffmpeg -y -i all_square.mp4 -vf fps=10,scale=256:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -i all_square.mp4 -i palette.png -filter_complex "fps=10,scale=256:-1:flags=lanczos[x];[x][1:v]paletteuse" all.gif | |
#Convert gif to png | |
# ffmpeg -i all_square.mp4 -vcodec png pngs/%05d.png | |
ffmpeg -i all.gif -vcodec png pngs/%0d.png | |
#Convert png to mp4 | |
ffmpeg -framerate 10 -i joints/join_%0d.png -s:v 256x256 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p joints_all.mp4 | |
ffmpeg -framerate 10 -i heatmap/heatmap_%0d.png -s:v 256x256 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p heatmap_all.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment