I have an oddly specific problem, though aren't they all? I have a RPi 3B+ on stretch that I'm trying to boot into a python script that I've written that receives an integer and passes it to two Arduino slaves. At the same time, I'm trying to have a video open, play, and close when finished based on the integer entered.

I've looked into both opencv and oxmplayer solutions, but I didn't get very far with other (I'm missing some opencv dependency and oxmplayer refuses to download).

Here is the script I've written to load on boot up:

import serial
import serial.tools.list_ports
import subprocess

def getArduinos():
    ports = [
        for p in serial.tools.list_ports.comports()
        if '9025' == str(p.vid) ]
    return ports

ports = getArduinos()

#get the command from the user
command = input("input the command 1 - 5 (5 to quit): ")
while(command != 5):
    ser = serial.Serial(ports[0], 9600)
    ser2 = serial.Serial(ports[1], 9600)

    #send the command
    ser.write((str(command) + "\n").encode())
    ser2.write((str(command) + "\n").encode())

    #interpret the command
    if(command == 1):
        #use this command to play the video and fill in the file name

    command = input("Enter another command: ")
  • Its omxplayer - not oxmplayer ! It should be pre-installed on Raspbian. – CoderMike Feb 3 at 18:55
  • You are right! I feel so dumb and thought I was losing my mind seeing everyone say it came preinstalled but not being able to get it to work I'm going to spend a bit more time to trying to figure this out. Hopefully having access to omxplayer makes this possible, using SSH to control this pi makes things quite a bit more difficult too. – aghazi Feb 4 at 7:36
  • You realise you can't play a video over ssh? – CoderMike Feb 4 at 9:19
  • I don't understand what you mean, I managed to accomplish what I wanted. I did this by opening a subprocess to call another script that plays a video on my display, all from my phone using Termius. However, I'm pretty new to Python, linux, and programming in general so I assume you know more than I do. Thanks for the correction on omxplayer, I'm either dumb or dyslexic! – aghazi Feb 4 at 11:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.