# Display camera ip in dashboard and store video in raspberry

**URL:** <https://discourse.nodered.org/t/display-camera-ip-in-dashboard-and-store-video-in-raspberry/6349>\
**Category:** General\
**Created:** [3 January 2019 14:37 UTC](https://discourse.nodered.org/t/display-camera-ip-in-dashboard-and-store-video-in-raspberry/6349 "2019-01-03T14:37:07Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [17 May 2019 20:01 UTC](https://discourse.nodered.org/t/display-camera-ip-in-dashboard-and-store-video-in-raspberry/6349/26 "2019-05-17T20:01:01Z")

</div>

In januari I was completely stuck, so I contacted [Kevin Godell](https://github.com/kevinGodell?tab=repositories). Got immediate help from Kevin, so would like to thank him for his time!!!!!! After some research, he came up with following ffmpeg command:

```auto
-f mjpeg -i pipe:0 -vf scale=320:240 -f image2pipe pipe:1

```

When you use this command in Node-RED's daemon node, it is now possible to pass images via memory ( **stdin** stream pipe:0) to ffmpeg (since we (ab)use an mjpeg stream to be able to process an infinite series of images). And the resized image is returned back to Node-RED as an output message ( **stdout** stream pipe:1):

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e737abd9feabecea23af03f5a6a4f9a6731892fd.png)

```auto
[{"id":"122804f3.f8b7eb","type":"daemon","z":"50df184.124f2e8","name":"Resize image","command":"/home/pi/FFmpeg/ffmpeg","args":"-f mjpeg -i pipe:0 -vf scale=320:240 -f image2pipe pipe:1","autorun":true,"cr":false,"redo":true,"op":"buffer","closer":"SIGTERM","x":560,"y":320,"wires":[["98ce6e9f.81789"],[],[]]},{"id":"631c9e62.c5bf1","type":"inject","z":"50df184.124f2e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":340,"wires":[["afda2c1f.ec754"]]},{"id":"dfde7d7e.a8b0b","type":"image","z":"50df184.124f2e8","name":"","width":200,"x":980,"y":300,"wires":[]},{"id":"afda2c1f.ec754","type":"http request","z":"50df184.124f2e8","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"https://static.independent.co.uk/s3fs-public/thumbnails/image/2017/09/12/11/naturo-monkey-selfie.jpg?w968","tls":"","proxy":"","authType":"basic","x":340,"y":340,"wires":[["122804f3.f8b7eb","c886e69d.47aa98"]]},{"id":"93ccc4c3.6f45c8","type":"image","z":"50df184.124f2e8","name":"","width":200,"x":720,"y":400,"wires":[]},{"id":"c886e69d.47aa98","type":"image-info","z":"50df184.124f2e8","name":"","x":530,"y":400,"wires":[["93ccc4c3.6f45c8"]]},{"id":"98ce6e9f.81789","type":"image-info","z":"50df184.124f2e8","name":"","x":790,"y":300,"wires":[["dfde7d7e.a8b0b"]]},{"id":"853bae8d.c380d","type":"comment","z":"50df184.124f2e8","name":"Image processing without spawn but with delay","info":"-f mjpeg -i pipe:0 -vf scale=320:240 -f image2pipe pipe:1","x":660,"y":260,"wires":[]}]

```

_Advantages_:

- All data is passed via memory, and no temporary files (or disc IO) is needed.
- A single daemon ffmpeg needs to be spawned that processes all images. I.e. it is not necessary to spawn a new ffmpeg process for every image, like e.g. the [ffmpeg-stream](https://www.npmjs.com/package/ffmpeg-stream) package.

_Disadvantage_: there is a **single image delay** 🥴 When you insert an image nothing happens. As soon as you inject the second image, the first image will arrive on the output. And so on ... Not 100% sure what the problem is, but after the first image is inserted I get only this output (on stderr and adding _-loglevel debug_):

> [mjpeg @ 0x7fffcd526700] Before avformat\_find\_stream\_info() pos: 0 bytes read:32768 seeks:0 nb\_streams:1

This is similar to the issue I had before: since we (ab)use an mjpeg stream, ffmeg wants to collect information about that stream. And I think that causes the delay. But I'm not sure...

Unless somebody else has some usefull tips, I will have to stop with this mechanism 😩 Would be a pitty, since we are almost there. And it would have been an awesome addition for Node-RED... P.S. I'm _ **not** _ referring to the image resizing, because that is only a simple test that you can also achieve with [node-red-contrib-image-tools](https://www.npmjs.com/package/node-red-contrib-image-tools) in pure Javascript ...

---

_[View the full topic](https://discourse.nodered.org/t/display-camera-ip-in-dashboard-and-store-video-in-raspberry/6349)._
