QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
331 stars 45 forks source link

Grabbing a static image #134

Closed fmarzocca closed 1 year ago

fmarzocca commented 1 year ago

How can I get a static image from my Argus Eco camera?

I tried with: ./neolink image <CameraName> --config=/homeAssets/neolink_config.toml --file-path=immagine

but it enters into a loop, sending BatteryInfo continuosly and the file immagine.jpeg has 0 bytes.

using neolink v. 0.5.16

QuantumEntangledAndy commented 1 year ago

That's interesting. I wasn't expecting to get battery information with that command. If anything the only kind of battery info we should get in that version would be the standard events the camera sends out (not really a loop coz it's on the event thread).

For image command to succeed the camera must support the snap command which seems to just be newer cameras

For older cameras there is the --use-stream option

QuantumEntangledAndy commented 1 year ago

If your camera dosent support the snap command it tends to just wait forever so i suspect that's why you think it's a loop. Try the --use-stream it starts the full video feed and uses gstreamer to dump it to file then close the feed.

fmarzocca commented 1 year ago

here it is


[2023-08-11T13:30:54Z INFO  neolink] Neolink 2484b8753b33805878db0699c48edbaf07fbd1e5 release
[2023-08-11T13:30:54Z INFO  neolink::utils] giardino: Connecting to camera at UID: 95270004YFGE16SE
[2023-08-11T13:30:54Z INFO  neolink_core::bc_protocol] giardino: Trying local discovery
[2023-08-11T13:30:56Z INFO  neolink_core::bc_protocol] giardino: Local discovery success 95270004YFGE16SE at 192.168.1.42:11601
[2023-08-11T13:30:56Z INFO  neolink::utils] giardino: Logging in
[2023-08-11T13:30:58Z INFO  neolink::utils] giardino: Connected and logged in
<?xml version="1.0" encoding="utf-8"?><BatteryInfo><channelId>0</channelId><chargeStatus>charging</chargeStatus><adapterStatus>solarPanel</adapterStatus><voltage>3994</voltage><current>-208</current><temperature>33</temperature><batteryPercent>100</batteryPercent><lowPower>0</lowPower><batteryVersion>2</batteryVersion></BatteryInfo>
[2023-08-11T13:30:59Z INFO  neolink::image::gst] appsrc name=thesource ! h264parse ! decodebin ! jpegenc snapshot=TRUE
                    ! filesink location=immagine.jpeg
[2023-08-11T13:30:59Z WARN  neolink::image::gst] Error from gstreamer when setting the play state Error(Message { ptr: 0x73601410, type: "error", seqnum: 81, src: Some("decodebin0"), structure: Some(GstMessageError { gerror: (GError) ((GError*) 0x7366a350), debug: (gchararray) "../gst/playback/gstdecodebin2.c(4719): gst_decode_bin_expose (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:\nno suitable plugins found:\nMissing decoder: H.264 (High Profile) (video/x-h264, width=(int)2304, height=(int)1296, framerate=(fraction)0/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)5.1)\n" }) }) setting to Null instead
^C

then it hangs there and I have to Ctrl-C

QuantumEntangledAndy commented 1 year ago

Your missing a gstreamer plugin that can decode the h264 stream. Look into getting the av plugin set or something else that can handle h264

fmarzocca commented 1 year ago

I'm running on a Raspberry (Debian bullseye) and I have installed all plugins you recommend....

ii  gstreamer1.0-gl:armhf                1.18.4-2+deb11u1                 armhf        GStreamer plugins for GL
ii  gstreamer1.0-plugins-bad:armhf       1.18.4-3+deb11u1                 armhf        GStreamer plugins from the "bad" set
ii  gstreamer1.0-plugins-base:armhf      1.18.4-2+deb11u1                 armhf        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-good:armhf      1.18.4-2+deb11u2+rpt1            armhf        GStreamer plugins from the "good" set
ii  gstreamer1.0-x:armhf                 1.18.4-2+deb11u1                 armhf        GStreamer plugins for X11 and Pango
ii  libgstreamer-gl1.0-0:armhf           1.18.4-2+deb11u1                 armhf        GStreamer GL libraries
ii  libgstreamer-plugins-bad1.0-0:armhf  1.18.4-3+deb11u1                 armhf        GStreamer libraries from the "bad" set
ii  libgstreamer-plugins-base1.0-0:armhf 1.18.4-2+deb11u1                 armhf        GStreamer libraries from the "base" set
ii  libgstreamer1.0-0:armhf              1.18.4-2.1                       armhf        Core GStreamer libraries and elements
ii  libgstrtspserver-1.0-0               1.18.4-2                         armhf        GStreamer RTSP Server (shared library)
QuantumEntangledAndy commented 1 year ago

For transcoding you also need gstreamer1.0-libav with --use-stream

fmarzocca commented 1 year ago

It works! Thanks