Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I start a VLC instance from python bindings on a specific display?

I want to code a snippet / module in python that opens up a VLC player on a specific display / monitor and plays a specific file.

I use the package python-vlc, and I succesfully managed to play a video file using the package:

    import vlc

    vlc_options = "--embedded-video --no-audio --fullscreen"
    vlc_instance = vlc.Instance(vlc_options)
    # vlc.Instance.url = filepath

    player = vlc_instance.media_player_new()
    player.set_mrl(filepath)
    player.set_fullscreen(True)
    player.play()

    while True:
        pass

I searched everywhere in the documentation but I did not find anything useful, on how I could choose a specific display to start the media instance on.

https://www.olivieraubert.net/vlc/python-ctypes/doc/
https://wiki.videolan.org/python_bindings

And neither succeeded using the CLI commands:
https://wiki.videolan.org/VLC_command-line_help/

like image 778
Alex M.M. Avatar asked Jun 11 '26 11:06

Alex M.M.


1 Answers

What I found is the following: To some extent you might have some luck to control this by going to Tools --> Preference --> Video --> Fullscreen Video Device --> Here you choose the display you want in VLC software. It depends as well on the output mode. You need to try them.

like image 172
Baraa Avatar answered Jun 14 '26 02:06

Baraa