SOLVED Display .JPG image on sitemap

Hello,
I have been trying to get this going for days now and am going round and round in circles. What I am trying to do is display a .JPG file from my Raspberry pi3 root folder on my sitemap.
Heres my sitmap bit-:

Frame label=""
        Text label="CCTV" icon="" {
            
            Image url="http://192.168.1.119:8080/img.jpg" refresh=60000
        }

and here is the image showing on the Pi3

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://openHABianPi:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

[20:12:10] openhabian@openHABianPi:~$ dir
img.jpg  README.txt  x264
[20:13:15] openhabian@openHABianPi:~$

I am not a linux pro and am struggling with this now. Can anyone point me in the right direction?

That would require whatever is serving the HTTP to map incoming requests to your root folder. That’d be unwise.

Simplest thing is to put your jpeg in the openhab folder meant for sharing web content - there’s a /html folder under your user configuration, alongside /transforms etc.

@crumpy10, when you follow rossko57’s advice, make sure to use http://192.168.1.119:8080/static/img.jpg (notice the static) as the URL.

Thanks for the advice @rossko57 and @rlkoshak
I can see this folder from my windows share, can I just place the image file in there through windows?

Then all I will have to figure out is how to save the image every so often from ffmpeg into the folder on the raspberry pi.

For the first part, I’m guessing there is a permission problem with Samba preventing you from writing to the files. Search the forum, there is lots of help for that problem posted.

You can maybe use Grafana Image Charts for an overall approach to periodically getting the image.

Hi Rich,
Thanks for the info, I actually just remotely changed my setup and it works as suggested by putting the img file in the html folder directly on windows.

just the FFMpeg bit to work out now…later when I get home…

Not sure if I have enough processing power for Grafana on a Pi3 ?

Have you seen the ipcamera binding? It may make things easier for you even if this is not a camera as it will fetch jpgs and also serve them with benefits over the method you are using now like being able to cast the picture to Chromecasts and creating animated Gifs…

You also do not mention what you are viewing the sitemaps on? android or apple products?

image = works great on Android, but bad on ios app.
webview = works great on ios app, not so great on Android.

streaming video:
HLS = works great on ios, not on Android app.
mjpeg = works great on Android, not on IOS app.

@matt1 Yes I have seen your binding but maybe wrongly assumed that it only streamed video feeds and I am wanting to keep the CPU usage on the Pi3 down as much as possible.
I have a Hikvision NVR standalone with a single camera at the moment (will be increasing with upto 8) and was just looking at viewing snapshots on IOS and Android devices. In the future I would like to display on a touchscreen Dell monitor running Habpanel.
Is it possible to setup your binding to just send snapshots every say 5 - 10 seconds?
Cheers
Simon

Yes in fact up until 4 months ago it could only do snapshots.

For the lowest cpu load disable sending the snapshot to the image channel. Whatever the openhab framework it doubles the cpu load and you can use the bindings file server to deliver the snapshots as you are doing now.

Btw the binding only places a load when you view the video streams, so if you rarely watch the feed it will rarely use cpu and you will be surprised at how little you need.

OK I might have to take a look at that later then when I get home.

The only thing is, the NVR is a Chinese clone that I can only get RTSP streams from. Will that work with the binding ok?

Sorry I am a newbe at all this, especially Linux.

If you can not get a snapshot then the binding is useless as it requires this for the camera to come online in openhab. If it is a Chinese clone with counterfeit firmware then look for the ability to expose the cameras on separate ports in the nvr settings. If it is a complete fake then your out of luck.

Ffmpeg will do it as I use it in my binding to create snapshots from RTSP streams when creating the animated gif files. This will be higher cpu and other resources like network traffic because you have to stream to get the snapshot.

1 Like

@matt1 Yep its one of those, I dont think there is any other way of exposing the cameras.

Anyway, I sort of have the snapshot thing working but am getting a lot of errors like these-:

[h264 @ 0x2aeddf0] error while decoding MB 40 3, bytestream -5
[h264 @ 0x2aeddf0] concealing 7809 DC, 7809 AC, 7809 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 106 25, bytestream -7=N/A speed=N/A
[h264 @ 0x2b716b0] concealing 5103 DC, 5103 AC, 5103 MV errors in P frame
[h264 @ 0x295c5f0] concealing 7680 DC, 7680 AC, 7680 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 50 57, bytestream -5e=N/A speed=N/A
[h264 @ 0x2b716b0] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 12 3, bytestream -7
[h264 @ 0x295c5f0] concealing 7837 DC, 7837 AC, 7837 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 69 56, bytestream -5e=N/A speed=N/A
[h264 @ 0x2698c00] concealing 1420 DC, 1420 AC, 1420 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 85 5, bytestream -7
[h264 @ 0x2735370] concealing 7524 DC, 7524 AC, 7524 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 0 62, bytestream -7
[h264 @ 0x2698c00] concealing 769 DC, 769 AC, 769 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 117 11, bytestream -5=N/A speed=N/A
[h264 @ 0x2735370] concealing 6772 DC, 6772 AC, 6772 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 115 5, bytestream -7e=N/A speed=N/A
[h264 @ 0x2b716b0] concealing 7494 DC, 7494 AC, 7494 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 74 13, bytestream -5
[h264 @ 0x295c5f0] concealing 6575 DC, 6575 AC, 6575 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 50 57, bytestream -5e=N/A speed=N/A
[h264 @ 0x2735370] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
[h264 @ 0x2aeddf0] error while decoding MB 22 3, bytestream -5
[h264 @ 0x2aeddf0] concealing 7827 DC, 7827 AC, 7827 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 37 50, bytestream -5e=N/A speed=N/A
[h264 @ 0x295c5f0] concealing 2172 DC, 2172 AC, 2172 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 22 6, bytestream -5
[h264 @ 0x2698c00] concealing 7467 DC, 7467 AC, 7467 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 56 57, bytestream -5e=N/A speed=N/A
[h264 @ 0x2698c00] concealing 1313 DC, 1313 AC, 1313 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 104 16, bytestream -7
[h264 @ 0x2735370] concealing 6185 DC, 6185 AC, 6185 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 91 65, bytestream -5e=N/A speed=N/A
[h264 @ 0x2735370] concealing 318 DC, 318 AC, 318 MV errors in P frame
[h264 @ 0x2aeddf0] error while decoding MB 5 6, bytestream -5
[h264 @ 0x2aeddf0] concealing 7484 DC, 7484 AC, 7484 MV errors in P frame
[h264 @ 0x2b716b0] concealing 1901 DC, 1901 AC, 1901 MV errors in P framed=N/A
[h264 @ 0x2aeddf0] error while decoding MB 92 57, bytestream -7
[h264 @ 0x2aeddf0] concealing 1277 DC, 1277 AC, 1277 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 2 6, bytestream -5
[h264 @ 0x2b716b0] concealing 7487 DC, 7487 AC, 7487 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 54 53, bytestream -5e=N/A speed=N/A
[h264 @ 0x2b716b0] concealing 1795 DC, 1795 AC, 1795 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 103 7, bytestream -7
[h264 @ 0x295c5f0] concealing 7266 DC, 7266 AC, 7266 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 70 7, bytestream -5te=N/A speed=N/A
[h264 @ 0x2698c00] concealing 7299 DC, 7299 AC, 7299 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 96 5, bytestream -7
[h264 @ 0x2735370] concealing 7513 DC, 7513 AC, 7513 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 113 67, bytestream -5=N/A speed=N/A
[h264 @ 0x2b716b0] concealing 56 DC, 56 AC, 56 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 26 5, bytestream -5
[h264 @ 0x295c5f0] concealing 7583 DC, 7583 AC, 7583 MV errors in P frame
[h264 @ 0x2735370] error while decoding MB 74 25, bytestream -7e=N/A speed=N/A
[h264 @ 0x2735370] concealing 5135 DC, 5135 AC, 5135 MV errors in P frame
[h264 @ 0x2aeddf0] error while decoding MB 41 3, bytestream -11
[h264 @ 0x2aeddf0] concealing 7808 DC, 7808 AC, 7808 MV errors in P frame
[h264 @ 0x2aeddf0] error while decoding MB 73 50, bytestream -5e=N/A speed=N/A
[h264 @ 0x2aeddf0] concealing 2136 DC, 2136 AC, 2136 MV errors in P frame
[h264 @ 0x2b716b0] error while decoding MB 103 11, bytestream -5
[h264 @ 0x2b716b0] concealing 6786 DC, 6786 AC, 6786 MV errors in P frame
[h264 @ 0x295c5f0] error while decoding MB 37 9, bytestream -5te=N/A speed=N/A
[h264 @ 0x295c5f0] concealing 7092 DC, 7092 AC, 7092 MV errors in P frame
[h264 @ 0x2698c00] error while decoding MB 44 53, bytestream -5
[h264 @ 0x2698c00] concealing 1805 DC, 1805 AC, 1805 MV errors in P frame
[rtsp @ 0x265f1f0] max delay reached. need to consume packetrate=N/A speed=N/A
[rtsp @ 0x265f1f0] RTP: missed 8137 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8149 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8150 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8154 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8155 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8156 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8157 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8158 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8159 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 8138 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 7314 packets
[rtsp @ 0x265f1f0] RTP: PT=60: bad cseq 269f expected=0a0d
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 7353 packets
[rtsp @ 0x265f1f0] RTP: PT=60: bad cseq 26c6 expected=0a0d
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 7354 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packetrate=N/A speed=N/A
[rtsp @ 0x265f1f0] RTP: missed 727 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1229 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1232 packets
[h264 @ 0x2b716b0] concealing 3488 DC, 3488 AC, 3488 MV errors in P frame
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1232 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1233 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1234 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 21 packets
[h264 @ 0x2b716b0] error while decoding MB 52 8, bytestream -5
[h264 @ 0x2b716b0] concealing 7197 DC, 7197 AC, 7197 MV errors in P frame
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1039 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1040 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1042 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1043 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1044 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1045 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1046 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1047 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1048 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1049 packets
[rtsp @ 0x265f1f0] max delay reached. need to consume packet
[rtsp @ 0x265f1f0] RTP: missed 1050 packets
[swscaler @ 0x293a850] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/etc/openhab2/html/img.jpg':
  Metadata:
    title           : HIK Media Server V3.0.18
    comment         : HIK Media Server Session Description : standard
    encoder         : Lavf58.28.101
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 480x300, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.53.101 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    1 fps=0.1 q=1.6 Lsize=N/A time=00:00:37.44 bitrate=N/A speed=3.13x
video:12kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

This is my command

ffmpeg -i rtsp://username:password@192.168.1.80:554/Streaming/Channels/301 -vframes 1 -s 480x300 -f image2 /etc/openhab2/html/img.jpg &

Sometimes it picks up a good snapshot, sometimes not. Any idea what the errors are all about? Sorry I am a total learner at Linux and FFMpeg.

Cheers

try adding this to the command BEFORE the -i

-rtsp_transport tcp

Google differences between UDP and TCP if that works and you wish to know more.

Thanks that works much better now, will have a look and get to know the differences. Just struggling to understand the FFMpeg syntax at the moment. What each part of the command does etc…