Ulrich Scheller
Ulrich Scheller

Reputation: 11910

Show video on two screens with VLC

I want to set up a video client based on Ubuntu 16.04/Gnome/VLC 2.2.2. It should play a single video in fullscreen directly after boot on two screens. The video is controlled via VLCs web interface.

Everything is running fine on a single screen. However, with multiple screens I run into the problem that fullscreen mode only gets displayed on one of them.

There are several ways I tried to fix it:

1) Use normal fullscreen mode. Only shows the video on one screen

2) Use Wall Video filter as described here: http://windows7themes.net/en-us/stretch-videomovie-across-2-monitors/ This has multiple problems. More often than not, it does not show the video correctly. There is an output error in one of the windows. I also don't know how to automatically position these windows and get them into (pseudo) fullscreen mode. Reading some threads about this feature makes me think it is currently broken.

3) Resize the window to fill the whole screen (manually) This works in general. However, it still shows a window around the video and the desktop elements of Gnome. Is it possible to fix this and to size/position the video automatically on startup?

How can I get this to work?

Upvotes: 1

Views: 3071

Answers (1)

Ulrich Scheller
Ulrich Scheller

Reputation: 11910

After trying several ways, this is the solution I ended up with:

  • Split the video in two parts
  • Start two instances of vlc
  • Make each fullscreen on one of the screens
  • Give each vlc instance a different http port for controlling it
  • Copy the web interface of vlc into my own website (some javascript, images, css and html files)
  • Handle calls to "/requests/status.xml" on my webserver. This is what the vlc webinterface calls for getting the current status of the player and sending commands.
  • Forward the plain status.xml requests to one of the instances, forward everything with a command to both instances of vlc.

This is for starting two vlc instances in fullscreen:

vlc --http-port 8080 --http-password vlc123 --loop --video-x=0 --video-y==100 --fullscreen --qt-fullscreen-screennumber=1 '/path/to/my/video1' &

vlc --http-port 8090 --http-password vlc123 --loop --video-x=2000 --video-y==100 --fullscreen --qt-fullscreen-screennumber=2 '/path/to/my/video2' &

And here the CherryPy proxy:

class VlcProxy(object):
    @cherrypy.expose
    def index(self, **args):
        command_parameter = ""
        if args.has_key("command"):
            command_parameter = "?command=" + args["command"]
            if args.has_key("val"):
                command_parameter += "&val=" + args["val"]
            # if there is a command, send it to both running vlc instances
            url = videoclient_baseurl + ":8090/requests/status.xml" + command_parameter
            thread.start_new_thread(self.request, (url, "", "vlc123"))

        # if it is only a status, then one response is enough
        response = self.request(videoclient_baseurl + ":8080/requests/status.xml" + command_parameter, "", "vlc123")
        return response

It is not the clean & easy solution I expected, but it works fine so far. The downside is that you need to proxy the vlc calls and the videos could (in theory) run out of sync. However, in my scenario this never happened.

The good part is that the vlc webinterface is now part of my application. I don't need to update vlc if I just want to reposition a button.

Upvotes: 1

Related Questions