21 February 2015

MR3020 + Webcam Logitech C170 + Motion = CCTV Sederhana

Kali ini akan saya sharingkan bagaimana cara membuat CCTV sederhana dengan menggunakan router dan webcam.

Peralatan yang saya gunakan:
1. Router TP-Link MR3020
2. Webcam Logitech C170
3. USB Hub Belkin 7 port
4. Flashdisk Kingston 8 GB

Referensi yang saya pakai ada di website :
http://sheldor.blogspot.com/2013/09/openwrt-based-video-recording-system.html
http://sheldor.blogspot.com/2013/09/openwrt-based-video-recording-system_10.html

Sesuai petunjuknya, mula-mula routernya di flash dengan OS OpenWRT dan di exroot.
Selanjutnya download file .rar berikut :
https://www.dropbox.com/s/bc417l2ty7sj9uv/Motion%2BFFMpeg.rar?dl=0


OS OpenWRT yang saya pakai adalah versi Attitude Adjustment. Versi Barrier Breaker seharusnya juga bisa dipakai.

Ekstrak file. rar yang telah di download tadi ke PC dan selanjutnya dengan menggunakan software Putty di transfer ke routernya.
Install semua file *.ipk - nya ke router dengan perintah di Putty :

opkg install *.ipk

Berikutnya adalah edit file konfigurasi aplikasi Motion nya yang ada di :
/etc/motion.conf  :

Thread 0
daemon = on
process_id_file = /var/run/motion/motion.pid
setup_mode = off
logfile = (not defined)
log_level = 4
log_type = all
videodevice = /dev/video0
v4l2_palette = 8
input = -1
norm = 0
frequency = 0
rotate = 0
width = 640
height = 360
framerate = 3
minimum_frame_time = 0
netcam_url = (not defined)
netcam_userpass = (not defined)
netcam_keepalive = off
netcam_proxy = (not defined)
netcam_tolerant_check = off
auto_brightness = on
brightness = 0
contrast = 0
saturation = 0
hue = 0
roundrobin_frames = 1
roundrobin_skip = 1
switchfilter = off
threshold = 5000
threshold_tune = off
noise_level = 32
noise_tune = on
despeckle_filter = (not defined)
area_detect = (not defined)
mask_file = (not defined)
smart_mask_speed = 0
lightswitch = 50
minimum_motion_frames = 2
pre_capture = 2
post_capture = 2
event_gap = 60
max_movie_time = 0
emulate_motion = off
output_pictures = off
output_debug_pictures = off
quality = 75
picture_type = jpeg
ffmpeg_output_movies = on
ffmpeg_output_debug_movies = off
ffmpeg_timelapse = 0
ffmpeg_timelapse_mode = daily
ffmpeg_bps = 200000
ffmpeg_variable_bitrate = 0
ffmpeg_video_codec = mpeg4
ffmpeg_deinterlace = off
use_extpipe = off
extpipe = (not defined)
snapshot_interval = 0
locate_motion_mode = off
locate_motion_style = redcross
text_right = %Y-%m-%d\n%T-%q
text_left = Logitech-C170
text_changes = on
text_event = %Y%m%d%H%M%S
text_double = on
exif_text = (not defined)
target_dir = /www/cctv
snapshot_filename = %v-%Y%m%d%H%M%S-snapshot
picture_filename = %v-%Y%m%d%H%M%S-%q
movie_filename = %Y-%m-%d--Jam-%H-%M-%S-Shot-%v
timelapse_filename = timelapse-tanggal-%d-%m-%Y
ipv6_enabled = off
stream_port = 0
stream_quality = 50
stream_motion = off
stream_maxrate = 3
stream_localhost = off
stream_limit = 0
stream_auth_method = 0
stream_authentication = (not defined)
webcontrol_port = 8081
webcontrol_localhost = off
webcontrol_html_output = on
webcontrol_authentication = (not defined)
track_type = 0
track_auto = off
track_port = (not defined)
track_motorx = 0
track_motorx_reverse = off
track_motory = 0
track_motory_reverse = off
track_maxx = 0
track_minx = 0
track_maxy = 0
track_miny = 0
track_homex = 128
track_homey = 128
track_iomojo_id = 0
track_step_angle_x = 10
track_step_angle_y = 10
track_move_wait = 10
track_speed = 255
track_stepsize = 40
quiet = on
on_event_start = (not defined)
on_event_end = (not defined)
on_picture_save = (not defined)
on_motion_detected = (not defined)
on_area_detected = (not defined)
on_movie_start = (not defined)
on_movie_end = (not defined)
on_camera_lost = (not defined)
video_pipe = (not defined)
motion_video_pipe = (not defined)
thread = No threads

Tinggal jalankan aplikasi dengan perintah :
motion

Aplikasi ini akan selanjutnya merekam video bila terdeteksi aktivitas dalam bentuk file *.avi . File video disimpan di router di folder /www/cctv

Contoh hasil rekaman adalah sebagai berikut :



Mula-mula saya sering mendapatkan rekaman video error seperti ini :


Ternyata solusinya cukup mudah tinggal edit file konfigurasi seperti diatas dengan :
lightswitch 50 .

Sekian dulu tutorialnya , semoga bermanfaat.