I have a Raspberry Pi Model B+ and I would like to play video files that are stored on a USB flash drive.

Basically, I have three different push buttons connected to the GPIO pins of the Raspberry Pi and when one button is pressed, then video 1 plays. If button 2 is pressed, then video 2 plays and so on and so forth.

My video files are in mp4 format.

Can this be done using omxplayer or XBMC? Or do I have to write a set of codes in Python or C?

  • Yes, yes, yes and yes. Hello and welcome. Please note that your question is very broad and therefore hard to answer.
    – Ghanima
    Commented Feb 23, 2015 at 21:47
  • 1
    I'd try to write a python script which waits for button presses and then launches the omxplayer
    – Frepa
    Commented Feb 23, 2015 at 22:16

1 Answer 1


Use Python. Use the RPi.GPIO library to detect button presses. Issue system commands to run omxplayer depending on which button is pressed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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