Skip to content

Commit 2d6e333

Browse files
fix: set creation_time attribute on videos when missing
1 parent 6372bd7 commit 2d6e333

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

save.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ function do_video () {
9191
second=${encoded_time:4:2}
9292

9393
# Create a formatted timestamp
94-
creation_time="$year-$month-$day $hour:$minute:$second"
94+
creation_time="$year-$month-${day}T$hour:$minute:$second"
95+
96+
# Set the creation_time attribute
97+
ffmpeg -i "v" -metadata creation_time="$creation_time" -codec copy "${$FILE%.*}_new.${$FILE##*.}"
98+
99+
# Check if the command was successful
100+
if [[ $? -eq 0 ]]; then
101+
echo "creation_time has been set to $creation_time for $FILE"
102+
mv "${FILE%.*}_new.${FILE##*.}" "$file_path"
103+
else
104+
echo "Failed to set creation_time for $FILE"
105+
fi
95106
fi
96107
fi
97108

0 commit comments

Comments
 (0)