Raspivid影像加進時間戳

門口常有人搞破壞,最近弄了二台raspberry pi架自家門口的監視器,爬文解決了在影像中加入日期及時間,紀錄一下。
 
附記:架後過一個多月,逮到破壞的鄰居了,告上法院,終於清淨了。
 

1.此例影像會加進時間戳,監視錄影用,22是我機器的名子。

raspivid -t 0 -a 12 -a 1024 -a "22 %Y-%m-%d %X" -ae 32,0x00,0x8080FF -h 768 -w 1024 -o /motion/motion22/1.h264
我家門前的監視錄影。
2.此例無時間戳。  

 

raspivid -vf -hf -h 768 -w 1024 -o /home/pi/1.h264 -t 60000

參數說明:
-vf -hf 可將相反的影像轉正。
-o 後接要儲存的檔名。
-t 是要錄制的時間,單位是毫秒(ms),就是千分之一秒。所以 -t 60000就是錄影60秒。
-w 1024 -h 768 可錄製解析度為1024 X 768之影像。

O

分類: raspberry pi | 在〈Raspivid影像加進時間戳〉中留言功能已關閉

Raspberry pi 安裝 DS3231 RTC時鐘模組

DS3231.jpg


1. Enable i2c on the Raspberry Pi.

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Locate the line blacklist i2c-bcm2708 Comment it out by typing a '#' in front. i.e. #blacklist i2c-bcm2708

2. Load the required modules at startup.

sudo nano /etc/modules

Add the following line at the end

 i2c-bcm2708
 i2c-dev
 rtc-ds1307

3. Install i2c-tools

 sudo apt-get install i2c-tools

4. Reboot (Run sudo reboot)

Note: The following commands require root privileges to run. It is easier to run them from a root prompt. A root prompt can be launched by running sudo bash.

5. Check for I2C connectivity to DS1307

Run i2cdetect -y 0 on Model A

i2cdetect -y 0 

Run i2cdetect -y 1 on Model B

i2cdetect -y 1 

The address 0x68 should be listed if the module is connected properly.

6. Instantiate the DS1307

Run echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device on Model A

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device 

Run echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device on Model B

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 

7. Ensure that the system time is set.

8. Initialize the hardware clock

hwclock --systohc -D --noadjfile --utc

This will set the time on the DS1307.

9. Verify the hardware clock

hwclock -r

If everything is configured correctly, the time and date is displayed.

10. Configure the hardware clock to synchronize on boot up.

nano /etc/rc.local

Insert the following lines before the 'exit 0' line

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device on Model A

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device on Model B

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
sudo hwclock -s


references:

http://yehnan.blogspot.tw/2014/01/raspberry-pirtc.html
http://feilipu.me/2014/12/21/ds3231-for-raspberry-pi/
http://www.instructables.com/id/Set-up-Real-Time-Clock-RTC-on-Raspberry-Pi/

O

分類: raspberry pi | 在〈Raspberry pi 安裝 DS3231 RTC時鐘模組〉中留言功能已關閉

Phpmyadmin登入超時解決辦法

20220721修正 只要編輯php.ini,我的是在/etc/php/7.4/apache2中,修改session.gc_maxlifetime的值才行。預設是1440秒,我設為1440000秒。
最後再重啟apache2,使設定生效。

systemctl restart apache2



在phpmyadmin首頁,選[設定]->[功能]->[登入 Cookie 有效期限],修改成你要的秒數。
phpmyadmin.png

以下是phpmyadmin的說明文件內容:
Define how long a login cookie is valid. Please note that php configuration option session.gc_maxlifetime might limit session validity and if the session is lost, the login cookie is also invalidated. So it is a good idea to set session.gc_maxlifetime at least to the same value of $cfg['LoginCookieValidity'].


所以還要編輯php.ini,我的是在/etc/php/7.3/apache2中,修改session.gc_maxlifetime的值才行。

最後再重啟apache2,使設定生效。

systemctl restart apache2



PS.20200101 以下所述的方法,經測試已無法使用,請不要再試。

edit /etc/phpmyadmin/config.inc.php, add

$sessionDuration = 60*60*24*7; // 60*60*24*7 = one week
ini_set('session.gc_maxlifetime', $sessionDuration);
$cfg['LoginCookieValidity'] = $sessionDuration;

O

分類: phpmyadmin | 標籤: | 在〈Phpmyadmin登入超時解決辦法〉中留言功能已關閉