# 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", "oldurls": ["photography/2019/3/23/hibernating-bear/"], "tags": ["Photography", "Video", "Bears", "Technology"], "title": "Time lapse of a hibernating bear" } +++ [Bear Park (Bärenpark) Bern](https://tierpark-bern.ch) has set up a [Webcam](https://tierpark-bern.ch/index-de.php?frameset=222) in one of the winter dens of one of their bears, [Björk](https://tierpark-bern.ch/index-de.php?frameset=261). 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](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)](media/images/big/bärenpark-bär) 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/jMQY6R5QFAmYUIqYACgkQ64/jMQY6 R5Tu+Q/+Kzb/rfiWl5hBtWaI9EPxuA6hkUUgYx0CeNSnknOxP14Kw8cAm5egeYab qnJ1++e7PUJOBVEmeKz8cYFzo2zcco3dhm3qKlXt46JCNwN9oUuKZsAmFfP5GOqT 6wP/UxFZAEwXqh4PwUpg3bG3DudE1mVjV8EWj4VUtdWCcDHapNgMp0BYvHcPo4Ry /TEaG4IgN6NNk2MhxTQ6bXSmZrgbvEp0yS2JgIQUiOrooycF/6czJKZAiDFuSpGx coeR9E5k/GH/06yDiIKpsO4GSoOeq0NvfQSVsPrkWuyiqTVmLxX4uBnG3iEfHI1h rN89d1Ey5qaO4C974bXC0cPNImf8OrRC0Cg+N1OjaymqyRyJtTLGKoF4w83vmEq3 pB3n9bDEUkDVlEK5cTThgVfPAK41dGuh4yC5ufBgQYGgtiNLqLSr8cD7BetS14vB 3faP0AiA8W99FOX2XTg3FCg66/Lz9RzvQdVlUdmDuYRwj2Cvu1BYkXwU6sntIKFd PLZOg6VWMtbeAHVOfJc3nBHoGbGk9PTJJ7Fi5PqprjF3obWaRCFVdKXJeg1kYZ6O ktzVhNcf/SnaRG75luDV/8L5tW8FGCGR76a9wOYQHUpUWlOBJUgSq6clliByubDG IVhlqAHjah5/KODKyfRIV9haRkN1H9QlvXfHUligIV1FQHt1LOk= =Oz3g -----END PGP SIGNATURE-----