1

I made a script to run video's with omxplayer using omxd:

sudo service stop omxd
sleep 0.5
sudo service start omxd
sleep 0.5

omxd X
omxd h
omxd O --blank
omxd O --no-osd

VIDEOPATH='/home/pi/videos"

for entry in $VIDEOPATH/*
do
    clear
    echo A $entry > /var/run/omxctl
done

This works well, it does loop all the videos in $VIDEOPATH, however; between the video's theres a gap where it closes the player and starts a new one with the next video. Because of this you will see the desktop/terminal windows between the video's.

The display will be shown in a store, therefor it is not very nice to have this visible between the videos.

Is there any way to have this more seamless? Or any ways to hide the gap between the video's?

Arko Elsenaar
  • 143
  • 1
  • 6

2 Answers2

1

I came upon the gap problem too and I did some research how to make it smoother.

Based on my research I came up with a solution that worked for me.

I installed xterm first.

sudo apt-get install xterm

and then I modified my script to this:

#!/bin/bash
VIDEOPATH="/home/pi/Desktop/videos"
while true; 
do
  for videos in $VIDEOPATH/*
    do
      xterm -fullscreen -fg white -bg black -e omxplayer -o hdmi -r "$videos" >/dev/null
      xrefresh -display :0
    done
done

For further information check here.

1

Because there is no sufficient info about your system, I'm editing my answer based on these 4 assumptions:

  • Raspbian Jessie with Pixel runs on your system
  • Desktop Environment is not a must for you
  • Gap less than a second is OK for you
  • The pi user exists and it is a member of the video group

Set configuration to auto-login to console:

raspi-config -> Boot Options -> Desktop / CLI -> Console Autologin

Create you omx looping script. (Keep it simple keep it easy. No need for omxd etc. =)

The script will be /home/pi/myomx.sh and its content will be:

#!/bin/bash
VIDEOPATH="/home/pi/videos"
for entry in $VIDEOPATH/*
do
    omxplayer --blank "$entry" 1>/dev/null 2>/dev/null
done

By the way, to play videos continuously you may want to add an infinite loop out of the for loop.

Make the script executable:

chmod +x /home/pi/myomx.sh

Append these commands at the end of /home/pi/.bashrc:

clear
nohup /home/pi/myomx.sh &
vaha
  • 1,290
  • 2
  • 11
  • 20