# Owner: glow # KeyID: E65A8520F36AEE13CFE4F56BEB8FE331063A4794 # Key: https://glow.li/pgp # Verify: curl "https://glow.li/posts/hibernating-bear/index.html.asc" | gpg -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 - --- date=2019-03-23 12:00:00 layout=post title="Time lapse of a hibernating bear" tags[]=Photography tags[]=Video tags[]=Bears tags[]=Technology oldurls[]=photography/2019/3/23/hibernating-bear/ - --- [Bear Park (Bärenpark) Bern](https://www.tierpark-bern.ch) has set up a [Webcam](https://www.tierpark-bern.ch/index-de.php?frameset=222) in one of the winter dens of one of their bears, [Björk](https://www.tierpark-bern.ch/index-de.php?frameset=261). This web cam is just a [static image](https://www.tierpark-bern.ch/images/baerenpark3_latest.webp) 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](https://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](/media/images/bärenpark-bär.webp)](/media/images/big/bärenpark-bär.webp) 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 ``` -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE5lqFIPNq7hPP5PVr64/jMQY6R5QFAmIWHbsACgkQ64/jMQY6 R5QbRA/+IHI5SzVH9EI4KzV7VGAe8f+g9Aby6bn+fsFKCDQtoHYSkuPtUVjBeCpn Z4w9IlXsY7K5iy//SuVg7o/AxcfurFcJf4q3GeKBLs1KtSC4VZ4tM9+RFsJQwttT fRJqt0glCGXq+qktikCvKlDNCSvWFHBkFhNNSU8cHPeTxMOtMLmvw7Jq47VlOS8i TKoqQSk9GPGHJibeeEYtCwooxDXFSQHTF/M107zi89tljz+Im5S40szevAWqXZBR En83kkOXpnK5a5xOP3Nc3JOwfkMZ/DvTshCVjQa4iWg1kjtaCFZxrkS1PIO8IonC q9Gohvo2iut6NJSMME7NcPSZl89pbt4nnelSoA3T0NPvkdGysghcJ/ZbltAqenUH 0l9XmcXJX3tIXS6VtNS3xVNB2gLCWzQH0EMfH/vnPbaxPu2pE+wCuxQGrgH/5Z/v G9SwKp6pgvQZNHWdCxiFvCssdJ99Jm3lBfmUoMV1CZ/9XMGgoDqcCKR9aGinG9L0 tETNSPDVzA7oPimGav+dAEcfj458HA+sP9MoDUtIZpKMoywPuHXIN1P8MK4LJ9WL Tl/dlTOpFgUAw0/TqrqHZu5V0Q8udUboIu6S7uljOLxJ6wHdB2rGo7YjdhHqHGVt QovA7KAbsIs1juhAnqbrwrpqoMNU0xttMeTfeO7V75sLd3M/qBQ= =Vamf -----END PGP SIGNATURE-----