1

I have a Raspberry Pi connected by a video captures to my PC.

I want to be able to start the camera of the Pi via SSH. I got a sh script that I run on the pi terminal and all good but when I run the script via SSH it doesn't open the camera preview.

Is there a way to run this script just like run it on the pi terminal but remotly? I don't need to stream the camera preview or anything, just to start the camera.

2
  • What does your .sh script look like? Does your terminal tell you something when starting the script via ssh? Does it tell you something if you just run the part to start the camera via ssh?
    – starkus
    Nov 27, 2022 at 10:44
  • the script is jut this line "libcamera-vid -t 0 -f --width 1920 --height 1080 --framerate 24 --exposure normal --awb auto --brightness -0. --vflip --hflip" when I run it from ssh I get "Preview window unavailable"
    – JMKintela
    Nov 28, 2022 at 23:04

1 Answer 1

0

You could try it with creating a file called preview.sh in the home directory of your Pi. The first line should be #!/bin/bash - the second line export DISPLAY=:0 - the third line libcamera-vid -t 0 -f --width 1920 --height 1080 --framerate 24 --exposure normal --awb auto --brightness -0. --vflip --hflip.

enter image description here

Then make the file executable with chmod +x preview.sh. The file should be placed in /home/pi or ~ if this is the default directory you ssh into.

Finally you can start the script on your Pi from your PC with ./preview.sh in a default ssh session from your PC.

1
  • 1
    Working like a charm hehe, thanks!
    – JMKintela
    Nov 30, 2022 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.