3

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).

Mikhail Vasin
  • 131
  • 1
  • 1
  • 3

4 Answers4

1

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. 127.0.0.1), 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.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
0

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:

#!/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"
      xrefresh -display :0
    done
done

Further information here.

0

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

#/bin/bash
omxplayer "$@"
xrefresh -display :0

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

Michael D.
  • 256
  • 4
  • 9
-1

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
VideoLocation="/mohammads/dank/meme/videos" 
# you can probably leave this alone
Process="omxplayer"
# our loop
while true; do
        if ps ax | grep -v grep | grep $Process > /dev/null
        then
        sleep 1;
else
        for entry in $VideoLocation/*
        do
                clear
                # -r for stretched over the entire location
                omxplayer -r $entry > /dev/null
        done
fi
done

Save the script and then make it executable:

sudo chmod +x mohammadsLoop.sh

Then we run it using the following command:

./mohammadsLoop.sh
Mohammad Ali
  • 2,373
  • 1
  • 12
  • 18