Error executing ffmpeg from exec node : ffmpeg: command not found

Hi, My aim here is to capture a video using ffmpeg command from a rtsp camera.
I am having trouble executing the ffmpeg command via the exec node in node-red.
Command I am trying to run is:

ffmpeg -i rtsp://my_username:my_password@192.168.X.X:554/stream1 -r 10 -t 30 -codec copy -an /media/video_20210502-150501.mp4

I am able to run this well from the terminal. The filename in the command is a dynamic string appended by the exec node.
The error I get is error 127 as:

Command failed: ffmpeg -i rtsp://my_username:my_password@192.168.X.X:554/stream1 -r 10 -t 30 -codec copy -an /media/video_20210502-150501.mp4
/bin/bash: line 1: ffmpeg: command not found

I am sure this is nothing to do with access to the path as I am able to write test file via node red into the same folder.

It may be something to do with the fact that I am running node-red as a docker container and as a addon in home assistant. It does not seem to have access to the command. Can somebody please give me hints on how can i go about solving this?

When running from an exec node the PATH environment variable will be the same as when you are logged in in a terminal. You probably need to specify the full path to ffmpeg. Run
which ffmpeg
which will return something like (but not necessarily the same as) /usr/bin/ffmpeg, then in the exec node use usr/bin/ffmpeg instead of just ffmpeg

[Edit] That assumes you are not running node-red in a container such as Docker, in which case you will probably need to install ffmpeg in the container.

[Further Edit] I have just read your question properly, and see you are running in a container, in which case I think you need ffmpeg installed there. You will likely have to ask in an HA forum for how to do that (or ditch HA and use node-red natively, which is what most here do).

BTW when using ffmpeg and/or rtsp in Node-RED, you definately should have a look at the various nodes that @kevinGodell has developed recently (e.g. this discussion).

Great , thanks for pointing the obvious to me. I should have realized that myself.

Thanks for the pointers, I will see them now.

1 Like

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