Ffmpeg problems

First issue- I was working through the documentation on the IP Camera (RLC-420 camera) binding and ran into a problem installing ffmpeg on my Rpi3 running OH 2.4. After the command

sudo apt update && sudo apt install ffmpeg

I get

Package ffmpeg is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

E: Package ‘ffmpeg’ has no installation candidate

So after going to the ffmpeg website (very confusing on what to download) I found another website and managed to install ffmpeg in usr/bin/FFmpeg.

Next with the Thing File for one camera:

Thing ipcamera:HTTPONLY:Basement “Camera1” @ “Basement”
[
IPADDRESS=“192.168.0.126”,
USERNAME=“admin”,
PASSWORD= “xxxxxxxx”,
PORT=80,
POLL_CAMERA_MS=2000,
SERVER_PORT=50001,
NVR_CHANNEL=1,
SNAPSHOT_URL_OVERRIDE=“http://192.168.0.126/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=reec1230”,
IMAGE_UPDATE_EVENTS=0,
UPDATE_IMAGE=false,
GIF_PREROLL=0,
GIF_POSTROLL=6,
FFMPEG_INPUT=“rtsp://192.168.0.126:554/h264Preview_01_main”,
FFMPEG_LOCATION="/usr/bin/FFmpeg/",
FFMPEG_OUTPUT="/tmpfs/camera1/",
IP_WHITELIST=“DISABLE”

And with this Rule file (Note: Basement motion is from a separate Z-wave “eyeball” and I do have the Update Image working on the camera)

rule “Camera1snapaction”
when
Item Basement_Motion changed to ON
then
Basement_UpdateTheImage.sendCommand (ON)
BasementCreateGif.sendCommand (ON)
end

I get the following three lines on the log file related to my issue:

2019-08-25 08:19:08.089 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:/usr/bin/FFmpeg/ -y -t 6 -rtsp_transport tcp -i rtsp://admin:xxxxxxx@192.168.0.126:554/h264Preview_01_main -filter_complex fps=4,scale=480:-2:flags=lanczos,setpts=0.25*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse /tmpfs/camera1/ipcamera.gif
2019-08-25 08:19:08.111 [ERROR] [hab.binding.ipcamera.internal.Ffmpeg] - java.io.IOException: Cannot run program “/usr/bin/FFmpeg/”: error=13, Permission denied
2019-08-25 08:19:08.113 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Animated GIF has been created and is ready for use.

Before the test above, I was already getting the permission error, so I tried (I’m not a Linux expert, I googled the error code and found these solutions- none have worked):

sudo chown openhab:openhab /usr/bin/FFmpeg and /usr/bin/FFmpeg/ffmpeg
sudo chmod a+x /usr/bin/FFmpeg and /usr/bin/FFmpeg/ffmpeg

As to line three, although the log says the gif file is created it is not. I next extracted the command in line 1 and ran it directly in a putty session with the result below:

So I think I may have a couple of issues, probably all related to the version and way I installed ffmpeg. Any suggestions?

I’m going to stick this item in this topic as fyi for others that may have the same problem with the snap function, as I have worked around it…

Above, I noted I have the snap feature working on the RLC-420, but it wasn’t elegant. The log below was taken at the same time as the test above (log:set = TRACE). Thing file is the same as above. What it looked like to me was after the first picture either Openhab or the binding or my Rpi is overwhelmed (I thought there was supposed to be a 2 second delay, but the WARN seems to fire off repeatedly in fractions of a second), so I added a rule to only open the UpdateTheImage for 4 seconds.

rule “camera1snaptime”
when
Item Basement_UpdateTheImage changed to ON
then
var Timer timer1 = null
if (timer1 === null) {
timer1 = createTimer(now.plusSeconds(4), [ |
Basement_UpdateTheImage.sendCommand (OFF)
])
timer1 = null
}
end

and I also put this in the console:

log:set ERROR org.openhab.binding.ipcamera

I do get the picture and do not fill up the log file. The file below is a version of what I was getting before these changes that indicates something is overwhelmed. I’m not smart enough to figure it out. I can get a new picture by changing the item back ON in a few seconds after it is turned off, so for my purposes I’m good.

snaplogs-snipped.txt (35.6 KB)

After three days and four tries at installing ffmpeg (and deleting three), plus primers of Linux permissions and file management, I feel like a moron to report that I misunderstood the FFMPEG LOCATION and did not include the actual executable ffmpeg. Correct and working is:

FFMPEG_LOCATION="/usr/local/bin/ffmpeg"

On the bright side I increased my Linux knowledge.