Error code in RTSP stream decoding

This is the code I use to decode my rtsp stream from an Sonoff camera (GK-200MP2-B):
ffmpeg -f rtsp -i "rtsp://rtsp:xxxxxx@" -f image2pipe pipe:1
xxxx = the code I received from the camera.
As you can see I receive rc:-2 instead of the image preview when clicking the Start Stream inject node.
I know the rtsp stream is good, because I receive in a picture card in Home Assistant the stream (movie).
But maybe I have to delete or change a part of the code.
I hope somebody is able to help me to explain what I do wrong.
Thank you.

Set the debug nodes to output the full message and inspect each one carefully, you should find an error message in there somewhere.

Thank you Collin. The message is:
payload: object
code: -2
topic: ""
So it seems to me it has to do with the empty topic.
But I can't understand where I need a topic for.
I don't use a topic.
So it's a mystery for me.
I don't know if you have a solution, but thanks for your help.


I meant all three debug nodes

And what is in the object in the payload?


Start stream:

Naamloos 4

Exec node: Decode RTSP stream:


Image node:
Naamloos 2

Image preview:

Naamloos 3

The error code is with the lowest msg

All the debug nodes are the same, only the last has an error: -2
Naamloos 6

Thank you Colin

Export the exec node and paste it here.

First try providing the full path to ffmpeg

flows.json (386 Bytes)

Hi Colin,

I uploaded the exec node.
I think that it contains the whole path.

Thank you.

Try instead to use the nice working nodes developed & shared by @kevinGodell

Thanks Kevin.
I will read it and try it if I don't succeed with the old flow.
I'm happy with the support.

I'm not Kevin, I'm Walter, just a happy user of Kevin's great work!

1 Like

Sorry for that!

No problem :wink:

For the future see this post for how to post flows or code - How to share code or flow json

What OS and hardware are you running on, and how did you install node-red?

What does this command show, running in a command window?
which ffmpeg

Thank you Colin. I will read this article about posting flows or code.
I have no clue where I can find the versionof ffmpeg. I installed Home Assistant OS without desktop.
The command which ffmpeg doesn't work in the terminal.
I installed everything last week, so I assume that I will have the latest version installed.
In a picture card I can see the video of the Sonoff camera, so ffmpeg must be working properly. In the configuration.yaml file I have these lines of code:

  • platform: ffmpeg
    name: Sonoff cam
    input: -rtsp_transport tcp -i rtsp://

If you get tired of me, please me know.
Thank you.


That is very important. Assuming that you installed the node-red plugin for HA then that means that node-red is running inside a Docker container and so does not have access to s/w such as ffmpeg installed into the host operating system. I think that you would have to install ffmpeg into the container running node-red. I have no idea how you would do that in HA, you would have to ask on an HA forum I think.

Very few here use HA, preferring to do everything directly in node-red.

That suggests that you have not even installed ffmpeg in the operating system. Does the command you have put in the exec node work if you run it in a terminal? If not then it obviously won't work in node-red.

bash: ffmpeg: command not found.
I think that you are right with the container.
I was not aware that the add-on in Home Assistant would run in a Docker container.
But, I think that this answer of you will put me in the right direction.
Although I still don't understand why I can run ffmeg in the picture card with

  • platform: ffmpeg
    name: Sonoff cam
    input: -rtsp_transport tcp -i rtsp://

while this is a ffmpeg stream as well.

I will look further Colin.
Thank you for your patience and help.


Perhaps that is running in a different container that does have ffmpeg installed.

Oke. I will close the topic and work further.
Colin, thank you very much.
It was really helpful.


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