Ffpmeg process keeps on running after closing camera stream?

Hi,

I have set up the ipcamera binding and added two Reolink cameras. I set up a widget to show a snapshot image of the cameras on a page, and when clicking on those images, the stream of those cameras opens up. When doing so, in “top” (Linux) I can see ffmpeg starting and running. I would suspect that this process should stop once I close down the stream window, but it doesn’t. Only when I “pause” the camera thing, then ffmpeg will stop.

Is that supposed to happen? Is it a bug or a feature? I can’t think of a reason why it has to keep running when I don’t watch a stream. It only consumes CPU ressources, and quite a lot of that I suppose.

Thanks in advance!

This is because the widget is not closing the stream. So it’s a bug/feature of the widget. The easiest way to work around this is to push refresh on the browser after you close the widget.

EDIT:
If you only want snapshots and not a higher FPS stream that uses a lot of CPU power, then you can simply give the widget the url for the snapshots.mjpeg stream that the binding will create from the snapshots of the camera for you with next to no cpu load. The same thing will happen but it wont be using all the CPU that the ipcamera.mjpeg stream needs. Perhaps someone that knows html and website creation will reply on how to modify the widget to prevent this behavior but for me I find the refresh button works.

1 Like

I have no widgets, only a sitemap showing the mjpeg stream obtained from RTSP because I cannot obtain the snapshot:
Video url="http://mhw.int.fmal.com:8080/ipcamera/divano/ipcamera.mjpeg" encoding="mjpeg"

But the ffmpeg for snapshot is always active also if not there is no defined image snapshot:
//Image url="http://mhw.int.fmal.com:8080/ipcamera/divano/ipcamera.jpg" refresh=2000

This is the ffmpeg process always running:
/usr/bin/ffmpeg -rtsp_transport tcp -threads 1 -skip_frame nokey -hide_banner -i rtsp://admin:******@192.168.1.85/H.264 http://127.0.0.1:8080/ipcamera/divano/snapshot.jpg

And this is the thing file:

Thing ipcamera:generic:divano "Webcam Sala" @ "Webcams"
        [       ipAddress="192.168.1.85",
                ipWhitelist="DISABLE",
                mjpegUrl="ffmpeg",
                snapshotUrl="",
                snapshotOptions="",
                ffmpegOutput="/TMPDIR/divano/",
                ffmpegInput="rtsp://192.168.1.85/H.264",
                ffmpegInputOptions="",
                mjpegOptions="-q:v 5 -r 2 -vf scale=1280:-2 -update 1 ",
                password="******",
                username="admin"
        ]

From the readme:

pollImage | Switch | This control can be used to manually start and stop using your CPU to create snapshots from a RTSP source. If you have a snapshot URL setup in the binding, only then can this control can be used to update the Image channel.

So you can choose to manually use the channel to turn it on and off as needed.

I tried any set since months, but in the readme I cannot find an example. I have other 5 cams working well, only this EZVIZ C6N does not work. I could not understand the concept. Please correct this setting, I’m sure I’m wrong somewhere, but this one is the only rtsp camera I have, so I cannot check others. TY in advance!

Thing ipcamera:generic:divano “Webcam Sala” @ “Webcams”
[ ipAddress=“192.168.1.85”,
updateImageWhen=“1”,
pollTime=5,
port=80,
snapshotUrl=“ffmpeg”,
ffmpegOutput=“/TMPDIR/divano/”,
ffmpegInput=“rtsp://192.168.1.85/H.264”,
password=“*******”,
username=“admin”
]

items:
Switch Cam_sala_refresh { channel=“ipcamera:generic:divano:pollImage” }

sitemap:

Image url="http://192.168.1.69:8080/ipcamera/divano/ipcamera.jpg"
Switch item=Cam_sala_refresh
}
//

I do not use sitemaps, suggest you open a NEW THREAD and don’t post in a 2 year old thread that is not the same issue.

items

Switch Cam_sala_refresh { channel=“ipcamera:generic:divano:pollImage” }

sitemap

Image url="http://192.168.1.69:8080/ipcamera/divano/ipcamera.jpg" refresh=2000
Switch item=Cam_sala_refresh

the other way that will not work is to use an Image item instead of the url in the sitemap, then the switch can start and stop the fetching of the image into the item or start and stop ffmpeg. As the readme states this only works if your camera has a real snapshot source and will not work for RTSP sources. There is currently a github issue open to change this so that it will work with two separate channels. This is planned but not implemented yet. However doing it with the url= way should work if you use a refresh=