How to use Motion Linux 4.2.2-1 to create a CCTV system on Ubuntu 18.10 , 64 bit with a Web Cam and Hikvision IP Cam

The CCTV system that is explained here is based on 2 cheap cameras.

One normal USB web Camera and a Hikvision Q1 network PT camera (wifi)

IMG_20190615_162612

Figure:-1

The Motion Linux available in the Ubuntu software center is not the latest. Therefore it is advisable to get the software from the Motion website .

First install Motion Linux latest release  using the GDebi  Package Installer.

The Motion release compatible with Ubuntu 18.10 , 64 bit is

cosmic_motion_4.2.2-1_amd64.deb

Now if you see the folder motion is being created at /etc/motion/. You can see 5 files in this folder as i the following figure

Screenshot from 2018-02-02 18-28-44

 Figure:- 2

Editing motion.conf file to suit our cameras

 

The main file is “motion.conf”. Other files give sample script files for different cameras.

If you open the motion.conf using a text editor like gedit , you can see the commands related  to  linking cameras .Please see the following figure for the details.

Screenshot from 2019-06-15 16-12-42

Figure:- 3

You will have to delete semicolon ” ; ” placed at the beginning of the commands in order to activate the corresponding camera

Here ,I have used camera1.conf as the configuration file for the Hikvision camera

and camera4.conf as the configuration file for the web cam

The above configuration files have been prepared using the guide scripts in camera1-dist.conf and camera4-dist.conf files available in /etc/motion/

On the Ubuntu terminal

sudo gedit /etc/motion/motion.conf

Then the motion.conf file is opened

Then delete semicolon ” ; ” in front of

camera /etc/motion/camera1.conf  ( line no 163)

camera /etc/motion/camera4.conf

Then save the file motion.conf

Since we are using a separate configuration  file ( camera4.conf) for the web cam we don’t need some commands in main “motion.conf” file as those commands are included in camera4.conf .Therefore we introduce semicolon “;” in front of those commands ( for videodevice at line no 34 and stream_port at line no 155 )as follows in the motion.conf file as shown in the following figures

Screenshot from 2019-06-15 16-13-46

Figure:-4

Screenshot from 2019-06-15 16-13-08

Figure:-5

Creating configuration files for cameras

For the web camera

On the Ubuntu terminal

sudo gedit /etc/motion/camera4.conf

Then a blank text file is opened

enter the scripts shown in the following figure and save

target_dir at line no 29 has to be selected in your computer to store motion detection video events .

Screenshot from 2019-06-15 17-11-38

Figure:-6

 

For the Hikvision camera

sudo gedit /etc/motion/camera4.conf

 

On the Ubuntu terminal

sudo gedit /etc/motion/camera4.conf

Then a blank text file is opened

enter the scripts shown in the following figure and save

Screenshot from 2019-06-15 17-12-08

Figure:-7

The netcam_url at line no 15 should be as follows for the Hikvision Q1 Network PT camera

rtsp://username:password@ip address:554/Streaming/Channels/102?transportmode=mcast&profile=Profile_2

Now all the configuration files for cameras are ready

Initiation of Motion

On the Ubuntu terminal

sudo /usr/bin/motion

Then open the web browser and enter the url

http://localhost:8080/

You can see all the cameras are working  as shown in the figure

Screenshot from 2019-06-15 15-39-44

 

Figure:-8

 

 

Advertisements

2 thoughts on “How to use Motion Linux 4.2.2-1 to create a CCTV system on Ubuntu 18.10 , 64 bit with a Web Cam and Hikvision IP Cam

  1. Hi Bandula

    Je me lance sur “DOMOTICZ”………….j’aimerai bien avoir votre avis sur ce système domotique !
    “jeedom” faut tout le temps payer, je laisse tomber!
    En plus “DOMOTICZ ” est français……lol..

    see you later

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s