# Question about the camera record service

**URL:** https://discourse.nodered.org/t/question-about-the-camera-record-service/85569
**Category:** General
**Created:** [15 February 2024 14:59 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569 "2024-02-15T14:59:07Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 14:59 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/1 "2024-02-15T14:59:07Z")

</div>

Hello, So I am using the JSONata Expression editor to record my video from my camera to my nvr with the following.

`{"filename":'/media/frigate/{{ computer_camera }}_{{now().strftime("%Y%m%d-%H%M%S")}}.mp4'}`

How do I add duration values for the camera? This is for the `camera.record` service to be specific.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [15 February 2024 15:19 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/2 "2024-02-15T15:19:28Z")

</div>

Welcome to the forum.

I assumed since I have never heard of the camera.record service that it's a HA thing.

Sure enough a quick google of camera.record service took me directly to the relevant information -

[https://www.home-assistant.io/integrations/camera/](https://www.home-assistant.io/integrations/camera/)

Where you can see in **Service data attributes**

`duration` Target recording length (in seconds). Default: 30

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [15 February 2024 15:30 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/3 "2024-02-15T15:30:02Z")

</div>

> [@killingerr](#):
>
> {"filename":'/media/frigate/{{ computer\_camera }}\_{{now().strftime("%Y%m%d-%H%M%S")}}.mp4'}

That does not look like JSONata, it looks more like a Mustache template.

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 15:32 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/4 "2024-02-15T15:32:11Z")

</div>

So what I'm asking is how would I implement the duration into this?  
`{"filename":'/media/frigate/{{ computer_camera }}_{{now().strftime("%Y%m%d-%H%M%S")}}.mp4'}`

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 15:34 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/5 "2024-02-15T15:34:20Z")

</div>

Sorry for the confusion, you're right it is. I brought up the JSONata editor because that's where I was adding this. I tried to be specific as I've asked this question on other forums that weren't Node Red specific.

 ![Screenshot 2024-02-15 083046](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57f600bc740bdecfc07feab8e15e9673a3910d60.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [15 February 2024 15:43 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/6 "2024-02-15T15:43:42Z")

</div>

> [@killingerr](#):
>
> {"filename":'/media/frigate/{{ computer\_camera }}\_{{now().strftime("%Y%m%d-%H%M%S")}}.mp4'}

You would most likely find the correct answer on the HA forum, node-red section.

At a guess (as not many here use HA) you would add a property to the json string.  
e.g.

```auto
{"filename":'/media/frigate/{{ computer_camera }}_{{now().strftime("%Y%m%d-%H%M%S")}}.mp4',"duration":{{path_to_duration_vale}}}

```

presuming duration is a integer  
you would need to add the property path.

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 15:45 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/7 "2024-02-15T15:45:30Z")

</div>

So can you elaborate on the property path? I'm really new to all of this so forgive my ignorance. Also, I've tried the HA forums with no response so I've been forced to try asking elsewhere. So here I am.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [15 February 2024 15:46 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/8 "2024-02-15T15:46:48Z")

</div>

The path to the message variable holding the duration value you wish to add  
e.g. `msg.something.something`

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 15:49 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/9 "2024-02-15T15:49:07Z")

</div>

Interesting. Okay, let me look at this for a bit and see if I can get this to work. Thank you for your time.

---

<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: [15 February 2024 15:53 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/10 "2024-02-15T15:53:01Z")

</div>

Your question is difficult for those who dont use HA (most here do not use HA, only Node-RED)

But perhaps a demo using core built-in Node-RED nodes will help you?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/7/d71f746efc68ef000f52a83eadc121e2cbeb3bcc.png)

JSONata used:

```auto
{
    "filename": "/media/frigate/" & computer_camera & "_" & $moment().format("YYYYMDD-HHmmss") & ".mp4",
    "duration": duration
}

```

The demo flow (use `CTRL-I` to import)

```auto
[{"id":"70be9c28a7f55a87","type":"inject","z":"73b44920080e0db3","name":"server3_camera5, 1234","props":[{"p":"payload"},{"p":"computer_camera","v":"server3_camera5","vt":"str"},{"p":"duration","v":"1234","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1440,"y":80,"wires":[["154b1d6156823171"]]},{"id":"154b1d6156823171","type":"change","z":"73b44920080e0db3","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"filename\": \"/media/frigate/\" & computer_camera & \"_\" & $moment().format(\"YYYYMDD-HHmmss\") & \".mp4\",\t \"duration\": duration\t}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1470,"y":140,"wires":[["384554834ef7097d"]]},{"id":"384554834ef7097d","type":"debug","z":"73b44920080e0db3","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1500,"y":200,"wires":[]}]

```

I have no idea if this is what you want but at least, as a working demo, it might lead you down the right path.

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 15:57 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/11 "2024-02-15T15:57:51Z")

</div>

Yea I know. I'm in a weird in-between because a lot of people here don't use HA, and on the HA forums a lot of people don't use Node Red. But this helps as really I just need help with the syntax. I'll try what you posted.

---

<div class="post-metadata">

### Author: ![killingerr](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@killingerr](https://discourse.nodered.org/u/killingerr)
#### Post date: [15 February 2024 16:07 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/12 "2024-02-15T16:07:11Z")

</div>

Okay, so this works.

```auto
{
    "filename": "/media/frigate/" & computer_camera & "_" & $moment().format("YYYYMDD-HHmmss") & ".mp4",
    "duration": duration
}

```

I appreciate the help.

---

<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: [29 February 2024 16:08 UTC](https://discourse.nodered.org/t/question-about-the-camera-record-service/85569/13 "2024-02-29T16:08:12Z")

</div>

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