[MPlayer-users] Mplayer usage as digital signage
Marcin Gałczyński
marcin at galczynski.pl
Sat Sep 14 17:14:50 CEST 2013
Hello,
I use Mplayer in digital signage application. The main idea is that
there is seamless commercial video playback (seamless = no black screens
and no dis- or badly joined movies). I have a good working solution now.
MLT is used to generate the big "tape" with many flat screen and video
commercial, using some transitions and ensuring it loops nicely
altogether and can be largely automated.
To start mplayer a command is used:
# $NEWESTMOVIE has the movie name
/bin/mplayer -quiet -fixed-vo -nolirc -nomouseinput -nosub -noautosub
-osd-duration 0 -osdlevel 0 -slave -nosound -noconsolecontrols -input
file=/tmp/mpfc1 $NEWESTMOVIE -loop 0 >../logs/movieplayer.log.currlast
2>&1
Then while it's looping, in background MLT generates new movie (new
order of commercials, new transitions etc). This is the code used to
seamlessly switch to the next movie.
# what is the next movie
NEWESTMOVIE=`ls -t /home/rsu/movie/*vid | head -n 1`
# stop current loop
/bin/echo "loop -1 1" >/tmp/mpfc1
# add new file
/bin/echo "loadfile $NEWESTMOVIE 1" >/tmp/mpfc1
# wait for next movie to be started
REC=0
while [ $REC -eq 0 ]
do
REC=`lsof -p $(pidof mplayer) | grep $NEWESTMOVIE | wc -l`
sleep 1
done
# set the infinite loop for new (now current) movie file
/bin/echo "loop 0 1" >/tmp/mpfc1
Getting the latter done felt like hacking, including getting thru player
code to understand the loop controls, and also using lsof to get current
file is not staight either.
This solution has one good thing - it really works well and does what is
requested. If you generate constantly new movies and need to play them
one after another, while looping the last one until next one is ready -
this works like a charm.
Now I do have also some questions
- will this keep on working - maybe there are upcoming developments that
would be breaking (fixing? ;-) the looping control and slave mode?
- is this the only way to make this work - or being less general - is
there a way to avoid waiting for the movie to start playing before
setting the infinite loop (without the wait it did not really work)?
- (not this list maybe) would code contributions in the area of slave
control be useful? i would be happy to contribute :)
--
pozdrawiam,
Marcin
More information about the MPlayer-users
mailing list