Skip to content

Instantly share code, notes, and snippets.

@Lokua
Created March 23, 2022 17:40
Show Gist options
  • Save Lokua/eacaf2580e81ea89787c581c14214761 to your computer and use it in GitHub Desktop.
Save Lokua/eacaf2580e81ea89787c581c14214761 to your computer and use it in GitHub Desktop.

convert series of images to gif

fmpeg -f image2 -framerate 2 -i %2d.jpg out.gif

convert series of images to mp4 (suitable for instagram, quicktime)

ffmpeg -f image2 -framerate 2 -i %2d.jpg -pix_fmt yuv420p -crf 17 -vcodec libx264 out.mp4

Using node.js

const childProcess = spawn(
  'ffmpeg',
  [
    '-hide_banner',
    '-framerate',
    `${frameRate}`,
    '-i',
    `"${folder}/%${padCount}d.png"`,
    '-vf',
    'scale=1080x1080',
    '-r',
    '30',
    '-pix_fmt',
    'yuv420p',
    '-crf',
    '17',
    '-vcodec',
    'libx264',
    `${filename}`,
  ],
  {
    stdio: 'inherit',
    shell: true,
  },
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment