1

i'm a PiNoob :) who can help me?

How can I play two videos (in sync) on the raspberry pi 4b? I'm using omx player. I need to combine the following lines:

omxplayer --display=2 --loop /home/pi/Desktop/front.mp4
omxplayer --display=7 --loop /home/pi/Desktop/back.mp4

Is there a way to run these commands at the same time, maybe with a script? I have no idea :)

4
  • can you run two videos on one screen? – jsotola Sep 29 '19 at 18:33
  • I want to run it on two screens, HDMI 0 and HDMI 1. – Sjoerd Mol Sep 29 '19 at 19:27
  • if you cannot run two videos on one screen, then you won't be able to run on two screens either ... make sure that the omxplayer allows two videos to be played – jsotola Sep 29 '19 at 19:57
  • I can run the videos on two screens, when i run the command "omxplayer --display=2 --loop /home/pi/Desktop/front.mp4; omxplayer --display=7 --loop /home/pi/Desktop/back.mp4" it runs the videos on the two screens but after each other. The second video will start when I've closed the first one. I want them to play at the same time – Sjoerd Mol Sep 30 '19 at 9:12
1

Provided the CPU can handle it, you need to replace the ";" between the commands with a "&" - this will put the first job in the background and immediately execute the second.

1

It works if you disable keys, e.g.

# run the first video in the background with key inputs disabled
omxplayer --no-keys --display=2 --loop /home/pi/Desktop/back.mp4 &

# run the second video normally
omxplayer --display=7 --loop /home/pi/Desktop/back.mp4
2
  • On my pi with a .mov video, my second omxplayer is just dying with "have a nice day". Any thoughts? – Fiid Mar 12 '20 at 17:21
  • @Fiid hard to tell. does it work if you play the .mov video with omxplayer by itself? – epylinkn Apr 6 '20 at 8:17

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.