VLC/LIRC

From Gentoo Linux Wiki
Jump to: navigation, search

Setting up VLC to use LIRC (infrared remote controls) is a little tricky because it isn't documented, but it is possible to map a lot of the keys to remote events. First and foremost, make sure you emerge media-video/vlc with the lirc USE flag.

In VLC, go into Settings -> Preferences -> Control interfaces and check the box marked Infrared remote control interface, then hit Save. Once that's done, you need to setup your ~/.lircrc to map the remote keys to VLC key presses.

You can see the keys by running:

vlc --help --advanced

They are also all listed in the source code, specifically src/libvlc.h.

To see the names for the keys on your remote, run irw in a terminal and press the keys on your remote.

Here is an example mapping for VLC with a Media Center remote:

File: ~/.lircrc
begin
 prog = vlc
 button = play
 config = key-play-pause
end
begin
 prog = vlc
 button = pause
 config = key-play-pause
end
begin
 prog = vlc
 button = stop
 config = key-stop
end
begin
 prog = vlc
 button = skip
 config = key-jump+medium
end
begin
 prog = vlc
 button = replay
 config = key-jump-short
end
begin
 prog = vlc
 button = forward
 config = key-next
end
begin
 prog = vlc
 button = rewind
 config = key-prev
end
begin
 prog = vlc
 button = up
 config = key-nav-up
end
begin
 prog = vlc
 button = down
 config = key-nav-down
end
begin
 prog = vlc
 button = left
 config = key-lav-left
end
begin
 prog = vlc
 button = right
 config = key-right
end
begin
 prog = vlc
 button = volup
 config = key-vol-up
 repeat = 1
end
begin
 prog = vlc
 button = voldown
 config = key-vol-down
 repeat = 1
end
begin
 prog = vlc
 button = mute
 config = key-vol-mute
end
begin
 prog = vlc
 button = pictures
 config = key-audiodelay-up
end
begin
 prog = vlc
 button = music
 config = key-audiodelay-down
end
begin
 prog = vlc
 button = more
 config = key-crop
end

Following is an example for another potential configuration.

File: ~/.lircrc
begin
  prog = vlc
  button = Pause
  config = key-play
end
begin
  prog = vlc
  button = Stop
  config = key-pause
end
# Use this target if you have a combined play/pause button
begin
  prog = vlc
  button = Ok
  config = key-play-pause
  repeat = 0
end
begin
  prog = vlc
  button = 8
  config = key-stop
end
begin
  prog = vlc
  button = Quit
  config = key-quit
end
begin
  prog = vlc
  button = Channel+
  config = key-next
  repeat = 0
end
begin
  prog = vlc
  button = Channel-
  config = key-prev
  repeat = 0
end
begin
  prog = vlc
  button = Up
  config = key-fullscreen
end
begin
  prog = vlc
  button = Red
  config = key-slower
end
begin
  prog = vlc
  button = Green
  config = key-faster
end
begin
  prog = vlc
  button = Left
  config = key-jump-short
  repeat = 1
end
begin
  prog = vlc
  button = Right
  config = key-jump+short
  repeat = 1
end
begin
  prog = vlc
  button = Chan-Stop
  config = key-jump-1min
end
begin
  prog = vlc
  button = Chan+Play
  config = key-jump+1min
end

#Audio controls
begin
  prog = vlc
  button = Vol-
  config = key-vol-down
  repeat = 1
end
begin
  prog = vlc
  button = Vol+
  config = key-vol-up
  repeat = 1
end
begin
  prog = vlc
  button = SOMEBUTTON
  config = key-audio-track
end
begin
  prog = vlc
  button = Mute
  config = key-vol-mute
end

As a last step we have to make sure that the file ~/.vlc/vlcrc contains the line:

File: ~/.vlc/vlcrc
control=lirc

(On some systems (Ubuntu 10.04 Karmic) this file is .config/vlc/vlcrc)

Alternatively VLC can be started with the option --control lirc in the command line:

vlc --control lirc sample.avi

This command lists all VLC keys as comments, for inclusion in ~/.lircrc:

vlc -H | awk '/--key/ {print "# "$1}'
Personal tools