Skip to content

Instantly share code, notes, and snippets.

@zsarge
Created April 10, 2022 16:35
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 zsarge/4e247b9377cc1e161ac1d129ac2021a1 to your computer and use it in GitHub Desktop.
Save zsarge/4e247b9377cc1e161ac1d129ac2021a1 to your computer and use it in GitHub Desktop.
Make slideshow from videos from Google Photos Album
#!/usr/bin/bash
# The goal of this script is to take a series of videos
# from an album export from Google Photos
# and append them all together to make one long video.
# For example, if the videos folder contained:
# ./videos
# - a.mp4
# - b.mp4
# - c.mp4
# this script would produce "out.mp4", which would contain video a, then b, then c, in order.
# When you edit a file in Google Photos, it adds a "~" to the end of the filename.
# ffmpeg does not like this, so we must remove it.
for unsafe_filename in videos/*~*.mp4; do
safe_filename="$(echo $unsafe_filename | sed -r 's/~+/_/g')"
echo "$unsafe_filename > $safe_filename"
mv $unsafe_filename $safe_filename
done
# taken from https://superuser.com/a/1478595
for filename in videos/*.mp4; do
echo "file $filename" >> concat-list.txt
done
ffmpeg -f concat -i concat-list.txt merged.mp4
echo "Concatenated videos list:"
cat concat-list.txt
rm concat-list.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment