The GARICAM program plays the videos from the CEL-TEC N5 camera and shows the route on the map. It makes use of Google Maps services, internet connection is therefore necessary. The program is written in PHP and JavaScript and is developed for the Linux operating system. It will hardly work in other systems because it requires components that are available in Linux distributions.
The software is currently available in English and Czech only.
The current program version is 1.1.
GARICAM (in Devanāgarī गाड़ीकैम) comes from Hindi words गाड़ी का कैमरा meaning the car camera.
The program plays the videos from the CEL-TEC N5 camera and shows the route on the map using data from the GPS module. It is possible to play both single files and sequences. Due to the route display it is suggested to play continuous file sequences only. Synchronization of the video with the map is preserved even if the video position is moved quickly or another video is selected in the playlist. By clicking on the route the video is set to the corresponding position. By using the button below the video a snapshot in the full video resolution can be taken.
Version 1.1 offers two new controls displayed below the player.
A slider shows the running time cumulatively for all video files. The total time is displayed at the right edge of the slider, the actual time is shown at the left edge. When sliding by mouse, the selected time position is shown which enables easy finding of the place to which we want to shift. The video player will select the proper video file to be played and the location on the map will be synchronized. This function requires an HTML5 capable browser.
The second new control is the Go button. If you push it when the car is standing, the player will be moved forward to the nearest moment when the car starts running. The values of the speed are stored in the GPS data. The function may thus work properly only if the GPS data are available.
In addition to drawing the route the actual speed and heading are displayed below the map. These values are retrieved from the data obtained from the GPS module. Total distance is calculated using the Google Maps API functions and the average speed is evaluated as a ratio of the distance and time.
You can view the program demonstration in the video below. Explanation is given in Czech and English subtitles (select them by using the icon in the lower right corner of the video). The video demonstrates version 1.0beta.
Safari for iPad cannot display subtitles, you have to use directly the YouTube application for iPad. I did not manage to display subtitles in the YouTube application for Android but Chrome for Android displays them.
The program requires other components that must be acquired and installed separately. The instructions are given below.
5.1. | ffmpeg |
5.2. | jwplayer |
5.3. | Google Maps API key |
5.4. | Web server |
ffmpeg
is a program for operations with video files from the command prompt. It is
used for extraction of subtitles into a text file that contains information from the GPS
module in the GPRMC format. The program need not be contained in the default installation
but an installable package should be available. In the worst case you will have to compile
it from the sources.
jwplayer
is a video player written in JavaScript. It offers functions needed for
developing a program for synchronization of the video and the map. You can freely download
it from
www.jwplayer.com/.
The route is displayed on the map using the Google Maps API. The API requires authorization by means of a user key. The free version allows 25 thousand accesses daily. It is impossible to reach this limit by personal use. However, if I published my key, other users might exceed my limit and I would have to pey for their access. That's why each user must have his or her own key. Obtaining the key is described in this tutorial. You must have a Google account.
If you choose Edit allowed referers, remember that referer is
not a public IP address of the server but its name used to access it. If you use a URL
such as http://localhost/garicam
, the referer is localhost
. Such
a limitation does not provide any protection because all computers may be locally accessed
as localhost
with an IP address of 127.0.0.1 or ::1. There are other mean how
to overcome the allowed referer. The best way is therefore usage of the https protocol and
securing the access with a usename and a password.
As already written, jwplayer
is unable to play a video using the
file:
protocol, a web server must be used. Any web server supporting PHP is
sufficient. The author of this program chose Apache merely because he has been using
Apache for other projects for many years. Installation of Apache in Linux systems is easy
and configuration file for use of the Garicam program is distributed in the
package. It is enough to edit the directory names, place the file to directory
/etc/httpd/conf.d
, and restart Apache. The structure of the configuration
file will be explained later.
The distribution package contains two directories. The garicam
directory contains files that have to be installed on the web server. The tools
directory contains useful tools and templates of the configuration files.
Installation of the server files is straightforward. The whole directory
garicam
should be copied to the directory from which the web server reads its
file. In case of Apache it is usually /var/www/html
but it may differ in some
distributions. The files should therefore be copied to arbitrary subdirectory.
In thsi directory a subdirectory with the name jwplayer
must be
created and the files of the javascript video player should be placed there. These are the
following files from the distribution of
jwplayer: jwplayer.js
, jwplayer.flash.js
,
jwplayer.html5.js
.
All files must be readable by a user under which the web server runs. The easiest way is to make them readable by everybody using the following commands (assuming the default location of Apache document root):
cd /var/www/html chmod +rx garicam garicam/jwplayer chmod +r --recursive garicam/* |
As already written, the videos must be served by the web server. The files must therefore be stored in a directory accessible by the server. However, the camera records contain time and location whis is information that the user need not wish to share. The program therefore requires the videos directory be the subdirectory of the program directory. In such a case it bay be difficult to insert files. It is therefore possible to create a symbolic link to a directory located in the home directory:
cd /var/www/garicam ln -s ~/path/to/camera/files videos |
Later we make this directory unbrowsable over the web.
Unix systems use /tmp
or /var/tmp
for temporary
files. The link to this directory may be present in the TMPDIR
environment
variable. However, the directory has a special property. For the security reasons the name
of the file created in it is mangled so that it is accessible by the creating process only.
However, the Garicam program needs to create a file by one process and read and delete it by
another process. This is the reason why we need another working directory, its default name
is /GaricamTMP
. The owner of this directory must be the user under which the
web server runs.
Garicam configuration settings are present in two files. Both of them are in
the garicam
directory that you have copied to the web server document tree.
Replace the text YOUR_KEY_HERE
in file key.php
with
your actual key that you ackquired following the instructions in section
Google Maps API key.
File incl_all.php
allows setting various parameters but you
should change only some of them.
The basic configuration is set in file garicam.conf
that is
present in directory tools
. Its contents is as follows:
<Location /garicam> Options FolloSymLinks SSLRequireSSL Include auth/auth.conf AuthType Basic AuthName "Garicam" Require ... # user or group </Location> |
Location
specifies where the directory with the program is
located in the web server document tree. The Options
command is the only
mandatory one. Value FolloSymLinks
allows following the symbolic links even
outside the server document tree. It is important not to set Indexes
. Since
personal information will be transferred over the network, it is better to request
encryption using the SSLRequireSSL
parameters. Protocol https
will be allowed even without this parameter but using it will enforce encryption.
The remaining lines server for setting the access y user names and password.
Let's assume that in a more complex configuration the same files with user names and
passwords will be used to control access to several directories. We will then read the
auth/auth.conf
in all such directories but the result will be the same as if
the contents of this file were present here. Notice thet its name is relative to the
/etc/httpd
directory, not to the location of the garicam.conf
file. The paths to the user and group definition files are absolute.
In the groups file each line starts with the group name and after a colon space separated user names are given. A user may be a member of several groups as in the following sample:
family:myself mywife myson mybrother mygirlfriend friends:John Jim Jack Jane Judy Jessie beer:myself John Jim Tom Jerry Jameson |
Parameter AuthName
specifies the text that will be shown in the
login dialogue. Parameter Require
specifies who will have access to the
directory. Three possibilities are available:
family
.
The file containing user names and passwords is created and maintained by the
htpasswd
program. Each line contains the user name followed by a colon and
password hash. It might look as:
myself:$apr1$DKyOFQ.G$QEgnHSolx0IoJ20xN78fF. mygirlfriend:$apr1$qIkobQi2$UFjdyUuyGfb4kFGLILVPf/ Jessie:$apr1$GHISaAwA$eYuPX1.0vDlL7TOCT4Mpu/ |
Put garicam.conf
to /etc/httpd/conf.d
, other files
to directories listed in the configuration file mentioned and restart Apache. If Apache
does not work, read the next section.
If SELinux is activated, the files must not be in arbitrary directories but
only in directories with proper context. If this condition is not fulfilled, Apache will
not start. I had always problems that something did not work, therefore I have disabled
SELinux by writing SELINUX=disabled
in /etc/selinux/config
and
rebooted. If you want to use SELinux without getting mad, you have to read its
documentation thoroughfully.
Under normal conditions the temporary files are deleted almost immediatelly
after creation. They remain in the directory only if the program is interrupted. They can
be automatically deleted by the garicamtmpclean.sh
script. Copy it to the
/etc/cron.daily
directory. Do not forget to change the directory name to the
value set in section
Preparing the working directory for temporary files.
The language of the application is set in the web browser. Each web browser offers setting preferred languages for content presentation as well as selection of the preferred order. The setting is browser dependent. The application is presented in a language chosen according to these preferences. If no language supported by the application is found, the application will use the English language.
At first it should be noted that the USB port of the camera is very slow. It is better to copy the files by using a memory card reader even if you have USB2 only.
The files in the camera are stored in two subdirectories of the
DCIM
directory. Probably one of the directories is reserved for the files
protected against overwriting but such an information in the camera manual is missing. It is
usefule to create a subdirectory for each route in the directory for videos and copy the files
from both directories into it. If you wish to copy the route from 21st August 2014,
you can achieve it by the following commands:
cd /path/to/my/video/files mkdir Route-2014-08-21 cp -v /media/camera/DCIM/*/20140821* Route-2014-08-21/ chmod +rx Route-2014-08-21 chmod +r Route-2014-08-21/* |
Commands chmod
will set visibility of the files and directories for
the web server. Remember that +rx
mst be set for all parent directories on the
path, otherwise the web server will not be able to use the files.
The program can be used and redistributed under GPL.
garicam-1.1.tar.gz, 1.3 MiB
I would like to thank to the Czech distributer of CEL-TEC cameras who kindly sent me a sample file so that I could develop the first alpha version before buying the camera.
I am forced to sponsor musicians and other copyright organisations by my programming work because I store my software, input data as well as the results of calculation on CD and DVD media.