33 lines
594 B
Bash
Executable File
33 lines
594 B
Bash
Executable File
#!/bin/bash
|
|
|
|
VIDEO="$1"
|
|
DESC="$2"
|
|
|
|
if [ -z "$VIDEO" ] || [ -z "$DESC" ]; then
|
|
echo "Usage: $0 <video_file> <description>"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$VIDEO" ]; then
|
|
echo "Error: file '$VIDEO' not found."
|
|
exit 1
|
|
fi
|
|
|
|
TMP="${VIDEO%.*}_meta.${VIDEO##*.}"
|
|
|
|
ffmpeg -hide_banner -loglevel error \
|
|
-i "$VIDEO" \
|
|
-map 0 \
|
|
-c copy \
|
|
-metadata description="$DESC" \
|
|
-metadata comment="$DESC" \
|
|
"$TMP"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
mv "$TMP" "$VIDEO"
|
|
echo "---->>>> Description added successfully."
|
|
else
|
|
echo "---->>>> Failed to write metadata."
|
|
rm -f "$TMP"
|
|
fi
|