Multi-Monitor Video Script

Posted by zbrom on August 01, 2013 · 2 mins read

Here is a simple script that allows you to play video synced on two screens using mplayer. The script allows the user to select the video they would like to play from a specific folder.

Ensure you have mplayer installed; it should be readily available from your package manager.

Copy the code into your favorite text editor.


#! /bin/bash
# - 2012

#find out who the user is

#USER CONFIG: change this to match your path to videos

echo ""

#display list of videos
ls $path
echo ""

echo "Enter the name of the video you would like to play, include extension."
echo ""
read "video"

#launching the video with multimonitor support. Define one monitor as -xineramascreen 0 and the other as -xineramascreen 1; -nosound indicates the second video will be muted to avoid distortion.
mplayer -xineramascreen 0 -fs -framedrop "$path""$video" & mplayer -xineramascreen 1 -fs -framedrop -nosound "$path""$video"

You first need to define the path to your video directory, by editing this line in the code:


Save your file and place it in a directory that is easily accessible. I currently have mine placed in the bin folder in my home directory. You can also place it in the /usr/bin directory if you like.

Make the script executable by running the following command in terminal, with the correct path to the script.

chmod +x [path to file]