Pi Camera in OSMC

Hello everyone,

complete newby here… I’m trying to get my Pi camera to display video when the “Video” button on the home screen is pressed, but it doesn’t seem to work.

I have tried to amend the ‘onclick’ action to:

System.Exec(/opt/vc/bin/raspivid -d)

as well as

System.Exec("/opt/vc/bin/raspivid -d")

and

System.Exec(’/opt/vc/bin/raspivid -d’)

Also, the above variations with “sudo …” have been tried.

but it doesn’t work… From ssh,

/opt/vc/bin/raspivid -d

displays camera video (over the top of Kodi while Kodi is running) for about 10 seconds - a starting point for what I want.

Can anyone help me, or offer advice as to getting video using Kodi? The camera video will be used as a reversing camera function in a car.

SPECIFICS:

Raspberry Pi 3 B+

Raspberry Pi Camera V1.3

OSMC Version (grep VERSION_ID /etc/os-release):
VERSION_ID=“2018.08-2”

Kodi Version (grep Kodi .kodi/temp/kodi.log | head -3):
10:05:36.384 T:1925507584 NOTICE: Starting Kodi (17.6). Platform: Linux ARM (Thumb) 32-bit
10:05:36.384 T:1925507584 NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
10:05:36.384 T:1925507584 NOTICE: Kodi compiled Jun 7 2018 by GCC 6.3.0 for Linux ARM (Thumb) 32-bit version 4.9.30 (264478)

Skin:
skin.CarPc-Carbon

It will work if you aren’t playing video already.
Try using sudo to see if it works.

System.Exec is broken. Launching your own Python script that runs this as os.system (import os first) will probably do the trick.

Sam

Adding ‘sudo’ makes no difference.

Will attempt to run a python script instead.

Thanks,

Ewan

On a slightly different note, is there an add-on that will perform the camera video function? I looked but couldn’t find anything…

Ewan

I’m not aware of one unfortunately.

Sam

Is that the exact code, or a typo, it should be:

System.Exec('/opt/vc/bin/raspivid -d')

Original post updated to use formatting better…

FYI, single (’) and double (") quotes mean the same thing in most computer languages.

Are there any errors in the Kodi log when you try this? Have you tried Sams suggestion to create a python script instead?

Yes!

The ‘onclick’ code needs to be:

RunScript(/home/osmc/runCamera.py)

where /home/osmc/runCamera.py consists of:

import os
os.system( ‘sh /home/osmc/runCamera.sh’ )

and /home/osmc/runCamera.sh consists of:

/opt/vc/bin/raspivid -d

Thank you, everyone!

Ewan

1 Like