Skip to main content

A Python library for remote control of VLC media player via its RC interface.

Project description

VLC Remote Control

A Python library for controlling VLC media player via its Remote Control interface.

Features

  • Control playback: play, pause, stop, next, previous.
  • Playlist management: add, view, clear, repeat, loop, random.
  • Volume control: get and set the volume.
  • Audio device management: get and set the active audio device.
  • Command Line Interface (CLI) support.

Requirements

Installation

0. Install VLC media player

Download the installer at https://www.videolan.org/vlc/

1. Ensure the RC Interface is Enabled

From the VLC UI

  1. Open VLC and navigate to Tools -> Preferences -> Show settings: All.
  2. Under Interface -> Main Interfaces, select RC.

From the Command Line (Optional, but Recommended)

OS Command
Windows vlc --extraintf rc --rc-host=HOST:PORT
Linux vlc --extraintf oldrc --rc-fake-tty --rc-host=HOST:PORT

Note: Ensure the specified port (e.g., PORT) is open in your firewall. For more details, refer to the VLC command-line help.

2. Install vlcrc

python -m pip install vlcrc

Usage

Python Library

from pathlib import Path
from vlcrc import VLCRemoteControl

# Create a VLCRemoteControl instance
vlc = VLCRemoteControl("127.0.0.1", 50000)

# Add a file to the playlist
vlc.add(Path("/path/to/media/file.mp4"))

# Play media
vlc.play()

# Get the current playlist
playlist = vlc.playlist()
print(playlist)

# Get and set volume
current_volume = vlc.get_volume()
print(current_volume)
vlc.set_volume(100)

# Get audio devices and set an active one
devices = vlc.get_adev()
print(devices)
vlc.set_adev(devices[0].id)

Available Commands

Command Description
add Add a file to the playlist.
playlist Get the current playlist.
play Play the current media.
stop Stop playback.
next Skip to the next media in the playlist.
prev Skip to the previous media.
goto Go to a specific playlist index.
repeat Toggle playlist item repeat.
loop Toggle playlist loop.
random Toggle playlist random jumping.
clear Clear the playlist.
status Get the current status of the player.
pause Pause or resume playback.
get_volume Get the current audio volume.
set_volume Set the audio volume (0-320).
get_adev Get a list of available audio devices.
set_adev Set the active audio device.
quit Quit VLC.

Command Line Interface (CLI)

usage: vlcrc [-h] [--timeout TIMEOUT] host port {play,stop,next,prev,clear,status,pause,repeat,loop,random,playlist,quit,add,goto,volume,adev} ...

Command Line Interface for VLC Remote Control

positional arguments:
  host                  VLC host address (e.g., 127.0.0.1, 192.168.1.100)
  port                  VLC Remote Control interface port
  {play,stop,next,prev,clear,status,pause,repeat,loop,random,playlist,quit,add,goto,volume,adev}
                        Commands
    play                play command
    stop                stop command
    next                next command
    prev                prev command
    clear               clear command
    status              status command
    pause               pause command
    repeat              repeat command
    loop                loop command
    random              random command
    playlist            playlist command
    quit                quit command
    add                 Add file to playlist
    goto                Go to specific track
    volume              Get/set volume
    adev                Audio device control

options:
  -h, --help            show this help message and exit
  --timeout TIMEOUT     Connection timeout in seconds (default: 1.0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vlcrc-1.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vlcrc-1.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file vlcrc-1.1.0.tar.gz.

File metadata

  • Download URL: vlcrc-1.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for vlcrc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6cb1e33142d3881faacc4b14fac7e27b47bf34c8bce358ae108b0c87a061e0ab
MD5 fb77ace609b4be6a8dc609a3a86dae7b
BLAKE2b-256 71aea62071a2ff28fa78e1fb07b03bbf54d30b1ddd3fdfa6a506f6703788df15

See more details on using hashes here.

File details

Details for the file vlcrc-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: vlcrc-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for vlcrc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02c9c799d20156b93cffc276c0c07d2f1ac425e6361b6812eba9129a2c64060f
MD5 b29aa4966e62e48e39f8f41fcc9d9ea2
BLAKE2b-256 a138e0ab21ad8abfebf3efea8d3d49c0a488e24bc3b568bbd39f9a2da687e8a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page