File Exchange

image thumbnail

VLC

version 1.1.0.0 (4.66 KB) by Léa Strobino
A class to control VLC from MATLAB through HTTP

11 Downloads

Updated 30 May 2018

GitHub view license on GitHub

Control VLC from a MATLAB script
VLC actions such as play, pause, stop, next, previous, etc. are defined as class methods. VLC settings such as Loop, Random, Repeat and Fullscreen are exposed to MATLAB and can be accessed with set() and get(). Informations about the current file can be retrieved through the 'Current' property (length, position, metadata, etc).

Methods:
add('file'): add "file" to the playlist
play() or play('file'): resume playback or play "file"
pause(): pause playback
stop(): stop playback
next(): play next track
prev(): play previous track
seek(position): seek to position (in seconds)
move(x,y): move item ID x in the playlist after item ID y
remove(x): remove item ID x from the playlist
clear(): empty the playlist
quit(): quit VLC and delete object

Properties:
Port (read only)
Version (read only)
Status (read only)
Current (read only)
Playlist (read only)
Loop
Repeat
Random
Fullscreen
Rate
Volume

Example:

>> v = VLC()

v =

VLC with properties:

Port: 4212
Version: '2.2.8 Weatherwax'
Status: 'stopped'
Current: []
Playlist: [1x1 struct]
Loop: 'off'
Repeat: 'off'
Random: 'off'
Fullscreen: 'off'
Rate: 1
Volume: 256

>> v.play('/Users/Lea/Desktop/3905.aif')
>> v

v =

VLC with properties:

Port: 4212
Version: '2.2.8 Weatherwax'
Status: 'playing'
Current: [1x1 struct]
Playlist: [1x1 struct]
Loop: 'off'
Repeat: 'off'
Random: 'off'
Fullscreen: 'off'
Rate: 1
Volume: 256

>> v.Current

ans =

ID: 4
Length: 77.0903
Meta: [1x1 struct]
Position: 8.8021

>> v.stop()

Cite As

Léa Strobino (2020). VLC (https://www.github.com/leastrobino/matlab-vlc), GitHub. Retrieved .

Comments and Ratings (4)

Hi Léa ,

Thank you for your contribution!

Can you adapt your code so that you can control/change the playback speed during the playback of a video file?

An example of this would be very useful!

Best wishes,
Stav

This class provides a simple mean to control VLC from a MATLAB script or app.

VLC actions such as play, pause, stop, next, previous, etc. are defined as class methods.
VLC settings such as Loop, Random, Repeat and Fullscreen are exposed to MATLAB and can be accessed with set() and get() for example.
Informations about the current file can be retrieved through the 'Current' property (length, position, metadata, etc).

More detailed example:

>> v = VLC()

v =

VLC with properties:

Port: 4212
Version: '2.2.2 Weatherwax'
Status: 'stopped'
Current: []
Playlist: [1x1 struct]
Loop: 'off'
Random: 'off'
Repeat: 'off'

>> v.play('/Users/Lea/Desktop/3905.aif')
>> v

v =

VLC with properties:

Port: 4212
Version: '2.2.2 Weatherwax'
Status: 'playing'
Current: [1x1 struct]
Playlist: [1x1 struct]
Loop: 'off'
Random: 'off'
Repeat: 'off'

>> v.Current

ans =

ID: 4
Length: 77.0903
Meta: [1x1 struct]
Position: 8.8021

>> v.stop()

Ikko

Seems interesting, but could you explain a bit more how to use this??

Updates

1.1.0.0

Added
- playback rate control
- volume control
- playlist reordering
- documentation

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags