Skip to content

Instantly share code, notes, and snippets.

@plmrry
Created July 15, 2021 20:48
Show Gist options
  • Save plmrry/678f9b0a5239be5609ac61e85be47d19 to your computer and use it in GitHub Desktop.
Save plmrry/678f9b0a5239be5609ac61e85be47d19 to your computer and use it in GitHub Desktop.
Create videos with ffmpeg
// Various ways that I have called ffmpeg in the past
exec(
`ffmpeg -y \
-framerate 60 \
-pattern_type glob \
-i "${framesDirectory}/*.png" \
-crf 27 \
-pix_fmt yuv420p \
-filter:v scale=1000:-1 \
${mp4_path}`
);
exec(
`ffmpeg -y \
-framerate ${fps} \
-pattern_type glob \
-i "${framesDirectory}/*.png" \
-vcodec libx264 \
-crf 22 \
-pix_fmt yuv420p \
-x264-params keyint=1 \
-filter:v scale=720:-1 \
${outPath}`
);
exec(
`ffmpeg -y \
-framerate ${30} \
-pattern_type glob \
-i "${framesDirectory}/*.png" \
-crf ${crf} \
-filter:v scale=1000:-2 \
-pix_fmt yuv420p \
-x264-params keyint=1 \
${outputDirectory}/${fileName}.mp4`
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment