2020-01-24

Create a custom fps timelapse from photos with ffmpeg

The simple version:
ffmpeg -framerate 60 -pattern_type glob -i "*.jpg" -s 1920x1080 out.mp4

The complicated version:
FPS=60 ; DURATION=$(echo 1/${FPS} | bc -l| sed 's/^\./0./') ; ffmpeg -f concat -safe 0 -i <(find /mnt/c/tmp/102MSDCF -name '*.JPG' -printf "file '%p'\nduration $DURATION\n") -c:v libx264 -preset slow -crf 18 -tune film -s 1920x1080 -vf setpts=PTS-STARTPTS -vsync 0 -r $FPS Desktop/test4.mp4

2017-07-22

2016-11-01

Sricam SP009 in VLC

Best quality stream
rtsp://[Sricam_IP]:554/onvif1

There is also a 320x180 low resolution stream available (might be enough for motion detection
rtsp://[Sricam_IP]:554/onvif2

Disable night IR mode on Sricam SP009


I recently bought a Sricam on Amazon just to see what you can have nowadays for £30. After all, not so long ago the only (in)decent thing you could have for 8 times the price was the D-Link DCS-950G. Ewww what a disgusting piece of hardware... and software. Glad those days are over !


I set it up to look outside on my front yard. When the night comes, the camera switch in infrared mode and the 8 IR-LED will blast light as far as a couple of meters. The picture is then black and white. Honestly it works pretty well.

The problem is that the camera is behind a window and most of that IR light is reflected by the glass right in front of the sensor, making it completely blind. I've tried to put tape on the outer circle of the camera where the LED are located but then the light sensor used to detect night mode will be covered as well, telling the camera to switch to infrared mode anyway. the picture will then go black and white even if sun is shining

So I decided to open it and do something. I didn't really had a plan in mind, ripping off the IR LED could have been a good solution.

Removing the 4 screws reveals a nice PCB with the main SoC, as well as some power regulator components, the SD card slot and the green wifi chip. The two big wires are connected to a "speaker"

An additional screw maintains the outer circle and it's 10 diodes.

I'm wondering if Sricam engineers just copied dropcam design or geniunely designed this, but anyway the result looks legit.

Luckily I found out a photodiode used as a light sensor, surrounded by a 8 IR and one red status LED. Covering the sensor opens the circuit and putting it in front of a bright light closes it.


By following the path on the board, we can see that pin 3 and 4 are connected to that diode.

So I've cut part of a leg of a resistor (5mm long) and shaped into a U-shape.

Put it on the connector itself between pin 3 and 4 et voilĂ :

I'm very happy with my camera now and even at night I get a clear color picture, thanks to the street lights !

2016-04-17

Redirect all your subdomains to a single https domain with nginx

On my playground server, I run a bunch of services in docker containers.
Most of them uses HTTP but don't natively support HTTPS so I'm using nginx as a front web server / reverse proxy to secure the connection.

I like to access my services using the following notation:

  • service1.example.com
  • service2.example.com

In fact, they all point to the same host and I'm using the DNS A records @ and *

The thing is, if I want to enable HTTPS for all these subdomains, I need as many legit SSL certificates. Another option is to buy a wildcard certificate but it's rather expensive ... for a playground server.

So I wrote this handy nginx config which permanently redirect HTTP requests to one unique HTTPS host:

  • http://service1.example.com => https://example.com/service1/
  • http://service2.example.com/path => https://example.com/service2/path

It also supports

  • http://example.com => https://example.com//


Ideally I'd get rid of the double trailing slash, but it'll work for now. Let me know if you have suggestions, this could certainly be enhanced


server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    # Match domain.tld or prefix.domain.tld
    server_name ~^(?<domain>[a-z0-9]*\.[a-z0-9]*)$ ~^(?<prefix>[a-z0-9]*)\.(?<domain>[a-z0-9]*\..*)$;

    error_log stderr;

    location / {
        rewrite ^ https://$domain/$prefix$uri permanent;
    }
}

2015-04-03

How to migrate a Windows Server from AWS EC2 or Xen to KVM

Download KVM Fedora driver
Replace the Citrix SCSI driver by Fedora one

Add the following legacy devices :
VirIO Baloon
NetKVM

If on Xen, export the volume like this :

[root@xen ~]# xe vdi-list  name-label=windows
uuid ( RO)                : 0db82c11-6ea3-4e7a-bcf5-a75470968200
          name-label ( RW): omnitrack
    name-description ( RW): Created by XenCenter Disk Image Import
             sr-uuid ( RO): e5772b34-5ad1-6ac9-f91d-575dbec3aea6
        virtual-size ( RO): 32212254720
            sharable ( RO): false
           read-only ( RO): false


[root@xenr13sm6d ~]# xe vdi-export uuid=0db82c11-6ea3-4e7a-bcf5-a75470968200 filename=/var/run/sr-mount/6ad66e9d-f3dd-845e-e783-5077cb157a13/widnows.raw format=raw progress=true
[|] ######################################################> (100% ETA 00:00:00)
Total time: 00:07:11

Popular posts