brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
922 stars 141 forks source link

Persistent Snapshots #68

Closed juanjito88 closed 2 years ago

juanjito88 commented 4 years ago

Hello, thank you very much for your work and congratulations for making everything easier. Persistent Snapshots don't work for me in Apple's home app, is it normal? Do you have to configure something else to work? or do they only work in the home + app? Thanks a lot

RefineryX commented 4 years ago

It should work. Are you receiving any error on the log files?

  1. Within a SSH terminal type tail -f /var/log/hkcam/current
  2. Open you Home app but do not click anything
  3. Check you logs and report back any errors.
azagramac commented 2 years ago

They don't work for me either, it doesn't generate any .jpg file in the "Camera" directory, the default one, if it generates it somewhere else... I don't know it.

How to enable it, with the hkcam command, it gives you a list of parameters, but it doesn't appear in the screenshots.

$ hkcam --help
Usage of hkcam:
  -data_dir string
        Path to data directory (default "Camera")
  -h264_decoder string
        h264 video decoder
  -h264_encoder string
        h264 video encoder (default "h264_omx")
  -input_device string
        video input device (default "v4l2")
  -input_filename string
        video input device filename (default "/dev/video0")
  -loopback_filename string
        video loopback device filename (default "/dev/video1")
  -min_video_bitrate int
        minimum video bit rate in kbps
  -multi_stream
        Allow mutliple clients to view the stream simultaneously
  -pin string
        PIN for HomeKit pairing (default "00102003")
  -port string
        Port on which transport is reachable
  -verbose
        Verbose logging (default true)

log:

2021-11-25_16:55:41.78189 DEBUG 2021/11/25 17:55:41 resource.go:43: 172.16.1.20:65419 POST /resource
2021-11-25_16:55:41.78717 DEBUG 2021/11/25 17:55:41 loopback.go:49: Starting loopback
2021-11-25_16:55:41.79155 DEBUG 2021/11/25 17:55:41 loopback.go:114: /bin/ffmpeg -f v4l2 -i /dev/video0 -codec:v copy -f v4l2 /dev/video1
2021-11-25_16:55:43.48330 DEBUG 2021/11/25 17:55:43 loopback.go:72: ffmpeg version 4.1.8-0+deb10u1+rpt1 Copyright (c) 2000-2021 the FFmpeg developers
2021-11-25_16:55:43.48504 DEBUG 2021/11/25 17:55:43 loopback.go:72:   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
2021-11-25_16:55:43.48803 DEBUG 2021/11/25 17:55:43 loopback.go:72:   configuration: --prefix=/usr --extra-version=0+deb10u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
2021-11-25_16:55:43.49644 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavutil      56. 22.100 / 56. 22.100
2021-11-25_16:55:43.49825 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavcodec     58. 35.100 / 58. 35.100
2021-11-25_16:55:43.50064 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavformat    58. 20.100 / 58. 20.100
2021-11-25_16:55:43.50330 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavdevice    58.  5.100 / 58.  5.100
2021-11-25_16:55:43.50637 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavfilter     7. 40.101 /  7. 40.101
2021-11-25_16:55:43.50937 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libavresample   4.  0.  0 /  4.  0.  0
2021-11-25_16:55:43.51187 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libswscale      5.  3.100 /  5.  3.100
2021-11-25_16:55:43.51426 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libswresample   3.  3.100 /  3.  3.100
2021-11-25_16:55:43.51682 DEBUG 2021/11/25 17:55:43 loopback.go:72:   libpostproc    55.  3.100 / 55.  3.100
2021-11-25_16:55:44.04793 DEBUG 2021/11/25 17:55:44 loopback.go:72: Input #0, video4linux2,v4l2, from '/dev/video0':
2021-11-25_16:55:44.06663 DEBUG 2021/11/25 17:55:44 loopback.go:72:   Duration: N/A, start: 1039.246776, bitrate: 331776 kb/s
2021-11-25_16:55:44.06917 DEBUG 2021/11/25 17:55:44 loopback.go:72:     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
2021-11-25_16:55:44.07637 DEBUG 2021/11/25 17:55:44 loopback.go:72: Output #0, video4linux2,v4l2, to '/dev/video1':
2021-11-25_16:55:44.07864 DEBUG 2021/11/25 17:55:44 loopback.go:72:   Metadata:
2021-11-25_16:55:44.08091 DEBUG 2021/11/25 17:55:44 loopback.go:72:     encoder         : Lavf58.20.100
2021-11-25_16:55:44.08249 DEBUG 2021/11/25 17:55:44 loopback.go:72:     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, q=2-31, 331776 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
2021-11-25_16:55:44.08418 DEBUG 2021/11/25 17:55:44 loopback.go:72: Stream mapping:
2021-11-25_16:55:44.08722 DEBUG 2021/11/25 17:55:44 loopback.go:72:   Stream #0:0 -> #0:0 (copy)
2021-11-25_16:55:44.08980 DEBUG 2021/11/25 17:55:44 loopback.go:72: Press [q] to stop, [?] for help
2021-11-25_16:55:44.09231 DEBUG 2021/11/25 17:55:44 loopback.go:74: ffmpeg is now running
2021-11-25_16:55:44.09495 DEBUG 2021/11/25 17:55:44 loopback.go:82: Loopback started
2021-11-25_16:55:46.42273 ffmpeg version 4.1.8-0+deb10u1+rpt1 Copyright (c) 2000-2021 the FFmpeg developers
2021-11-25_16:55:46.42447   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
2021-11-25_16:55:46.42573   configuration: --prefix=/usr --extra-version=0+deb10u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
2021-11-25_16:55:46.43294   libavutil      56. 22.100 / 56. 22.100
2021-11-25_16:55:46.43579   libavcodec     58. 35.100 / 58. 35.100
2021-11-25_16:55:46.43789   libavformat    58. 20.100 / 58. 20.100
2021-11-25_16:55:46.44268   libavdevice    58.  5.100 / 58.  5.100
2021-11-25_16:55:46.44449   libavfilter     7. 40.101 /  7. 40.101
2021-11-25_16:55:46.44636   libavresample   4.  0.  0 /  4.  0.  0
2021-11-25_16:55:46.44808   libswscale      5.  3.100 /  5.  3.100
2021-11-25_16:55:46.44928   libswresample   3.  3.100 /  3.  3.100
2021-11-25_16:55:46.45158   libpostproc    55.  3.100 / 55.  3.100
2021-11-25_16:55:46.46298 [video4linux2,v4l2 @ 0x21a0e80] The driver does not permit changing the time per frame
2021-11-25_16:55:46.48145 Input #0, video4linux2,v4l2, from '/dev/video1':
2021-11-25_16:55:46.48271   Duration: N/A, start: 1042.029509, bitrate: 331776 kb/s
2021-11-25_16:55:46.48594     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
2021-11-25_16:55:46.49224 Stream mapping:
2021-11-25_16:55:46.49345   Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
2021-11-25_16:55:46.49492 Press [q] to stop, [?] for help
2021-11-25_16:55:46.50593 [swscaler @ 0x21abf20] deprecated pixel format used, make sure you did set range correctly
2021-11-25_16:55:46.64615 Output #0, image2, to '/tmp/snapshot_2021-11-25T17:55:44+01:00.jpeg':
2021-11-25_16:55:46.64730   Metadata:
2021-11-25_16:55:46.64813     encoder         : Lavf58.20.100
2021-11-25_16:55:46.64978     Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
2021-11-25_16:55:46.65346     Metadata:
2021-11-25_16:55:46.65528       encoder         : Lavc58.35.100 mjpeg
2021-11-25_16:55:46.65766     Side data:
2021-11-25_16:55:46.65896       cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
2021-11-25_16:55:46.82127 frame=    1 fps=0.0 q=4.6 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.103x    
2021-11-25_16:55:46.82260 video:7kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
2021-11-25_16:55:47.06586 DEBUG 2021/11/25 17:55:47 loopback.go:103: Stopping loopback
frame=   92 fps= 31 q=-1.0 Lsize=N/A time=00:00:03.33 bitrate=N/A speed=1.11x    ps=0.0 q=-1.0 size=N/A time=00:00:00.83 bitrate=N/A speed=1.65x    
2021-11-25_16:55:47.09332 DEBUG 2021/11/25 17:55:47 loopback.go:72: video:124200kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
2021-11-25_16:55:47.13852 DEBUG 2021/11/25 17:55:47 loopback.go:72: Exiting normally, received signal 2.
2021-11-25_16:55:51.09192 DEBUG 2021/11/25 17:55:51 characteristics.go:59: 172.16.1.11:49228 GET /characteristics map[id:[1.7]]
brutella commented 2 years ago

or do they only work in the home + app?

Persistent Snapshots are only available in the Home+ app. It doesn't work with the Apple Home app.