Bear Park (Bärenpark) Bern has set up a Webcam in one of the winter dens of one of their bears, Björk.

This web cam was just a static image that changes every half minute or so. When I discovered this sometimes in January I started saving that image every 30 seconds and have been doing that for 2 months now. I have over 182'000 snapshots of that camera (over 5.4 GB). I compiled them into this video. Using sunrise-sunset.org I figured at which times it is dark, so I removed all these photos.

Their hibernation period has now ended and they're outside more often.

Bear sleeping in the sun

This is the script I used to compile the video:

#!/bin/bash
set -e
cd ~/drive/bear-webcam
i=0
rm -f output/input.txt
mkdir -p output/
dates=`find -name 'baerenpark*' -type f -printf "%TY-%Tm-%Td\n" | sort | uniq`
for day in $dates;do
    out="bear-$day.mp4"
    echo "seeing if $out needs updating"
    sun=`curl -s "https://api.sunrise-sunset.org/json?lat=46.948&lng=7.459&formatted=0&date=$day"`
    sunrise=`echo "$sun"|jq -r .results.civil_twilight_begin`
    sunset=`echo "$sun"|jq -r .results.civil_twilight_end`
    files=`find -name 'baerenpark*' -type f -newermt "$sunrise" ! -newermt "$sunset"|sort -V`
    if [ -e "output/$out" ];then
        for f in $files;do
            if [ "$f" -nt "output/$out" ];then
                rm "output/$out"
                break
            fi
        done
    fi
    if [ ! -e "output/$out" ];then
        cat $files | ffmpeg -f image2pipe -vcodec mjpeg -i - -c:v libx264 -r 30 -pix_fmt yuv420p output/$out
    fi
    echo "file '$out'" >> output/input.txt
done
rm -f output/bear.mp4
ffmpeg -f concat -i output/input.txt -c copy output/bear.mp4