added tmp directories for converstion and rsync for update on prod
This commit is contained in:
+22
-12
@@ -7,17 +7,22 @@ function convertVideo {
|
||||
echo 'Video conversion'
|
||||
pf=$1
|
||||
vf=$2
|
||||
echo "creating raw timelaps"
|
||||
ffmpeg -y \
|
||||
-framerate $pf \
|
||||
-pattern_type glob -i 'public_html/pictures/*.jpg' \
|
||||
-r $vf -pix_fmt yuv420p -c:v libx264 \
|
||||
videos/timelaps-raw.mp4
|
||||
tmp_videos/timelaps-raw.mp4
|
||||
|
||||
ffmpeg -y -i public_html/videos/timelaps-raw.mp4 -vf "scale=1920:-1, crop=in_w:1080" videos/timelaps-1080p.mp4
|
||||
ffmpeg -y -i videos/timelaps-raw.mp4 -vf "scale=1280:-1, crop=in_w:720" videos/timelaps-720p.mp4
|
||||
ffmpeg -y -i videos/timelaps-raw.mp4 -vf "scale=720:-1, crop=in_w:480" videos/timelaps-480p.mp4
|
||||
ffmpeg -y -i videos/timelaps-raw.mp4 -vf "scale=640:-1, crop=in_w:340" videos/timelaps-360p.mp4
|
||||
ffmpeg -y -i videos/timelaps-raw.mp4 -vf "scale=360:-1, crop=in_w:240" videos/timelaps-240p.mp4
|
||||
echo "optimizing responsive videos"
|
||||
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=1920:-1, crop=in_w:1080" tmp_videos/timelaps-1080p.mp4
|
||||
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=1280:-1, crop=in_w:720" tmp_videos/timelaps-720p.mp4
|
||||
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=720:-1, crop=in_w:480" tmp_videos/timelaps-480p.mp4
|
||||
ffmpeg -y -i tmp_videos/timelaps-raw.mp4 -vf "scale=640:-1, crop=in_w:340" tmp_videos/timelaps-360p.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"
|
||||
rsync -r tmp_videos/ public_html/videos/
|
||||
}
|
||||
|
||||
function exportData {
|
||||
@@ -26,9 +31,9 @@ function exportData {
|
||||
vf=$2
|
||||
f=0
|
||||
|
||||
echo -e "{" > metadata/frames.json
|
||||
echo -e '\t"frames":[' >> metadata/frames.json
|
||||
for pict in pictures/*.jpg; do
|
||||
echo -e "{" > tmp_metadata/frames.json
|
||||
echo -e '\t"frames":[' >> tmp_metadata/frames.json
|
||||
for pict in public_html/pictures/*.jpg; do
|
||||
# TIME
|
||||
# time="${pict/pictures\/hehe-/}"
|
||||
# time="${time/.jpg/}"
|
||||
@@ -38,13 +43,14 @@ function exportData {
|
||||
|
||||
# FRAME
|
||||
frame=$(((60/$vf)*$f))
|
||||
echo -e "\t\t{\"pict\":\"$pict\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> metadata/frames.json
|
||||
echo -e "\t\t{\"pict\":\"$pict\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> tmp_metadata/frames.json
|
||||
f=$(($f+1))
|
||||
done
|
||||
|
||||
echo -e "\t]" >> metadata/frames.json
|
||||
echo -e "}" >> metadata/frames.json
|
||||
echo -e "\t]" >> tmp_metadata/frames.json
|
||||
echo -e "}" >> tmp_metadata/frames.json
|
||||
|
||||
rsync -r tmp_metadata/ public_html/metadata/
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +58,10 @@ function convert {
|
||||
now=$(date +"%Y-%m-%d--%T")
|
||||
echo "Timelaps conversion | $now"
|
||||
|
||||
_cwd="$(pwd)"
|
||||
mkdir $_cwd/tmp_videos
|
||||
mkdir $_cwd/tmp_metadata
|
||||
|
||||
pictframerate=12
|
||||
videoframerate=24
|
||||
|
||||
|
||||
@@ -5,3 +5,11 @@ lot explorer - hehe rover - server side
|
||||
install git : ```sudo pacman -S git```
|
||||
|
||||
from home clone this repos : ```git clone -b server --single-branch -o guime https://g-u-i.me/gogs/bachir/hehe-rover.git ```
|
||||
|
||||
|
||||
install ffmpeg and exiftool
|
||||
```
|
||||
# for debian server
|
||||
apt-get install ffmpeg
|
||||
apt-get install libimage-exiftool-perl
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user