I build a video distribution system, where there is one server with a "playlist" of URLs, and multiple Raspberry PIs working as clients, fetching constantly playlist from the server and putting their local "videos" folder in sync with playlist. "Clients" can go offline anytime, but must be able to loop videos they have got so far. The system should work without any GUI, automatically upon startup.

The biggest problem I encountered so far is trying to play multiple .mp4 videos in a playlist without 1 second gaps. --loop would do, but I need to play multiple files in a row.

A simplified model of omxplayer "playlist" would be a script like

`omxplayer video1.mp4`
`omxplayer video2.mp4`
`omxplayer video3.mp4`

I am aware of hello_video option, but it still has 0,1s black gap and videos must be transcoded to "raw h264" – it doesn't fit me, as I don't want to add extra moving part in form of transcoding daemon (I'll have tens of GBs coming in .mp4).

4 Answers 4


One idea is to handle transitions on the server. Give your clients a single endless video stream to play, and push data from different files in that stream. That's how info-beamer seems to work. I think VLC should be able to push a complete playlist to an HTTP stream as well, but I haven't tried it myself.

Of course, streaming only works while you're online. If VLC streaming works, you can try to stream locally via loopback (i.e., which is always up and running. I'm not sure the RPi will have enough CPU power for simultaneous streaming and playback, but it might work.

Here's an answer to a similar question which seems to say that not using X (or at least not using LXDE) reduces the gap between videos as there's no X server / display manager in the way. It will not eliminate the gap completely though.


If you get a black screen on your X11 desktop after Omxplayer is finished, you can use this command to restore your view:

xrefresh -display :0

Or you can use a small Bash script for video playback to do this every time

omxplayer "$@"
xrefresh -display :0

On Raspbian, xrefresh is part of the x11-xserver-utils package (apt-get install x11-xserver-utils).


So I tried the xrefresh thing on its own but I had no luck. I did some more research and I found something that made the gap a bit smoother.

I used xterm also,

sudo apt-get install xterm

and I modified my script:

while true; 
  for videos in $VIDEOPATH/*
      xterm -fullscreen -fg white -bg black -e omxplayer -o hdmi -r "$videos"
      xrefresh -display :0

Further information here.


create the following script in any directory:

# get rid of the cursor
setterm -cursor off

# set here the path to the directory containing your videos
# you can probably leave this alone
# our loop
while true; do
        if ps ax | grep -v grep | grep $Process > /dev/null
        sleep 1;
        for entry in $VideoLocation/*
                # -r for stretched over the entire location
                omxplayer -r $entry > /dev/null

Save the script and then make it executable:

sudo chmod +x mohammadsLoop.sh

Then we run it using the following command:

  • 1
    It doesn't solve the gap problem. Commented Sep 19, 2016 at 22:43
  • can you try it without the "sleep 1;" and tell me how long the delay is if any? Commented Sep 19, 2016 at 22:44
  • 1
    You can see from my initial code sample that there is no extra "sleep" delay by design, the next video starts just after finish of the previous, but still it takes around a second or two to start the next video. Commented Sep 19, 2016 at 22:46
  • i believe that that would be un avoidable buffer time as the code i posted will start the next video immediately after the one before it has ended. and since the pi is only capable of handling a single video stream at any single time you really aren't able to buffer a video while another video is playing so your really out of options unless you want to interlace all of your clips together their really isn't much i can do for you Commented Sep 19, 2016 at 22:48

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.