Last active
July 2, 2025 02:12
-
-
Save melissachang/6bb1d705f442d4b2694d05c8aa344090 to your computer and use it in GitHub Desktop.
Create sidecar images for videos, for storing metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Don't proceed if there are no files with a particular extension. https://stackoverflow.com/a/41139446 | |
shopt -s nullglob | |
# Match MP4 in addition to mp4 | |
shopt -s nocaseglob | |
for video_file in *.{mp4,mov} ; do | |
sidecar_file=$(echo $video_file | sed 's/\(.*\.\).*/\1jpg/' ) | |
echo "Exporting sidecar for ${video_file}: ${sidecar_file}" | |
ffmpeg -ss 00:00:00 -i "${video_file}" -vframes 1 -y "${sidecar_file}" -loglevel error | |
# Copy Create Date from video to sidecar. -ee just to hide Warning. | |
exiftool -overwrite_original -quiet -ee -tagsfromfile "$video_file" -api LargeFileSupport=1 "$sidecar_file" | |
done | |
say done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment