improved pict-converter
This commit is contained in:
+26
-11
@@ -5,14 +5,20 @@
|
|||||||
|
|
||||||
function convert {
|
function convert {
|
||||||
|
|
||||||
|
|
||||||
now=$(date +"%Y-%m-%d--%T")
|
now=$(date +"%Y-%m-%d--%T")
|
||||||
echo "Timelaps conversion | $now"
|
echo "Timelaps conversion | $now"
|
||||||
|
|
||||||
|
pf=12
|
||||||
|
vf=24
|
||||||
|
|
||||||
mkdir tmp_videos
|
mkdir tmp_videos
|
||||||
mkdir tmp_metadata
|
mkdir tmp_metadata
|
||||||
mkdir tmp_pictures
|
mkdir tmp_pictures
|
||||||
|
|
||||||
rm -f tmp_pictures/*
|
rm -f tmp_pictures/*
|
||||||
|
rm -f tmp_videos/*
|
||||||
|
rm -f tmp_metadata/*
|
||||||
|
|
||||||
x=1
|
x=1
|
||||||
for i in public_html/pictures/*.jpg; do
|
for i in public_html/pictures/*.jpg; do
|
||||||
@@ -21,8 +27,6 @@ function convert {
|
|||||||
x=$(($x+1))
|
x=$(($x+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
pf=12
|
|
||||||
vf=24
|
|
||||||
|
|
||||||
echo "pictframerate:$pf, videoframerate=$vf"
|
echo "pictframerate:$pf, videoframerate=$vf"
|
||||||
|
|
||||||
@@ -42,7 +46,7 @@ function convert {
|
|||||||
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=360:-1, crop=in_w:240" tmp_videos/timelaps-240p.mp4
|
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=360:-1, crop=in_w:240" tmp_videos/timelaps-240p.mp4
|
||||||
|
|
||||||
echo "updating production videos"
|
echo "updating production videos"
|
||||||
rsync -r tmp_videos/ public_html/videos/
|
mv -f tmp_videos/* public_html/videos/
|
||||||
|
|
||||||
echo "metadata export"
|
echo "metadata export"
|
||||||
l=0
|
l=0
|
||||||
@@ -57,28 +61,39 @@ function convert {
|
|||||||
# SRC
|
# SRC
|
||||||
src="${pict/public_html\/pictures\//}"
|
src="${pict/public_html\/pictures\//}"
|
||||||
# TIME
|
# TIME
|
||||||
# time="${pict/public_html\/pictures\/hehe-/}"
|
datetime="${pict/public_html\/pictures\/hehe-/}"
|
||||||
# time="${time/.jpg/}"
|
datetime="${datetime/.jpg/}"
|
||||||
datetime=`exiftool 2>/dev/null -S --DateTimeOriginal -p '$DateTimeOriginal' -d %Y-%m-%dT%T "$pict"`
|
Y="${datetime:0:4}"
|
||||||
|
m="${datetime:4:2}"
|
||||||
|
d="${datetime:6:2}"
|
||||||
|
h="${datetime:9:2}"
|
||||||
|
min="${datetime:11:2}"
|
||||||
|
sec="${datetime:13:2}"
|
||||||
|
datetime="$Y-$m-$d $h:$min:$sec"
|
||||||
|
datetime="${datetime/ /T}"
|
||||||
|
# echo "datetime : $datetime"
|
||||||
|
# datetime= $($datetime | awk /([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2})/ {print $1-$2-$3T$4:$5:$6})
|
||||||
|
# datetime=`exiftool 2>/dev/null -S --DateTimeOriginal -p '$DateTimeOriginal' -d %Y-%m-%dT%T "$pict"`
|
||||||
# GPS
|
# GPS
|
||||||
gps=`exiftool 2>/dev/null -n -p '$GPSLatitude,$GPSLongitude' $pict`
|
gps=`exiftool 2>/dev/null -n -p '$GPSLatitude,$GPSLongitude' $pict`
|
||||||
|
|
||||||
# FRAME
|
# FRAME
|
||||||
currenttime=$(((1/$pf)*$f))
|
currenttime=$(((1/$pf)*$f))
|
||||||
|
|
||||||
if [[ $f == $(($l-1)) ]]; then
|
frame="\t\t{\"src\":\"$src\", \"datetime\":\"$datetime\", \"gps\":\"$gps\", \"currenttime\":\"$currenttime\", \"id\":\"$f\"}"
|
||||||
echo -e "\t\t{\"src\":\"$src\", \"datetime\":\"$datetime\", \"gps\":\"$gps\", \"currenttime\":\"$currenttime\"}" >> tmp_metadata/frames.json
|
if [[ $f != $(($l-1)) ]]; then
|
||||||
else
|
frame="$frame,"
|
||||||
echo -e "\t\t{\"src\":\"$src\", \"datetime\":\"$datetime\", \"gps\":\"$gps\", \"currenttime\":\"$currenttime\"}," >> tmp_metadata/frames.json
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -e "$frame" >> tmp_metadata/frames.json
|
||||||
|
|
||||||
f=$(($f+1))
|
f=$(($f+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e '\t]' >> tmp_metadata/frames.json
|
echo -e '\t]' >> tmp_metadata/frames.json
|
||||||
echo -e '}' >> tmp_metadata/frames.json
|
echo -e '}' >> tmp_metadata/frames.json
|
||||||
|
|
||||||
rsync -r tmp_metadata/ public_html/metadata/
|
mv -f tmp_metadata/* public_html/metadata/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user