2018-05-29

Switching from IrfanView to ImageMagick

After having spent a couple of hours to write and test several hundred lines of Perl code to block access from certain countries, because of GDPR, i finally can sleep again, since i have done enough to keep the wildlife out. These people don't understand technology, by choice, to maintain the status quo. Because it can empower everyone, what these politicians don't want. It feels like they have only nightmares and a "Ponzi scheme" slowly falling apart, and no real ideas. This will not end well with these kind of priorities: Procrastination makes the hard things even more difficult to solve. Europe has too much overhead, and they like the lag. Especially these Germans with their ancient cars.
This is why i wrote some rules, combined with a GeoLite2 IP geolocation database by MaxMind, to protect the last survivor of my purge after the burn out: My 10 years old embeddable "chat widget" with an integrated automated management system, without any need for moderators or admins since 2008. Everything based on Perl, made from scratch by myself, and the best part: Not much "personal data" required, since there is no sign up process. I also stopped Apache logging IP addresses. But since i'm not making any money with it, i'm not going to waste time explaining. It's just something i like to keep alive on the internet as prestige. Unlike these animals, i know how to get things done. And i have never run a web project for that long before.
While getting myself into more PowerShell, i found ImageMagick again, which i discovered around 15 years ago. But without a lot of experience with command-line interfaces, i did not much with it, back then. After having now worked with computers for twenty years, i see all these things as Lego bricks. In this year alone, for my time-lapse photography with a Raspberry Pi, i processed over 60k JPEG files with IrfanView and a Windows batch script. But now, i wrote the job in PowerShell, and switched to ImageMagick. The image quality is better, which gives FFmpeg more bits to work with, for additional details in the highlights and shadows. The performance is otherwise similar for batch editing around 8k photos each week.
2018-05-22

Watchdog for the Raspberry Pi Camera

My second Raspberry Pi is now running since more than 63 days without a break, also known as 24/7. It takes a photo at the window every minute, except when it has to do some other jobs, or goes down unexpectedly. But thanks to the built-in hardware "watchdog", the Pi Zero W goes up again automatically. On two occasions, raspistill and the "Camera Module v2" stopped working for no reason, but everything else was still just fine. This is why i created my own software watchdog exclusively for checking the function of the attached camera:
I wrote a Unix shell script looking for the latest photo every thirty minutes. And if the JPEG file is older than 240 seconds, the Pi Zero W will reboot to start fresh. I have scheduled this task in the crontab of the root user, as required by "shutdown -r now". Because of this, i did not need to touch the Raspberry Pi physically since at least one month. But i keep an eye on it through logs created by involved processes as part of my monitoring system. This way i identify and resolve issues when they occur without downtime.
2018-05-19

Watching my second Royal Wedding

In April 2011, i experienced my first Royal Wedding live in front of the Buckingham Palace. I went to London for seven days to cover the week around the wedding of Prince William and Catherine. I shot thousands of photos and had a lot of fun while doing it. Back then, i stayed at the St Giles Hotel, because this was before i discovered places like the Imperial College for booking an accommodation in the capital.
Seven years later, in May 2018, i got to watch the wedding of Prince Harry and Meghan via live stream on YouTube, without any comments, just raw from the official source. As you know, i'm quite into the United Kingdom, and because of this, i prepared my Tablet PC streaming the whole event for my parents too. Although there was no kiss on the balcony this time, the two hours were worth it.
After watching it in person from the outside, live with the British people, many years ago, and now, from every possible viewing point through all the camera lenses, i like to say that i'm happy being on planet Earth at this moment in time. There is nothing like this coming any time soon again. Well done, England.
2018-05-11

Time-lapse photography with Raspberry Pi

After some more tweaking, i got a reliable workflow for time-lapse photography with a headless Raspberry Pi Zero W and a Camera Module v2, while it does other things as well: It takes every minute one photo with quality set at 7, and everything else set to automatic, which is suitable for daylight. From 11 pm to 5 am it goes into manual mode with shutter speed at 2 seconds, ISO at 800, and quality set at 9, which helps in low-light. The Sony IMX219 sensor is performing great. The Pi Zero W pauses once each hour for two minutes to get external updates. Once in a while, it is going to freeze, because of some heavy multitasking in an environment with limited resources, but it will recover by itself automatically, thanks to the integrated watchdog.
Every day at midnight it takes a break for 15 minutes to create a large zip file of all JPEG images from the past day. After seven days, i download all archives via SFTP and FileZilla, unzip all files with 7Zip, run them through IrfanView to crop the part i want at 3278x1844, and let FFmpeg make a 1080p 30fps H.264 video with all the edited photos at a CRF of 18. Most steps are automated in Windows batch script. I have been running this particular time-lapse photography for seven weeks, and the nicest thing is to see the motion of the stars at night. Years ago, this could not have been done at this price. Cheers to Eben Upton for the affordable hardware. And thank you to Tim Kosse, Igor Pavlov, Irfan Skiljan, and Michael Niedermayer for the free software.
2018-05-09

Getting into PowerShell

Back then, two decades ago, in 1998, i used Microsoft FrontPage Express to build my first websites, and i uploaded them to web host FortuneCity, which was an alternative to Yahoo GeoCities, and Lycos Tripod. But eventually, i had to change a part of the source code, and i got myself into some more coding with Microsoft Notepad. I have used it now for almost twenty years exclusively for HTML, JavaScript, CSS, Windows batch files, and Perl scripts, till i switched to Notepad++ by Don Ho in January 2018. Things are so much easier with it, because the code is highlighted in different colors.
Previously, i thought, all these colors are distracting, but now, with my age, i recognize how helpful this is for navigating through the lines. These days, i mostly write Perl code, Windows batch files, and some Unix shell script. In mid 2017, i got myself into PowerShell for the first time, because i transcoded thousands of my origami crane videos to a more manageable size, and i wanted to preserve metadata, especially the "Last Modified Date". This could not have been done with a traditional batch file only.
Now, in May 2018, i wrote a set of PowerShell files to check the integrity of my backups. Before, for way over five years, i used FileVerifier++ by Tom Bramer to calculate the MD5 hashes. But since i wanted to get to know the successor of "Windows batch scripting" a bit more, i pushed myself to create this tool. It consists of 5 files from scratch, without any external dependencies: Setting, Indexing, Hashing, Verify, and Filter. They explain themselves by their filename, and the whole experience was quite satisfying.
2018-05-07

How to stop Raspberry Pi crashing

I have a Pi Zero W running 24/7 since several weeks. I already listed all the tasks it has to do in an older post. The only time when it was not crashing was the week i folded my latest 707 origami cranes in Barcelona. Having my browser regularly connecting to the Pi Zero W seems to be enough to break it, if everything tries to flow through the bottleneck at the same time: FreshRSS is checking for updates at over 200 blogs within ten minutes, while raspistill is making a photo every minute, and Chrome is refreshing the stream of the feed reader via web interface and Apache server.
This is a possibility, because i tuned it that way, to keep the gap where the "time-lapse photography" is paused small. Otherwise the resulting video will not look right. The moon would jump from one position to another with frames missing. The crashing or freezing was not that frequent before, since i reserved enough time for every job. Handling that many RSS sources is quite the workload for this tiny computer, which basically means living on the edge. But the internal "watchdog" of the Broadcom BCM2835 does a great job in rebooting the Pi Zero W, if the heart stops beating.
A solution would be to reserve more time for every job and to reduce multitasking, which is the right way anyway, because it has only a single-core CPU. I also checked the power with a USB multimeter. And since i didn't wrote the RSS aggregator myself, this could be a place to do some digging too. After all, the Zero W is not that demanding and just not as strong as a full-size Raspberry Pi with four cores and twice as much RAM. But compared to my first computer in 1998 by IBM with Pentium II 300 MHz and 32 MB RAM, it's plenty for ordinary tasks.
2018-04-21

In der Arche ist der Wurm drin

At the beginning of this year, we threw away many boxes full of VHS cassettes, with films and series we recorded via cable TV, mostly over two decades old. I was reminded of fun movies like "Men in Black" with Tommy Lee Jones and Will Smith from 1997. But my mom pointed out "In der Arche ist der Wurm drin", a German cartoon by Wolfgang Urchs from 1988 i almost forgot, but still had somewhere in a corner of my memories. Now, weeks later, it was bothering me, not being able to remember the storyline. I had to search for it, without even to know the exact title, since it was only handwritten in Chinese on the label of the VHS.
But i found a copy on YouTube. Sadly, in a really bad quality. Still, better than nothing. Back then, i watched it as a child a couple of times, which introduced me to the story of "Noah's Ark" for the first time. Watching it after all these years, i realized how some things don't age well, but make you appreciate them anyway, because they influenced me somehow at sometime. The cartoon tried to communicate some "christian values" by spinning it to something more entertaining, which was not clear to me as a kid. In some way, this reminds me now of Johnny Five, and to download the movies "Short Circuit" (1986) and "Short Circuit 2" (1988) from my childhood, next time, when i get the chance.
2018-04-01

How i keep my Raspberry Pi busy

Since July 2017, i have my first one running motionEyeOS as a CCTV camera on a regular basis. Two weeks ago, i even built a custom UPS for it, also known as Uninterruptible Power Supply, to make it somewhat independent from a power source. The "off-the-shelf" parts for this project were a 5V relay module with "low level trigger", charging module with "battery protection", boost converter, and 3300uF 6.3V capacitor, which results in a much cheaper solution than a Adafruit Powerboost 1000C.
My second and last Raspberry Pi Zero W runs since January of this year, but permanently and with a wider range of tasks. I already got it to break down several times, by giving it more load than it can handle, which is not that difficult, since it has only a single-core CPU at 1 GHz and 512 MB RAM. But finally, i got it under control by giving every job only a certain time span to do its thing, just like shift work. And the built-in hardware "watchdog" tries to keep it all going by checking the heartbeat of the software.
For example, it takes with "raspistill" and the camera module one photo every 60 seconds, and it pauses twice each hour for ten minutes, as instructed in my shell script. Because the task is not mission critical, since it's just looking out the window and collecting images of a castle nearby. The given silent period is the chance for FreshRSS to check feeds for updates every half an hour. My Perl script tries to get new content for my parents from the BBC server every 30 minutes too. Occasionally, i also use it to develop and test new things, which can tear it down completely, or even corrupt the microSD card, if i forget to put all the code i have running to sleep.
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18