Friday, August 14, 2015

Gammaeule und Hausmutter

Schon seit Monaten treiben grüne Raupen ihr "Unwesen" in meinen Kräutern und dem Salat. Aufgrund ihrer (eher unauffälligen) Zeichnung und des charakteristischen "Katzenbuckels" bei der Fortbewegung vermutete ich, dass es sich um die Larven der Gammaeule handeln könnte. Kurzentschlossen habe ich mir eine Fauna-Box (auch Faunarium) besorgt:

Fauna-Box in der ÜbersichtFraßbereich in der Fauna-BoxPuppen in der Fauna-Box

Auf der einen Seite befindet sich der Fraßbereich. Als Unterlage dient Küchenpapier, das befeuchtet wird. Das Futter ist Löwenzahn - auch Salat ist möglich; die Gammeeule hat viele Futterpflanzen - und wird frisch und trocken in einer kleinen Glasflasche mit Wasser bereitgestellt. Das Futter muss täglich gewechselt werden. Auch die Unterlage wird täglich getauscht und der Kot entfernt. Deswegen auch die Trennung der Faunabox in zwei Bereiche! Die andere Seite der Box kann zunächst mit zerknülltem (Küchen-)Papier belegt werden. Die Raupen der Gammaeule suchen sich zur Verpuppung einen geschützten Bereich (Papier, manchmal auch Blatt der Futterpflanze) und spinnen sich ein. Man kann die Puppen nach einer Weile vorsichtig vom Untergrund trennen, wenn man möchte oder der Standort ungünstig ist. Ich konnte keine Schäden dadurch beobachten.

Nach dem Schlupf ist eine Kletterhilfe scheinbar nicht notwendig. Die Zeit, bis der Falter schlüpft, beträgt nur einige Tage (evtl. 1-2 Wochen?). Dann kan man ihn bewundern :) Es handelt sich tatsächlich um die Gammaeule (im ersten Bild oben befindet sich eine Raupe):

Gammaeule - Schmetterling und Raupe auf LöwenzahnGammaeule auf Löwenzahn

Die Fraßschäden, die die Raupen der Gammaeule bei mir hinterlassen haben, betrafen vor allem den Salat (Lollo Bionda+Rosso), das Thai-Basilikum, teilweise Genoveser- und rotes Baslikum, Kohlrabi, Borretsch sowie die Buschbohnen. Ich kann es verkraften :) und verzichte daher auch weiterhin auf ihre chemische Bekämpfung (Ablesen hilft zur Not auch).

An einem Löwenzahn fand ich eine weitere Raupe. Ich vermute eine Hausmutter, die letztes Jahr in großer Zahl an meinen Paprikas zu finden war. Leider scheint diese einen anderen Ort für die Verpuppung zu benötigen und sich in der Fauna-Box nicht sehr wohl zu fühlen. Sie frisst nicht mehr, sucht aber auch nicht das Küchenpapier oder das Futter auf. Eine Verpuppung findet (noch) nicht statt. Sie ist träge und wirkt eher trocken als "fett". Den fertigen Falter konnte ich dieses Jahr auch schon bewundern:

Hausmutter auf Apfelbaum (Dresden, 11.06.2015)Hausmutter auf Apfelbaum (Dresden, 11.06.2015)

Thursday, May 28, 2015

Der erste Pilzspaziergang

Trotz (oder gerade wegen der) Erkältung habe ich einen kurzen Spaziergang in die Heide unternommen und dabei auch mal nach Pilzen geschaut. Das Ergebnis fiel, wie zu erwarten, sehr mau aus. Man merkt auch in der Heide die Trockenheit. Ein schöner Lichtblick war der unten abgebildete Porling auf Buchentotholz, bei dem es sich um P. tuberaster, den Sklerotien-Stielporling handeln dürfte. Außerdem waren einige alte Glimmer-Tintlinge und (vermutlich) Stockschwämmchen zu sehen.

Sklerotien-Stielporling am 27.05.2015 in der Dresdener HeideSklerotien-Stielporling am 27.05.2015 in der Dresdener Heide (Draufsicht)

Stellenweise war der Waldboden mit bereits blühenden Walderdbeeren bedeckt (auf meiner Terrasse trägt sie schon seit geraumer Zeit Früchte). Am Wegesrand fanden sich zudem eine Skorpionsfliege und zwei schwarze Schnegel.

Walderdbeeren am 27.05.2015 in der Dresdener HeideSkorpionsfliege am 27.05.2015 in der Dresdener HeideSchwarzer Schnegel am 27.05.2015 in der Dresdener Heide

Ich hoffe, die Pilzsituation bessert sich im Juni und bringt wieder viele Pfifferlinge hervor :)

Friday, April 17, 2015

Sunday, April 12, 2015

Nisthilfen und Unterpflanzung für Wildbienen

Erdbeere, Chili, Paprika, Zucchini, Wassermelone, Kirsche oder Apfel müssen bestäubt werden. Neben den Schwebfliegen (Chili und Paprika!) übernehmen das Bienen und Hummeln. Seit wenigen Tagen sind Mauerbienen hier fleißig am Nistbau. Daher möchte ich die Nisthilfen kurz vorstellen.

Nisthilfe von Dobar

Wildbienenhotel (Dobar)

Ich habe zum Ende des letzten Frühjahrs ein Insektenhotel von Dobar mit Schilf und gebohrten Birkenästen als Nisthilfe aufgehängt. Interessanterweise wurden die Birkenäste zwar besucht, aber ich konnte keinen vollständig belegten Eingang finden. Stattdessen wurden schon nach kurzer Zeit die ersten Schilfröhrchen in Beschlag genommen. Wegen des ausgefransten Schnittes braucht man sich nicht unbedingt Gedanken machen - auch wenn das häufig als Qualitätsdefizit wahrgenommen wird - die Bienen schneiden sich den Eingang frei und räumen das Röhrchen aus, wenn sie Interesse haben. Auf dem Bild rechts ist übrigens eine Mauerbiene zu sehen, die gerade einen Eingang verschließt. Die Birkenhölzer werden derzeit durch die Mauerbienen ebenfalls recht gut angenommen, sind aber noch nicht vollständig belegt und verschlossen.

Unter dem Häuschen habe ich eine Blechdose mit selbst geschnittenem Schilf (in Fixzement eingegossen) angebracht. Ich habe die Schilfröhrchen unterschiedlich lang gelassen. Das führt leider dazu, dass neugierige Vögel sich schnell mal dranhängen und die Eingänge beschädigen. Mal schauen, wie das Produkt angenommen wird.

Nisthilfe aus gebohrtem Pappelholz

Stirnholz mit Bohrung

Das Holz war ein Zufallsfund. Eine Zitterpappel war frisch gefällt wurden und der Eigentümer erlaubte mir, ein ca. 40 cm langes und 20 cm breites Stück mitzunehmen. Ich habe dann etwa 15 cm davon abgeschnitten und mit Bohrern von 4..10 mm Durchmesser Löcher in das Stirnholz gebohrt. Da das recht spät im letzten Jahr geschah, konnte ich mit einer Ausnahme kaum Aktivitäten an dem Holz beobachten. Die Ausnahme war eine Solitärwespe, die innerhalb eines Tages gleich 4 Gänge für sich in Anspruch nahm. Einer davon (leicht schräg unten links im Bild) zeigt ein kleines Loch im Verputz. Hier hatte letztes Jahr eine Schlupfwespe das Gelege parasitiert. In den letzten Tagen hinzugekommen sind Gelege von Mauerbienen. Zwei Eingänge sind sogar schon vollständig belegt! Die Mauerbienen nehmen bevorzugt die Röhren mit 8..10 mm Durchmesser, quetschen sich mittlerweile aber auch in die nur 5..6 mm großen, da die erstgenannten schon belegt sind :)

Man kann auf dem Bild auch den Nachteil von Bohrungen im Stirnholz erkennen: durch die unterschiedliche Trocknung im Inneren und Äußeren des Holzblockes entstehen Risse. Durch diese können Parasiten eindringen. Ich werde den Block also irgendwann wechseln müssen. Als günstiger Ersatz schwebt mir entweder ein Nistholz (ca. 10  EUR) oder ein zersägter Ivar-(Eck-)Pfosten (<10 EUR) vor.

Nisthilfe von Florabest (Lidl)

Nisthilfe von Florabest (Lidl)

Lidl bietet dieses Jahr Nisthilfen für Insekten an. Der Preis liegt bei <10 EUR. Da habe ich zugeschlagen. Das Gehäuse selbst besteht aus eher dünnen, genagelten(?) Brettern und das Metallgeflecht ist geklammert. An der Rückseite besitzt das Haus schon einen Riss. An Materialien wurden Strohwolle, Zapfen, gebohrte Äste sowie Bambusröhren eingesetzt. Ob Schmetterlinge, Marienkäfer und Florfliegen das Angebot annehmen, sei mal dahingestellt. Aber die Röhren vom Bambus und im Astholz sind im Durchmesser ausreichend, auch wenn manchmal ein Ausbohren nicht schaden könnte (notfalls hilft die Rundfeile). Die Mauerbienen haben sie sofort gut angenommen. Ob das auch bei den späteren Bienenarten so sein wird und ob die Brut überlebt, muss sich zeigen. Ich bin nicht unzufrieden, gerade bei dem Preis.

Unterpflanzung

Wildbienen benötigen auch Nahrung. Um sie anzuziehen und ihnen gleichzeitig einen interessanten ansprechenden Mix anzubieten (alles in der Hoffnung, dass sie nebenbei auch meine Nutzpflanzen besuchen), bieten sich Bienenweiden an, also Pflanzen, die den Insekten Nektar und Pollen spenden; gerade in der Stadt, wo die schmückende oft wichtiger als die ökologische Funktion einer Pflanze ist. Besonders zeitig im Jahr, wenn nur wenige Arten blühen, sind Weidearten (Salix) als erste Nahrungsquelle vorhanden. Die wunderschön blühenden Sal-Weiden (Salix caprea) sind oft der erste Treffpunkt für Bienen und Hummeln in der freien Natur, jedoch nur selten in der Stadt (Brachflächen, Vorwaldgesellschaft!). Aufmerksame Menschen haben vielleicht auch den zeitig blühenden Löwenzahn bemerkt, der u.a. unter Obstbäumen nicht fehlen sollte! Was für manche Unkraut ist, nutze ich bei meinen Obstbäumen im Kübel als Unterpflanzung, gemeinsam mit Wildkräuter- und Wildblumenmischungen. Außerdem nutze ich leere Pflanzgefäße für Gründüngerarten (Senf, Lein, Ölrettich, Phacelia etc.), die gerne besucht werden. Als echte Bienenweide entpuppt haben sich außerdem Borretsch (Gurkenkraut), der sehr schön und lange blüht, lecker in Quark und Salaten schmeckt und sich als Unterpflanzung bei Erdbeeren eignet, sowie Kapuzinerkresse, die als Unterpflanzung bei Obstbäumen Blattläuse von den Bäumen ablenkt und Hummeln anlockt. Letztere bietet i.d.R. auch Schwebfliegen Lebensraum, deren Larven Blattläuse fressen und die Hauptbestäuber an Chili und Paprika sind!

Apropos ...

Am Projekttheater in der Neustadt gibt es in der Hauswand auf Augenhöhe alte Bohrlöcher; teilweise ist der Dübel schon rausgefallen. Darin nisten derzeit Mauerbienen! Vor kurzem sah ich auch Werbung für einen einen Eltern-Kind-Nachmittag in der Neustadt/Radeberger Vorstadt zum Bau von Insektenhotels, was ich für eine schöne Idee halte. Vielleicht konnte ich ja Interesse an einem eigenen Bienenhotel wecken :)

Ausgewählte Links

Sunday, March 29, 2015

Prevent suspend/hibernate if system is remotely backed up via rdiff-backup

I usually use rdiff-backup to backup several of my systems. One is a workstation which goes to sleep after some time of idling around. Now having a user logged in running rdiff-backup (or rsync, rsnapshot etc for that matter) won't prevent the system from being put to sleep. Naturally this happens before the backup is complete. So some time ago I was looking for a resolution and recieved a suggestion to use a script in /etc/pm/sleep.d/. I had to modify the script a bit, because the query result always was true. So this is my solution in /etc/pm/sleep.d/01_prevent_sleep_on_backup now:

#!/bin/sh

. "${PM_FUNCTIONS}"

command_exists rdiff-backup || exit $NA

case "$1" in
        hibernate|suspend)
                if ps cax | grep -q rdiff-backup
                then
                        exit 1
                fi
        ;;
esac

exit 0

Currently testing ...

Update

The above works with pm-utils; but it fails with systemd. Seems I have to move and modify the script for my system.

Update 2

It doesn't work. In short: exit 1 doesn't prevent systemd from going to suspend. I can see, that the script itself leads to the results I want, so the logic is correct. But I cannot find a way to tell systemd, to stop suspend. Shouldn't it be doing this automtically in a case, where a remote user is logged in and runs a command?

Update 3

There is also a related bug report.

Monday, March 23, 2015

Start ...

Seit einiger Zeit lebe ich nun in der Dresdner Neustadt und kann eine schöne, großzügige Dachterrasse im 4. Obergeschoss eines Mehrfamilienhauses nutzen. Auf diesem Blog möchte ich ein wenig von meinen Erfahrungen beim Gärtnern auf dieser Stadt-Dachterrasse aber auch beim Pflanzen von Bäumen und Sträuchern (vor allem an Gewässern) erzählen.

Wer es bis hierher noch nicht erahnt: in meiner Wohnung und auf meiner Dachterrasse finden sich viele unterschiedliche Pflanzen: u.a. Carnivore, Blumen, "Grünpflanzen", Gemüse, Beerensträucher, Obststämme, Laub- und Nadelhölzer. Auch wenn die Terrasse groß ist, sind den Ambitionen durch die Statik, den Platz- und Wasserbedarf der Pflanzen natürliche Grenzen gesetzt. Wer möchte hier schon einen 6-Meter-Apfelbaum stehen haben? Ich sicher nicht :) Aber auch auf kleinem Raum kann man viel erreichen. Dabei versuche ich, die Grundsätze der Mischkultur anzuwenden, biete Nisthilfen und Bienenweiden an und verarbeite alle pflanzlichen Reste in einer Wurmkiste zu Kompost. Hört sich das spannend an?

Aufgrund meiner Arbeit und der Berufung als Lehrer der DWA-Gewässernachbarschaft "Obere Elbe" liegen mir außerdem unsere strukturell massiv verarmten Gewässer am Herzen. Vielen davon fehlt schon das Notwendigste - nämlich standortgerechte Bäume und Sträucher im Uferbereich und im Gewässerrandstreifen. Dabei kann jeder (das Einverständnis des Besitzers bzw. Bewirtschafters des Grundstückes vorausgesetzt) viel für die Gewässer tun, indem er die richtigen Pflanzen anpflanzt. Das ist in aller Regel nicht schwer und auch in kleinem Kreis schnell getan. Das Ergebnis kann eine abwechslungsreiche Aue mit unterschiedlichen, teils sehr schön blühenden oder samenden Gehölzen sein, die das Gewässer strukturell aufwerten und gleichzeitig die Ufer befestigen, dem Hochwasserschutz dienen und z.B. Vögeln, Schmetterlingen und (Wild-)Bienen Nahrung und Lebensraum bieten. Wer das nicht glaubt, kann sich einfach mal das Europäische Pfaffenhütchen (Spindelstrauch), die Zitterpappel (Espe), die Schwarzerle, die Gewöhnliche Traubenkirsche oder eine der vielen einheimischen Weidenarten anschauen.

Friday, February 13, 2015

Motion picture capturing: Debian + motion + Logitech C910 - part II

In my recent attempt to setup a motion detection camera I was disappointed, that my camera, which should be able to record with 30 fps in 720p mode only reached 10 fps using the software motion. Now I got a bit further. This seems to be an issue with the format used by motion. I've check the output of v4l2-ctl ...

$ v4l2-ctl -d /dev/video1 --list-formats-ext
[..]
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'YUYV'
	Name        : YUV 4:2:2 (YUYV)
[..]
		Size: Discrete 1280x720
			Interval: Discrete 0.100s (10.000 fps)
			Interval: Discrete 0.133s (7.500 fps)
			Interval: Discrete 0.200s (5.000 fps)
[..]

	Index       : 1
	Type        : Video Capture
	Pixel Format: 'MJPG' (compressed)
	Name        : MJPEG
[..]
		Size: Discrete 1280x720
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.042s (24.000 fps)
			Interval: Discrete 0.050s (20.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
			Interval: Discrete 0.100s (10.000 fps)
			Interval: Discrete 0.133s (7.500 fps)
			Interval: Discrete 0.200s (5.000 fps)
[..]

... and motion:

$ motion
[..]
[1] [NTC] [VID] v4l2_set_pix_format: Config palette index 17 (YU12) doesn't work.
[1] [NTC] [VID] v4l2_set_pix_format: Supported palettes:
[1] [NTC] [VID] v4l2_set_pix_format: (0) YUYV (YUV 4:2:2 (YUYV))
[1] [NTC] [VID] v4l2_set_pix_format: 0 - YUV 4:2:2 (YUYV) (compressed : 0) (0x56595559)
[1] [NTC] [VID] v4l2_set_pix_format: (1) MJPG (MJPEG)
[1] [NTC] [VID] v4l2_set_pix_format: 1 - MJPEG (compressed : 1) (0x47504a4d)
[1] [NTC] [VID] v4l2_set_pix_format Selected palette YUYV
[1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette YUYV (1280x720)
[1] [NTC] [VID] v4l2_do_set_pix_format: Using palette YUYV (1280x720) bytesperlines 2560 sizeimage 1843200 colorspace 00000008
[..]

Ok, so both formats YUYV and MJPG are supported and recognized and I can choose both via the v4l2palette configuration variable, citing motion.conf:

# v4l2_palette allows to choose preferable palette to be use by motion
# to capture from those supported by your videodevice. (default: 17)
# E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and
# V4L2_PIX_FMT_MJPEG then motion will by default use V4L2_PIX_FMT_MJPEG.
# Setting v4l2_palette to 2 forces motion to use V4L2_PIX_FMT_SBGGR8
# instead.
#
# Values :
# V4L2_PIX_FMT_SN9C10X : 0  'S910'
# V4L2_PIX_FMT_SBGGR16 : 1  'BYR2'
# V4L2_PIX_FMT_SBGGR8  : 2  'BA81'
# V4L2_PIX_FMT_SPCA561 : 3  'S561'
# V4L2_PIX_FMT_SGBRG8  : 4  'GBRG'
# V4L2_PIX_FMT_SGRBG8  : 5  'GRBG'
# V4L2_PIX_FMT_PAC207  : 6  'P207'
# V4L2_PIX_FMT_PJPG    : 7  'PJPG'
# V4L2_PIX_FMT_MJPEG   : 8  'MJPEG'
# V4L2_PIX_FMT_JPEG    : 9  'JPEG'
# V4L2_PIX_FMT_RGB24   : 10 'RGB3'
# V4L2_PIX_FMT_SPCA501 : 11 'S501'
# V4L2_PIX_FMT_SPCA505 : 12 'S505'
# V4L2_PIX_FMT_SPCA508 : 13 'S508'
# V4L2_PIX_FMT_UYVY    : 14 'UYVY'
# V4L2_PIX_FMT_YUYV    : 15 'YUYV'
# V4L2_PIX_FMT_YUV422P : 16 '422P'
# V4L2_PIX_FMT_YUV420  : 17 'YU12'
#
v4l2_palette 17

Now motion uses YUYV as default mode as shown by its output. So it seems that all I have to do is to choose MJPEG in my motion.conf:

v4l2_palette 8

Testing again ...

$ motion
[..]
[1] [NTC] [VID] vid_v4lx_start: Using V4L2
[1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1] [NTC] [VID] v4l2_set_control: setting control "Brightness" to 25 (ret 0 ) 
Corrupt JPEG data: 5 extraneous bytes before marker 0xd6
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
[1] [NTC] [VID] v4l2_set_control: setting control "Brightness" to 14 (ret 0 ) 
Corrupt JPEG data: 1 extraneous bytes before marker 0xd5
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
[1] [NTC] [VID] v4l2_set_control: setting control "Brightness" to 36 (ret 0 ) 
Corrupt JPEG data: 3 extraneous bytes before marker 0xd2
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
[1] [NTC] [VID] v4l2_set_control: setting control "Brightness" to 58 (ret 0 ) 
Corrupt JPEG data: 1 extraneous bytes before marker 0xd7
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
[1] [NTC] [VID] v4l2_set_control: setting control "Brightness" to 80 (ret 0 ) 
Corrupt JPEG data: 4 extraneous bytes before marker 0xd7
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
[1] [ERR] [ALL] motion_init: Error capturing first image
[1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 16 items
Corrupt JPEG data: 4 extraneous bytes before marker 0xd1
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
Corrupt JPEG data: 11 extraneous bytes before marker 0xd1
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
Corrupt JPEG data: 3 extraneous bytes before marker 0xd4
[1] [CRT] [VID] mjpegtoyuv420p: Corrupt image ... continue
Corrupt JPEG data: 7 extraneous bytes before marker 0xd1
[..]

... and another issue is turning up :( The output above goes on and on and on and there is no video capturing. So accordingly to $searchengine the above happens to a lot of people. I just found one often suggested fix: pre-load v4l2convert.so from libv4l-0:

$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l2convert.so motion

But the problem persists and I'm out of ideas :( So atm it lokks like I cannot use the MJPEG format and don't get 30 fps at 1280x720 pixels. During writing I then discovered a solution by good old trial-and-error: Leaving the v4l2_palette variable at its default value 17 (YU12) and pre-loading v4l2convert.so makes use of YU12 and the framerate at least raises to 24 fps:

$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4lg/v4l2convert.so motion
[..]
[1] [NTC] [VID] v4l2_do_set_pix_format: Testing palette YU12 (1280x720)
[1] [NTC] [VID] v4l2_do_set_pix_format: Using palette YU12 (1280x720) bytesperlines 1280 sizeimage 1382400 colorspace 00000008
[..]
[1] [NTC] [EVT] event_new_video FPS 24
[..]

Finally! :) The results are nice. It would maybe even be a good idea to limit the framerate a bit, to e.g. 20. So that is a tested configuration for the Logitech C910 running at a resolution of 1280x720 pixels:

v4l2_palette 17
width 1280
height 720
framerate 20
minimum_frame_time 0
pre_capture 10 # 0,5 seconds pre-recording
post_capture 50 # 2,5 seconds after-recording
auto_brightness on
ffmpeg_variable_bitrate 2 # best quality

Now all this made me curious, which framerate is possible at a resolution of 1920x1080 pixels now and how the results look like. Although I get 24 fps too, the resulting movie suffers of jumps every few frames. So here I got pretty good results with a more conservative setting. By increasing framerate - tested up to 15 fps with good results - pre_capture needed to be decreased accordingly to values between 1..3 to minimize jumps:

v4l2_palette 17
width 1920
height 1080
framerate 12
minimum_frame_time 0
pre_capture 6 # 0,5 seconds pre-recording
post_capture 30 # 2,5 seconds after-recording
auto_brightness on
ffmpeg_variable_bitrate 2 # best quality

Both configurations lead to satisfying results. Of course the latter will easily fill your hardrive :)

TODO

I guess, the results can be optimzed further by playing around with ffmpeg_bps and ffmpeg_variable_bitrate. Maybe then it is possible to record without jumps at higher framerates too(?). I also didn't test the various norm settings (PAL, NTSC, etc.).

Thursday, February 12, 2015

Motion picture capturing: Debian + motion + Logitech C910

Woodpecker near the window

Winter time is a good time for some nature observation. Yesterday I had a woodpecker (picture) in front of my kitchen window. During the recent weeks there were long-tailed tits, a wren and other rarely seen birds. So I thought, it might be a good idea to capture some of these events :) I still own a Logitech C910 USB camera which allows HD video capturing up to 1080p. So I checked the web for some software that would begin video capturing in the case of motion detection and found motion, already available for Debian users. So I gave it a try. I tested all available resolutions of the camera together with the capturing results. I found that the resulting framerate of both the live stream and the captured video is highly depending on the resolution and some few configuration options. Below is a summary of my tests and the results I've achieved so far.

Logitech C910 HD camera

Just a bit of data regarding the camera. AFAIK it allows for fluent video streams up to 720p.

$ dmesg
[..]
usb 7-3: new high-speed USB device number 5 using ehci-pci
usb 7-3: New USB device found, idVendor=046d, idProduct=0821
usb 7-3: New USB device strings: Mfr=0, Product=0, SerialNumber=1
usb 7-3: SerialNumber: 91CF80A0
usb 7-3: current rate 0 is different from the runtime rate 16000
usb 7-3: current rate 0 is different from the runtime rate 32000
uvcvideo: Found UVC 1.00 device  (046d:0821)
input: UVC Camera (046d:0821) as /devices/pci0000:00/0000:00:1a.7/usb7/7-3/7-3:1.2/input/input17

$ lsusb
[..]
Bus 007 Device 005: ID 046d:0821 Logitech, Inc. HD Webcam C910
[..]

$ v4l2-ctl -V -d /dev/video1 
Format Video Capture:
Width/Height  : 1280/720
Pixel Format  : 'YUYV'
Field         : None
Bytes per Line: 2560
Size Image    : 1843200
Colorspace    : SRGB

Also the uvcvideo kernel module is loaded and the user in question is part of the video group.

Installation and start

Installation of the software is as easy as always:

apt-get install motion

It is possible to run the software as a service. But for testing, I copied /etc/motion/motion.conf to ~/.motion/motion.conf, fixed its permissions (you cannot copy the file as user - it's not world readable) and disabled the daemon mode.

daemon off

Note that in my case the correct device is /dev/video1 because the laptop has a built-in camera, that is /dev/video0. Also the target directory should be writeable by my user:

videodevice /dev/video1
target_dir ~/Videos

Then running motion from the command line ...

$ motion
[..]
[0] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started
[..]
[1] [NTC] [ALL] motion_init: Thread 1 started , motion detection Enabled
[0] [NTC] [ALL] main: Thread 1 is device: /dev/video1 input -1
[1] [NTC] [VID] v4l2_get_capability: 
------------------------
cap.driver: "uvcvideo"
cap.card: "UVC Camera (046d:0821)"
cap.bus_info: "usb-0000:00:1a.7-1"
cap.capabilities=0x84000001
------------------------
[1] [NTC] [VID] v4l2_get_capability: - VIDEO_CAPTURE
[1] [NTC] [VID] v4l2_get_capability: - STREAMING
[1] [NTC] [VID] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1] [NTC] [VID] v4l2_select_input: - CAMERA
[..]
[1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items

... will begin to capture motion detection events and also output a live stream. CTRL+C will stop it again.

Live stream

The live stream is available by pointing the browser to localhost:8081. However, the stream seems to run at 1 fps (frames per second) and indeed does. The stream gets more quality by this configuration:

stream_motion on
stream_maxrate 100

The first option is responsible, that the stream only runs at one fps if there is no motion detection event. Otherwise the framerate increases to its maximum value, which is either the one given by stream_maxrate or the camera limit. The quality of the stream picture can be increased a bit further too by increasing the stream_quality value. Because I neither need the stream nor the control feed I disabled both:

stream_port 0
webcontrol_port 0

Picture capturing

By default there is video and picture capturing if a motion event is detected. I'm not interested in these pictures, so I turned them off:

output_pictures off

FYI: If you want a good picture quality, then the value of quality should very probably be increased.

Video capturing

This is the really interesting part :) Of course if I will "shoot" some birds (with the camera), then a small image of say 320x240 pixels is not enough. The camera allows for a capture resolution up to 1920x1080 pixels (1080p). It is advertised for fluent video streams up to 720p (1280x720 pixels). So I tried the following resolutions: 320x240, 640x480, 800x600, 640x360 (360p), 1280x720 (720p) and 1920x1080 (1080p). These are easily configured by the width and height variables. For example the following configures motion for 1280x720 pixels (720p):

width 1280
height 720

The result was really disappointing. No event is captured with more then 20 fps. At higher resolutions the framerate drops even further and at the highest resolution of 1920x1080 pixels, the framerate is only two(!) fps. Also every created video runs much too fast and even faster by increasing the framerate variable. Of course its default value of 2 (fps) is not enough for fluent videos. AFAIK the C910 can run with 30 fps at 1280x720 pixels. So increasing the value of framerate, the maximum framerate recorded, is a must-do. (If you wanna test yourself, check the log output for the value following event_new_video FPS.)

The solution to the issue, that videos are running too fast, however is to increase the pre_capture value, the number of pre-captured (buffered) pictures from before motion was detected. Even small values like 3..5 result in a distinctive improvement of the situation. Though increasing the value further didn't have any effect. So the values below should almost get the most out of the camera and result in videos in normal speed.

framerate 100
pre_capture 5

Videos in 1280x720 pixels are still captured with 10 fps and I don't know why. Running guvcview, the same camera allows for 30 fps in this resolution (even 60 fps in lower resolutions). However, even if the framerate could be higher, the resulting video runs fluently. Still the quality is just moderate (or to be honest, still disappointing). It looks "pixelated". Only static pictures are sharp. It took me a while to fix this too, because I first thought, the reason is the camera or missing hardware support. It is not :) The reason is, that ffmpeg is configured to produce a moderate(?)-quality video. The relevant variables are ffmpeg_bps and ffmpeg_variable_bitrate. I got the best results just changing the latter:

ffmpeg_variable_bitrate 2

Finally the resulting video quality is promising. I'll start with this configuration setting up an observation camera for the bird feeding ground.

There is one more tweak for me. I got even better results by enabling the auto_brightness feature.

auto_brightness on

Complete configuration

So the complete configuration looks like this (only those options changed to the original config file)

daemon off
videodevice /dev/video1
width 1280
height 720
framerate 100
auto_brightness on
ffmpeg_variable_bitrate 2
target_dir /home/user/Videos
stream_port 0 #8081
stream_motion on
stream_maxrate 100
webcontrol_port 0 #8080

Links

Continue with part II ...

Setting up a network buildd with pbuilder ... continued

Last year I'd described my setup of a local network-buildd using pbuilder, ccache, inoticoming and NFS. One then-still-open goal was to support different Debian releases. This is especially necessary for backports of e.g. bluefish. The rules to contribute backports require to include all changelog entries since the last version on debian-backports or since stable if it's the first version in an uploaded package. Therefor one needs to know the last version in e.g. wheezy-backports. Because I'm not typing the command (the source package only gets uploaded and inoticoming starts the build process) I was looking for a way to automatically retrieve that version and add the relevant -vX.Y-Z switch to dpkg-buildpackage.

The solution I found requires aptitude and a sources.list entry for the relevant release. If you are only interested in the solution, just jump to the end :)

I'm going to add the version switch to the DEBBUILDOPTS variable of pbuilder. In my setup I have a common (shared) snippet called /etc/pbuilderrc.inc and one configuration file per release and architecture, say /etc/pbuilderrc.amd64.stable. Now the first already contains ...

DEBBUILDOPTS="-us -uc -j2"

... and DEBBUILDOPTS can be extended in the latter:

DEBBUILDOPTS+="..."

Because the config file is parsed pretty early in the process the package name has not yet been assigned to any variable. The last argument to pbuilder is the .dsc file. So I use the last argument and parse the file to retrieve the source package name.

cat ${@: -1} | grep -e ^Source | awk -F\  '{ print $2 }'

The solution above works, because pbuilder is a BASH script. Otherwise it maybe needs some tweaking. I use the source package name, because it is unique and there is just one :) Now with this name I check for all versions in wheezy* and stable* and sort them. The sort order of aptitude is from low to high, so the last line shopuld contain the highest version. This covers the possibility that there has not yet been a backport or that there is one:

aptitude versions -F '%p' --show-package-names=never --group-by=none --sort=version \
   "?narrow(?source-package(^PACKAGE\$), ?or(?archive(^wheezy.*), ?archive(^stable.*)))" |\
   tail -n 1 | sed -e 's#~bpo.*$##g'

The sed-part is necessary because otherwise dh_genchanges will add a superfluous changelog entry (the last one of the last upload). To make things easier, I assign the name and version to variables. So this is the complete solution:

[..]
MYPACKAGE="`cat ${@: -1} | grep -e ^Source | awk -F\  '{ print $2 }'`"
MYBPOVERS="`aptitude versions -F '%p' --show-package-names=never --group-by=none --sort=version "?narrow(?source-package(^$MYPACKAGE\$), ?or(?archive(^wheezy.*), ?archive(^stable.*)))" | tail -n 1 | sed -e 's#~bpo.*$##g'`"

log "I: Package is $MYPACKAGE and last stable/bpo version is $MYBPOVERS"

DEBBUILDOPTS+=" -v$MYBPOVERS"
[..]

Examples

I've recently built a new bluefish backport. The last backport version is 2.2.6-1~bpo70+1. There is also the stable version 2.2.3-4. So the version I need is 2.2.6-1 (2.2.6-1~bpo70+1 < 2.2.6-1!!). Checking the log it works:

I: Package is bluefish and last stable/bpo version is 2.2.6-1

A different example is rsync. I've recently locally rebuilt it for a stable system (wanted to make use of the --chown switch). There is not yet a backport. So the version I (would) need is 3.0.9-4. Checking the logs again and works too:

I: Package is rsync and last stable/bpo version is 3.0.9-4

Feedback appreciated ...

Links

Wednesday, February 11, 2015

Blogger RSS feed and category URLs with combined labels/tags

Run a blog on blogger.com? Maybe made it bilingual? Maybe blog on different topics? Wondering how the URL for an RSS feed for e.g. two labels looks like? Asking how to see all articles matching two tags (labels)? Finding a keyword under one or more labels? Many things are possible. I'll show a few examples below. Maybe that is even interesting for the planet Debian folks. I happen to blog mostly in English about Debian topics. But sometimes I also want to post something in German only (e.g. about German tax software). It is discouraged to put the latter on planet-debian. Instead it can be published in the language specific planet feed. So instead of adding new tags, one could easily combine two labels: the one for language of the feed and the one for Debian related posts (e.g. debian+english or debian+german). Therefor this post goes to the Debian planet.

Search for combbined labels/tags

Say I want to view all postings related to the topics FOO and BAR. Then it is:

http://domain.tld/search/label/FOO+BAR OR
http://domain.tld/search/?q=label:FOO+label:BAR

Be aware that labels are case sensitive and that more labels can be added. The examples below will show all postings related to the topics debian and n54l and xbmc:

http://www.wgdd.de/search/label/debian+n54l+xbmc
http://www.wgdd.de/search/?q=label:debian+label:n54l+label:xbmc

It is also possible to search for all posts related to the topics FOO or BAR:

http://domain.tld/search/?q=label:FOO|label:BAR

Say for example, you want to see all postings related to the topics logitech or toshiba, then it is:

http://www.wgdd.de/search/?q=label:logitech|label:toshiba

Feed URLs

To get back to the first example lets say, the feed shall contain all posts related to the topics FOO and BAR. Then it is:

http://domain.tld/feeds/posts/default/-/FOO/BAR/ OR
http://domain.tld/feeds/posts/default?q=label:FOO+label:BAR

Respecitvely to show all feeds related to either of those topics use:

http://domain.tld/feeds/posts/default/?q=label:FOO|label:BAR

To get a feed of the example topics as shown above then would be:

http://www.wgdd.de/feeds/posts/default/-/debian/n54l/xbmc/
http://www.wgdd.de/feeds/posts/default?q=label:debian+label:n54l+label:xbmc
http://www.wgdd.de/feeds/posts/default?q=label:logitech|label:toshiba

Coming back to planet Debian, below is a solution for a multi-lingual planet contribution (if both planets would exist):

http://www.wgdd.de/feeds/posts/default?q=label:planet-debian+label:english
http://www.wgdd.de/feeds/posts/default?q=label:planet-debian+label:german

Advanced ...

There is much more possible. I'll just show two more examples. AND and OR can be combined ...

http://www.wgdd.de/feeds/posts/default?q=label:debian+(label:logitech|label:toshiba)

... and a keyword search can be added too:

http://www.wgdd.de/feeds/posts/default?q=stick+(label:debian+(label:logitech|label:toshiba))

Links

Sunday, February 8, 2015

Correct keyboard layout (QWERTZ) with Logitech K400 attached to an Android HDMI stick

I've bought an HDMI stick with Android 4.4.2 to connect a TV to the local network (stream, DLNA) and the internet (Video portals etc.). The stick comes with no input device whatsoever. So I decided for a wireless Logitech K400r keyboard. Unfortunately the keyboard layout used by Android seems to be American (QWERTY) although the language and location settings are set to German. So I neither get Umlauts nor special signs correct nor do the media keys of the K400 work. But there is an easy way to make all this work. I've recently seen some people suggesting to install an app called External Keyboard Helper to fix things, which comes in a demo and a pro version, the latter with costs. Fortunately I didn't need any of these for the Logitech keyboard plus I got all media keys of this keyboard to work in just three steps without any cost :)

Step 1

First I went to the Google Play Store and installed the Logitech Keyboard Plus app by Logitech Europe S.A. (See? No external stuff and without costs. Ignore anything that's written in its description about Bluetooth.)

App Logitech Keyboard Plus shown at Google Play Store

Step 2

Then I opened the settings section and went for Settings > Language and Input (Einstellungen > Sprache und Eingabe). Under KEYBOARD & INPUT METHOD (TASTATUR & EINGABEMETHODEN) I activated the entry called Logitech keyboard (Logitech Tastatur) as shown below.

Activate the entry &quote;Logitech keyboard&quote; under Settings > Language and Input

Step 3

Now a click on the field above that is called Default (Standard) and (here) defaults to Deutsch - Android-Tastatur (AOSP) ...

Click on the field &quote;Default&quote;

... opened a popup called Choose input method and there I've chosen Logitech keyboard (Logitech Tastatur) as shown below and confirmed it.

Activate the Logitech keyboard on the popup called &quote;Choose input method&quote;

The default now is the Logitech keyboard:

The default keyboard now is the Logitech keyboard

Finally ...

... it's done. The keyboard now behaves as expected and also the media/function keys do work. It is however not possible to adjust or configure anything, because this presumes a confirmed Bluetooth pairing between the keyboard and the android device and the K400 is not a Bluetooth device. It would probably be a good idea for Logitech to make this app usable for all available Logitech keyboards, even USB and Unifying(TM) ones. Update: As of now it is possible to cancel the Bluetooth pairing attempt without leaving the application. So this app in fact can be used for USB and Unifying(TM)-based Logitech keyboards.