# Grab single frame from webcam on Windows

**URL:** <https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804>\
**Category:** General\
**Created:** [27 July 2024 00:43 UTC](https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804 "2024-07-27T00:43:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [27 July 2024 00:43 UTC](https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804/1 "2024-07-27T00:43:06Z")

</div>

Node-RED version: v4.0.2  
Node.js version: v20.7.0  
Windows\_NT 10.0.19045 x64 LE

I'm running the following command in an exec node `D:\PortablePrograms\Cam2ip\cam2ip.exe` with the additional parameters `-width 1920 -height 1080 -bind-addr ":4567" -nowebgl` included.

It used to work fine but since updating it seems to spawn a console window regardless of if the `Hide console` option is checked of not. I tried setting a timeout but that only seems to kill the main process/PID that the node reports. However, that PID does not seem to match the running executable (`cam2ip.exe`) so it doesn't get killed properly nor does the console window process.

Now, I'm assuming that is because the console window is a subprocess. What are my options here? Can I run it backgrounded somehow? Or at least kill the processes automatically after a short delay?

I'm basically just using it to grab a single frame from my webcam then kill the process. Does anyone know of a simple alternative program or method to achieve a similar result?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 July 2024 10:59 UTC](https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804/2 "2024-07-28T10:59:11Z")

</div>

> [@HaroldPetersInskipp](#):
>
> It used to work fine but since updating

What version of Node and node-RED did you use before.

There was a [change](https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2) in how Node spawns processes in V18.x that _might somehow_ be related.

* * *

As for your issue - cam2ip has a URL that returns a single image. So if you run cam2ip in the background then you should be able to use the HTTP request node to grab an image at any time from `http://localhost:56000/jpeg`

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [28 July 2024 14:24 UTC](https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804/3 "2024-07-28T14:24:16Z")

</div>

> [@Steve-Mcl](#):
>
> What version of Node and node-RED did you use before.

I recently upgraded from:  
Node-RED version: v3.0.2  
Node.js version: 18.15.0

And as you suspected, I was using it with a HTTP request node to grab it

However, I also updated cam2ip, and It does spawn a console window even when launched outside of Node-RED so I'm lead to believe that it's not just a "Node.js" change?

I was hoping not not have to leave it running all the time, but if I have to make that compromise than so be it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 October 2024 14:24 UTC](https://discourse.nodered.org/t/grab-single-frame-from-webcam-on-windows/89804/4 "2024-10-26T14:24:35Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
