Skip to content

Instantly share code, notes, and snippets.

@msurguy
Created March 18, 2023 06:23
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 msurguy/8689aeda98ca322a8b94058f1f598c9f to your computer and use it in GitHub Desktop.
Save msurguy/8689aeda98ca322a8b94058f1f598c9f to your computer and use it in GitHub Desktop.
FFMPEG commands for stitching Blender videos
function stitch {
if [ -z "$1" ]; then
echo "Input prefix must be specified."
return
fi
if [ -z "$2" ]; then
echo "Output file must be specified."
return
fi
if [ -z "$3" ]; then
crf=18
else
crf=$3
fi
command="ffmpeg -r 30 -i ${1}%04d.png -c:v libx264 -crf $crf -pix_fmt yuv420p -f mp4 ${2}.mp4"
eval $command
}
function stitch($inputPrefix, $outputFile, $crf = 18) {
if (-not $inputPrefix) {
Write-Error "Input prefix must be specified."
return
}
$cmd = "ffmpeg -r 30 -i ${inputPrefix}%04d.png -c:v libx264 -crf $crf -pix_fmt yuv420p -f mp4 $outputFile.mp4"
Invoke-Expression $cmd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment