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.

  • You should give further information in your answer. I don't check it here, tl;dr. We're looking for long answers that provide some explanation and context. Explain why your answer is right, together with the citation here. – Ingo Sep 15 '19 at 10:22
  • I tried to create a Digital Signage project with my pi and I came upon the gap problem so I did my research and I made a "tutorial" based on this research. The result is working for me but I don't know if this is the "right answer" so I just tried to help the community with a short answer and refer to the full guide. – Christakitos Sep 15 '19 at 16:51
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,240
  • 2
  • 11
  • 20
  • I'm struggling to see how this could affect seamless playback in omxplayer, particularly when it appears to be run from the terminal rather than a GUI. Can you provide a clearer explanation? – goobering Oct 20 '16 at 14:00
  • Aha! Got you. Is there any chance you could add that explanation to your answer? Without it, it's a little unclear what the effect of disabling X is. – goobering Oct 20 '16 at 14:17
  • There is no GUI - this is all from the terminal. Between the videos you just see the desktop (toolbar, terminal window, and whatever else you had open). Then a new player pops up. – Arko Elsenaar Oct 20 '16 at 14:28
  • Crossed wires setting in here - when you say 'all from the terminal' you appear to be describing using the terminal as launched from inside the LXDE windowed GUI. When I'm talking about using the terminal, I mean without using LXDE at all/booting directly to a non-graphical terminal. The approach used in this answer may be effective for hiding on-screen elements between videos if you're working in LXDE, but it would have no effect if the omxplayer process is already being launched from a stand-alone, non-graphical terminal. – goobering Oct 20 '16 at 14:36
  • I deleted my previous comments for a fresh start. By saying seamless, Arko Elsenaar means not to show any GUI component between 2 videos. A blank screen for less than a second is acceptable for him. But goobering talks about the real meaning of seamless which is 0 time gap between 2 videos. I am talking about the former one. I will edit my answer accordingly. – vaha Oct 20 '16 at 16:30
  • Answer is updated. Hope, it is the solution for your problem. – vaha Oct 20 '16 at 19:30