<style>
.cli {
background-color: #fcff01;
display: inline-block;
padding: 0 4px;
font-style: italic;
}
pre.code-block {
background-color: #f4f4f4;
padding: 10px;
overflow-x: auto;
font-family: monospace;
}
</style>
<h2><b>Konfigurasi Motion dengan Mode Dinamis</b></h2>
<p>Berikut adalah konfigurasi Motion untuk mode pengawasan dengan dua kondisi: <i>Idle (ringan)</i> dan <i>Aktif (kualitas tinggi)</i>. Konfigurasi ini memanfaatkan deteksi gerakan untuk beralih otomatis antar mode.</p>
<h3><b>1. Log & Web Control Settings</b></h3>
<pre class="code-block">
log_level 3
log_type all
log_file -
webcontrol_port 8080
webcontrol_localhost off
webcontrol_parms 1
webcontrol_interface 0
webcontrol_auth_method 0
</pre>
<h3><b>2. Camera Settings</b></h3>
<pre class="code-block">
netcam_url rtsp://192.168.1.109:8554/unicast
width 768
height 432
</pre>
<h3><b>3. Output & Movie Settings (Idle Mode)</b></h3>
<pre class="code-block">
framerate 1
movie_output off
movie_codec mp4
movie_filename %Y%m%d_%H%M%S
target_dir /home/debian/motion
movie_quality 10
movie_bps 300000
pre_capture 3
post_capture 0
</pre>
<h3><b>4. Motion Detection Settings</b></h3>
<pre class="code-block">
threshold 1500
minimum_motion_frames 1
event_gap 60
noise_level 32
noise_tune on
</pre>
<h3><b>5. Dynamic Switch (Gerakan Terdeteksi)</b></h3>
<p>Saat gerakan terdeteksi, perintah berikut dijalankan:</p>
<div class="cli">on_event_start</div>
<pre class="code-block">
/bin/bash -c 'echo "$(date "+%Y-%m-%d %H:%M:%S") - [GERAKAN TERDETEKSI] - Kualitas Tinggi Aktif" | tee -a /tmp/motion_event.log \
&& curl -s "http://localhost:8080/0/config/set?framerate=15" \
&& curl -s "http://localhost:8080/0/config/set?movie_output=on" \
&& curl -s "http://localhost:8080/0/config/set?movie_quality=60" \
&& curl -s "http://localhost:8080/0/config/set?movie_bps=1500000"'
</pre>
<p>Saat gerakan selesai:</p>
<div class="cli">on_event_end</div>
<pre class="code-block">
/bin/bash -c 'echo "$(date "+%Y-%m-%d %H:%M:%S") - [GERAKAN SELESAI] - Kualitas Rendah Aktif" | tee -a /tmp/motion_event.log \
&& curl -s "http://localhost:8080/0/config/set?framerate=1" \
&& curl -s "http://localhost:8080/0/config/set?movie_output=off" \
&& curl -s "http://localhost:8080/0/config/set?movie_quality=10" \
&& curl -s "http://localhost:8080/0/config/set?movie_bps=300000"'
</pre>
<h3><b>6. Live Stream Settings</b></h3>
<pre class="code-block">
stream_port 8081
stream_localhost off
stream_maxrate 0
stream_quality 10
stream_preview_scale 25
stream_preview_newline off
stream_preview_method 0
stream_grey off
stream_motion off
stream_limit 0
</pre>