print

Time lapse project

We present here a quick and dirty time lapse projet that was developed in a hurry at the beginning of 2022.
Project leader: Alain Filhol
Hardware and software: Yannick Raoul
Data storage: Fabien Pinet

There was 6 cameras connected to the power supply (no battery to manage) and to the wi-fi of the intranet (no memory card to manage). This was a prerequisit since a shooting periode in excess of a year was expected and since some of the cameras were installed in hard to access locations.
On each camera, the images are stored in a memory card and then are automaticaly transfered to a server through the wi-fi. The 6 cameras are remotely controled and the memory cards are remotely emptied from time to time.

Hardware

The budget being tight, Yannick Raoul selected cheap Hardware:

Raspberry Pi 4
Pi camera HQ
6 mm wide angle lens or zoom 5-50 mm
Memory card 32 Go or 64 Go
Power supply 5 V
Case made in 3D printing by Yannick Raoul
Fastening clamp
   
   

Camera locations

DRE1ILL5(08/04/2022 - )Level CAbove the H1/H2 swimming pool
DRE2ILL5(18/02/2022 - 18/05/2022)Level CAt the top of the C3 on the outer side of the reactor
  (18/05/2022 - )Level CIn front of IN8 - (test de renoyage ultime)
DRE3ILL5(22/02/2022 - )Level DAbove the swimming pool of the reactor, from the PF2 side
DPT1ILL7(31/03/2022 - )H15Instrument zones of D11+/Sharp/SAM as seen from the Chartreuse side
DPT2ILL7(04/04/2022 - )H15From the walkway above the D17/IN5 zone
DPT3ILL7(31/03/2022 - 01/09/2022)H24Instrument zones as seen from the XtremeD side
 ILL22(02/09/2022 - 18/10/2022)H522WASP instrument zone

Control software

The software used is RPi cam controlwhich is free.

1- Yannick's superviser tool

Yannick Raoul has developed a handy supervisor tool that can be accessed from the intranet through the link:

version 1: <http://rpicam-dre1wf.ill.fr/html/vuedensemble.html>

version 2: <http://rpicam-dre2wf.ill.fr/html/vuedensemble.html>

Access --> User name and Password

It makes it possible to check the status of the 6 caméras and to access the control software of each of the six cameras.

Warning: due to a recent increase of security restrictions in most web browsers, FireFox is required to run this tool.

2- Camera control

Before changing the camera settings, be sure you do not interfer with one or the other members of the Time Lapse team!

Data storage

1- Data server as set by Fabien Pinet;

smb://nestor/photos/travaux

The data transfer was automated by Yannick Raoul.
On the Raspberry of each camera, each quarter of an hour, a script performs a mirror copy of the folder /var/www/html/media to the server \\nestor\photos
Only photos missing on the server are transfered.

2- Copy of a list of images from the server

To copy a list of images from this server to a given folder you can use your own tools or script making full use of the power of Linux commands. We only give here the least sophisticated approach.

First create a list of the names of the image files which are on the server:

ls /Volumes/travaux/rpicam-dpt3wf >> /Users/filhol/Desktop/myFileList.txt

Then edit that list so that it contains only the files to be copied to the target folder.
Do not forget to add the file path to each line of "myFileList.txt"

cat myFileList.txt | xargs -I % echo cp % myDistFolder    <-- to check it works
cat myFileList.txt | xargs -I % cp % myDistFolder

Data processing

Image files are named: tl_xxxx_yyyy_yyyymmdd_hhmmss.jpg
with  yyyymmdd: year/month/day  and   hhmmss: hour/minute/second

A tool is neded to remove the non-working days and hours. We used either a Python script (videoBuilder.py by Yannick Raoul) or a Fortran app (PrepTimeLapse by Alain Filhol)

videoBuilder.py - /nestor/photos/travaux/scripts

Construit une video à partir de fichiers image, avec filtrage optionel.

positional arguments:
  chemin                répertoire ou se trouvent les fichiers "timelapse" (format tl_????_????_AAAAMM??_??????.jpg)

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Plus de trace
  -d DEBUT, --debut DEBUT
                        Debut de période sous la forme AAAAMM
  -f FIN, --fin FIN     Fin de période sous la forme AAAAMM, avec fin >= debut
  -c CODEC, --codec CODEC
                        Choix du codec video (h264 or h265)
  -r FRAMERATE, --framerate FRAMERATE
                        Choix du nombre d'image par seconde
  -w, --workfilter      Utilise un filtre pour les heures de travail
  -o OUTPUTDIR, --outputdir OUTPUTDIR
                        Répertoire de sortie

Y.Raoul EIRL; juin 2022

PrepTimeLapse manual:

Input file 1: A command file

input_file_list.txt         <-- list of image file names
output_file_list.txt      <-- list of selected image file paths
/Volumes/SSD-AF-2TB/DRE3/rpicam-dre3wf   <-- path to the images
HRANGE: 16 08       <-- hours: rejection interval  start] to stop]
HRANGE: 12 13
               <-- blank line
DRANGE: 20220205 20220207   <-- days: rejection interval  start] to stop]
DRANGE: 20220212 20220213
DRANGE: 20220219 20220221
DRANGE: 20220226 20220228
DRANGE: 20220305 20220307

Input file 2: A list of file names (no file paths) as produced by a "ls" command

tl_0000_0002_20220221_160123.jpg
tl_0010_00001_20220222_101158.jpg
tl_0010_00001_20220222_101158.jpg.t0010.th.jpg <-- line that will be rejected
tl_0010_00002_20220222_101658.jpg
tl_0010_00003_20220222_102159.jpg
tl_0010_00004_20220222_102659.jpg
tl_0010_00005_20220222_103159.jpg
tl_0010_00006_20220222_103700.jpg

The output file "output_file_list.txt " is ready for use by ffmpeg. Its format is:

file 'path/tl_iiii_jjjj_YYYYMMDD_HHmmss.jpg'   <--  uppercase: fields on which the above rejection criterions were applied

file '/Volumes/SSD-AF-2TB/DRE3/rpicam-dre3wf/tl_0010_0035_20220222_130211.jpg'
file '/Volumes/SSD-AF-2TB/DRE3/rpicam-dre3wf/tl_0010_0036_20220222_130711.jpg'
file '/Volumes/SSD-AF-2TB/DRE3/rpicam-dre3wf/tl_0010_0037_20220222_131212.jpg'
file '/Volumes/SSD-AF-2TB/DRE3/rpicam-dre3wf/tl_0010_0038_20220222_131712.jpg'

Movies from an image set

Typical ffmpeg commands. Don't forget to adapt the display speed by selecting a suitable frame rate (-r or -framerate option).

ffmpeg v2.8.20 and above

ffmpeg -f concat -r 4 -safe 0 -i output_file_list.txt  -c:v libx264 -crf 17 -preset fast -pix_fmt yuvj420p myh264movie.mp4

ffmpeg v2.8.18

ffmpeg -f concat -framerate 4 -safe 0 -i foutput_file_list.txt  -c:v libx264 -crf 17 -preset fast -tag:v hvc1 myh264movie.mp4