Ubuntu: Video player with convenient API



Question:

I am trying to move from Windows to Ubuntu. I've find Linux alternatives to most of the programs except for Media Player Classic (MPC-HC) + AutoHotKey.

I am looking for a video player running on Linux and allowing to bind these these operations to hotkeys:

  • Save current file path (or track number) to clipboard (or append to a log file)
  • Increase/Decrease saturation/hue/brightness of this video
  • Set aspect ratio (AR)
  • Scale video to 200%
  • Toggle playlist, controls,...
  • Save playlist as.

I plan to write Python or Java Controller program to control player via an API. Ideally player should have an API to

  1. detect shortcut key and pass info to Controller
  2. retrieve information about Player's state
  3. execute Controller's command (frame step, reset width, jump to 11 min),..

VLC doesn't have change hue function.


Solution:1

Would a Lua or C API be suitable? mpv is, by my understanding, one of the more popular media players for Linux and it seems to be very full-featured in terms of integrability. https://mpv.io/manual/master/#command-interface


Solution:2

Linux autokey can detect keyboard events and execute relevant methods. Scripts are written in Python. VLC has a lot of hotkeys that you can set. This might be a way to go.

I don't think it can change hue though. You might have to convert videos elsewhere, which is a pain.


Solution:3

VLC can be controlled by sending console commands through pipes or TCP/IP telnet networking.

List of available commands (may change depending on version and plugins)

To allow this, enable rc interface in its configuration, or just start it like this:

your_program | vlc --extraintf rc  

...or if you wish it to only be controlable through API (no UI buttons like pause, rew...), replace --extraintf with --intf

If you want to both issue commands and get their results (i.e. know what's playing now), redirect both stdin and stdout via python or via shell

Alternatively this same command-line interface can be accessed via TCP (telnet):

vlc --extrainf rc --rc-host 127.0.0.1:12345  

where 127.0.0.1 is local IP address, and 12345 is TCP port number. Just connect to this address in your script and issue commands.

There's also somewhat more limited HTTP interface you could try.

More info on the VLC wiki: rc, console, http, interfaces


Solution:4

I am sorry, if you find this off-topic because of using non-native way, but you can install Wine to use MPC-HC.

Wine is a compatibility layer capable of running Windows applications on several operating systems.

About installation you can refer to https://wiki.winehq.org/Ubuntu


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »