Zum Inhalt

Schlagwort: linux

DIY Surveillance Camera Recording

my crontab:

# start recording on boot
@reboot sleep 10; /usr/local/bin/startrecord.sh &> /dev/null

# restart every 10 minutes to create a new file
*/10 * * * * killall ffmpeg ; sleep 5 ; /usr/local/bin/startrecord.sh &> /dev/null

# purge old recordings
0 */6 * * * find /data/office-kamera -type f -mtime +12 -delete

/usr/local/bin/startrecord.sh

#!/bin/bash

#cam1
/usr/bin/ffmpeg \
 -rtsp_transport tcp -i rtsp://user:password@10.0.100.21:554/11 \
 -c:v mpeg2video -b:v 16M -bufsize 16M -maxrate 16M /data/office-kamera/$(date +\%Y-\%m-\%d.\%H-\%M).cam1.mpg \
 -c:a mp2 -ac 1 -ab 64k -ar 44100 \
 -y -update 1 -r 3 -f image2 -q:v 10 -vf "scale=iw/2:ih/2,transpose=2" /var/www/html/cam/cam1.jpg \
  &>/tmp/cam1.log &

Important: We use mpeg2 for a purpose! Forget matroska/h264/hs65. If your recording stops the hard way (power outage, crashing ffmpeg process, rising of the dead), no file trailer is written and you can NOT play or reconstruct your video when using mp4. For that reason we choose mpeg2, because you can still view fragments from a 20 year old CD-R that has been through a blender, or if you drop a thermonuclear weapon on your hard drive.

This will also put image frames to /var/www/html/cam/, where you can host a HTML document that displays your image and refreshes it via javascript if you like.

Finding you cameras RTSP URL is key. Just google "camera model rtsp url". If you have any questions feel free to ask. Consider donating via paypal if it works for you;)

1 Comment

Compiling and running ethminer 0.19.0 on Ubuntu 21.04

git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer
git checkout tags/v0.19.0
git submodule update --init --recursive
rm -rfv build && mkdir build && cd build

export CC=/usr/bin/gcc-8
export CXX=/usr/bin/g++-8
cmake .. && make . && sudo make install

ethminer -P stratum://0x2a9d3072a8feb1578c2f10069010480b8742c39c@eu1.ethermine.org:4444

Notes to self:

  • use gcc-8
  • have at least 4GB Memory on the GPU
  • use a CUDA-10 compatible card
Leave a Comment

How to remove all backups in Plesk for Linux

If you ever find yourself confronted with a Plesk system that is running out of disk space, and you just want to get rid off all the misconfigured "keep forever" backups, here's how to remove them all from the command line:

/usr/local/psa/admin/bin/pmm-ras --get-dump-list | egrep "name=\".*.xml" | awk -F '"' '{ print $2 }' | xargs -I {} /usr/local/psa/admin/bin/pmm-ras --verbose --debug --delete-dump --dump-specification={} --session-path=/var/log/plesk/PMM
Leave a Comment

Fix errors when compiling Linux Kernel 4.12 with GCC 8

Error:

In file included from arch/mips/kernel/syscall.c:17:
./include/linux/syscalls.h:196:18: Fehler: »sys_mips_mmap« Alias zwischen unverträglichen Funktionstypen »long int(long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, off_t)« {alias »long int(long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long int)«} und »long int(long int, long int, long int, long int, long int, long int)« [-Werror=attribute-alias]

Solution:

echo "KBUILD_CFLAGS += -Wno-error=attribute-alias" >> Makefile

Leave a Comment

Gentoo GNU/Linux on an SGI Octane

UPDATE: gentoo/octane is released. CLICK HERE!

Finally!

More info will be coming soon. Just come teaser to get you interested 😉

I AM running Linux 4.12 in full 64 bits, gcc 8, a current glibc, and all the modern software. WITH audio. WITH accellerated graphics. And my root volume is on 3x147GB SCSI Software RAID-0 stripeset goodness. And yes, I do have multiple backups. Boom!

rephlex@octane ~ $ uname -a && cat /etc/*release && cat /proc/cpuinfo && df -h && free -m
Linux octane 4.12.0 #2 SMP Fri Dec 14 21:41:04 CET 2018 mips64 R12000 V2.3 FPU V0.0 SGI Octane GNU/Linux
Gentoo Base System release 2.2
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo/Linux"
ANSI_COLOR="1;32"
HOME_URL="http://www.gentoo.org/"
SUPPORT_URL="http://www.gentoo.org/main/en/support.xml"
BUG_REPORT_URL="https://bugs.gentoo.org/"
system type : SGI Octane
machine : Unknown
processor : 0
cpu model : R12000 V2.3 FPU V0.0
BogoMIPS : 449.02
wait instruction : no
microsecond timers : yes
tlb_entries : 64
extra interrupt vector : no
hardware watchpoint : yes, count: 0, address/irw mask: []
isa : mips1 mips2 mips3 mips4
ASEs implemented :
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

processor : 1
cpu model : R12000 V2.3 FPU V0.0
BogoMIPS : 449.02
wait instruction : no
microsecond timers : yes
tlb_entries : 64
extra interrupt vector : no
hardware watchpoint : yes, count: 0, address/irw mask: []
isa : mips1 mips2 mips3 mips4
ASEs implemented :
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root 133G 3,1G 123G 3% /
devtmpfs 10M 0 10M 0% /dev
tmpfs 62M 224K 62M 1% /run
shm 310M 0 310M 0% /dev/shm
/dev/md127 269G 7,9G 247G 4% /home
gesamt benutzt frei gemns. Puffer/Cache verfügbar
Speicher: 619 123 63 0 432 471
Swap: 7999 3 7996

1 Comment

Create a video clip from a set of images using ffmpeg

imagine your image folder looks like this:

rephlex@hera:[~/Schreibtisch/gna]: ls -1 * | head
G0037679.JPG
G0037680.JPG
G0037681.JPG
G0037682.JPG
G0037683.JPG
G0037684.JPG
G0037685.JPG
G0037686.JPG
G0037687.JPG
G0037688.JPG

[…]

This is the command you're looking for:

ffmpeg -framerate 25 -start_number 37679 -i G00%05d.JPG -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

Leave a Comment

Installing Brother DCP Scanner Drivers in Ubuntu

Start a Terminal using CTRL+ALT+T. Install some depencencies and frontend scanner tools using

sudo apt-get install xsane sane-utils simple-scan lib32stdc++6

Now download the drivers. In case brother loses them, I mirrored them here. Alternatively use the wget commands down below.

wget http://download.brother.com/welcome/dlf006646/brscan4-0.4.4-4.i386.deb -O brscan4-0.4.4-4.i386.deb
wget http://download.brother.com/welcome/dlf006651/brscan-skey-0.2.4-1.i386.deb -O brscan-skey-0.2.4-1.i386.deb
wget http://download.brother.com/welcome/dlf006654/brother-udev-rule-type1-1.0.2-0.all.deb -O brother-udev-rule-type1-1.0.2-0.all.deb

Now install the drivers you just downloaded:

sudo dpkg -i –force-architecture brscan.deb brother-udev-rule.deb

And restart your udev service:

sudo systemctl restart udev.service

All i had to do was unplug and plug in my DCP, and i could immediately scan using simple-scan in Gnome.

Leave a Comment

my PS1

export PS1="\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\h:\[$(tput sgr0)\]\[\033[38;5;6m\][\w]:\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"

 

and it looks like this:

Leave a Comment