Skip to content

Instantly share code, notes, and snippets.

@adujardin
Created May 4, 2021 12:50
Show Gist options
  • Save adujardin/f24ce05d9a5ff52a3b5a4d5d4b4aca1f to your computer and use it in GitHub Desktop.
Save adujardin/f24ce05d9a5ff52a3b5a4d5d4b4aca1f to your computer and use it in GitHub Desktop.
Create mp4 video from image sequence (in all directories in the same folder)
dest="/foo/bar"
curr="/foo/bar2/"
mkdir "${dest}"
dirs=($(find . -type d))
for dir in "${dirs[@]}"; do
echo "========================="
echo $dir
cd "${curr}${dir}"
pwd
#ffmpeg -framerate 20 -pattern_type glob -i '*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p "${dir}.mp4"
ffmpeg -r 10 -pattern_type glob -i '*.jpg' -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" -vcodec libx264 -y -an "${dir}.mp4"
mv "${dir}.mp4" "${dest}/"
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment