Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created February 16, 2017 11:23
Show Gist options
  • Save yurenju/b2576617d15f41200e142f8d39e2f377 to your computer and use it in GitHub Desktop.
Save yurenju/b2576617d15f41200e142f8d39e2f377 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
require('shelljs/global');
var filename = process.argv[2];
// mediainfo --Output="Video;%Width%x%Height%" multiple-gradient.mov
var output = exec('mediainfo --Output="Video;%Width%x%Height%" ' + filename, {silent: true}).output
var matched = /(\d+)x(\d+)/.exec(output);
exec('ffmpeg -i ' + filename + ' -s ' + parseInt(matched[1])/2 + 'x' + parseInt(matched[2])/2 + ' -pix_fmt rgb24 -r 18 -f gif - | gifsicle --optimize=3 --delay=3 > ' + filename.split('.')[0] + '.gif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment