made converter working on my bedian server
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
www/pictures
|
www/pictures
|
||||||
|
gps
|
||||||
|
logs
|
||||||
|
|||||||
@@ -5,3 +5,6 @@ public_html/videos/*.ogg
|
|||||||
public_html/videos/*.webm
|
public_html/videos/*.webm
|
||||||
public_html/metadata/*.json
|
public_html/metadata/*.json
|
||||||
logs/*.log
|
logs/*.log
|
||||||
|
tmp_metadata
|
||||||
|
tmp_videos
|
||||||
|
tmp_pictures
|
||||||
|
|||||||
+30
-28
@@ -1,17 +1,37 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# Bachir Soussi Chiadmi 06/2016
|
# Bachir Soussi Chiadmi 06/2016
|
||||||
# https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
|
# https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
|
||||||
# needs ffmep and exiftool
|
# needs ffmep and exiftool
|
||||||
|
|
||||||
function convertVideo(){
|
function convert {
|
||||||
|
|
||||||
|
now=$(date +"%Y-%m-%d--%T")
|
||||||
|
echo "Timelaps conversion | $now"
|
||||||
|
|
||||||
|
mkdir ~/hehe-rover/www/tmp_videos
|
||||||
|
mkdir ~/hehe-rover/www/tmp_metadata
|
||||||
|
mkdir ~/hehe-rover/www/tmp_pictures
|
||||||
|
|
||||||
|
rm -f tmp_pictures/*
|
||||||
|
|
||||||
|
x=1
|
||||||
|
for i in public_html/pictures/*.jpg; do
|
||||||
|
counter=$(printf %03d $x)
|
||||||
|
ln "$i" tmp_pictures/img"$counter".jpg
|
||||||
|
x=$(($x+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
pf=12
|
||||||
|
vf=24
|
||||||
|
|
||||||
|
echo "pictframerate:$pf, videoframerate=$vf"
|
||||||
|
|
||||||
echo 'Video conversion'
|
echo 'Video conversion'
|
||||||
pf=$1
|
|
||||||
vf=$2
|
|
||||||
echo "creating raw timelaps"
|
echo "creating raw timelaps"
|
||||||
ffmpeg -y \
|
ffmpeg -y \
|
||||||
-framerate $pf \
|
-framerate $pf \
|
||||||
-pattern_type glob -i 'public_html/pictures/*.jpg' \
|
-i tmp_pictures/img%03d.jpg \
|
||||||
-r $vf -pix_fmt yuv420p -c:v libx264 \
|
-r $vf -pix_fmt yuv420p -vcodec libx264 \
|
||||||
tmp_videos/timelaps-raw.mp4
|
tmp_videos/timelaps-raw.mp4
|
||||||
|
|
||||||
echo "optimizing responsive videos"
|
echo "optimizing responsive videos"
|
||||||
@@ -23,17 +43,15 @@ function convertVideo(){
|
|||||||
|
|
||||||
echo "updating production videos"
|
echo "updating production videos"
|
||||||
rsync -r tmp_videos/ public_html/videos/
|
rsync -r tmp_videos/ public_html/videos/
|
||||||
}
|
|
||||||
|
|
||||||
function exportData(){
|
|
||||||
echo "metadata export"
|
echo "metadata export"
|
||||||
pf=$1
|
|
||||||
vf=$2
|
|
||||||
f=0
|
f=0
|
||||||
|
|
||||||
echo -e "{" > tmp_metadata/frames.json
|
echo -e '{' > tmp_metadata/frames.json
|
||||||
echo -e '\t"frames":[' >> tmp_metadata/frames.json
|
echo -e '\t"frames":[' >> tmp_metadata/frames.json
|
||||||
for pict in public_html/pictures/*.jpg; do
|
for pict in public_html/pictures/*.jpg; do
|
||||||
|
# SRC
|
||||||
|
src="${pict/public_html\/pictures\//}"
|
||||||
# TIME
|
# TIME
|
||||||
# time="${pict/pictures\/hehe-/}"
|
# time="${pict/pictures\/hehe-/}"
|
||||||
# time="${time/.jpg/}"
|
# time="${time/.jpg/}"
|
||||||
@@ -43,7 +61,7 @@ function exportData(){
|
|||||||
|
|
||||||
# FRAME
|
# FRAME
|
||||||
frame=$(((60/$vf)*$f))
|
frame=$(((60/$vf)*$f))
|
||||||
echo -e "\t\t{\"pict\":\"$pict\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> tmp_metadata/frames.json
|
echo -e "\t\t{\"src\":\"$src\", \"time\":\"$time\", \"gps\":\"$gps\", \"frame\":\"$frame\"}," >> tmp_metadata/frames.json
|
||||||
f=$(($f+1))
|
f=$(($f+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -51,24 +69,8 @@ function exportData(){
|
|||||||
echo -e "}" >> tmp_metadata/frames.json
|
echo -e "}" >> tmp_metadata/frames.json
|
||||||
|
|
||||||
rsync -r tmp_metadata/ public_html/metadata/
|
rsync -r tmp_metadata/ public_html/metadata/
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function convert(){
|
|
||||||
now=$(date +"%Y-%m-%d--%T")
|
|
||||||
echo "Timelaps conversion | $now"
|
|
||||||
|
|
||||||
|
|
||||||
mkdir ~/hehe-rover/www/tmp_videos
|
|
||||||
mkdir ~/hehe-rover/www/tmp_metadata
|
|
||||||
|
|
||||||
pictframerate=12
|
|
||||||
videoframerate=24
|
|
||||||
|
|
||||||
echo "pictframerate:$pictframerate, videoframerate=$videoframerate"
|
|
||||||
|
|
||||||
convertVideo $pictframerate $videoframerate
|
|
||||||
exportData $pictframerate $videoframerate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user