HOWTO VLC

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

[edit] Introduction

VLC (initially VideoLAN Client) is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, ...) as well as DVDs, VCDs, and various streaming protocols. It can also be used as a server to stream in unicast or multicast in IPv4 or IPv6 on a high-bandwidth network.

This HOWTO will help you get the VideoLAN client (VLC) running on your system.

[edit] Prerequisite

If you wish to have a nice GUI interface for which to control VLC, then we need to take care of a dependency, first. If you do not want a GUI interface, then you can skip this step and go straight to installation -- but you must remove the "X" use flag.

Add this to package.use for x11-libs/wxGTK.

echo "x11-libs/wxGTK unicode X" >> /etc/portage/package.use

or with flagedit:

flagedit x11-libs/wxGTK +unicode +X

Then we must re-emerge wxGTK with our new use flag:

emerge -av x11-libs/wxGTK

[edit] Installation

The first thing we want to do is setup our keywords and use settings for vlc. The first thing we'll do is enable the ~x86 (or whichever architecture you're using, eg. ppc) mask for vlc.

To do this we run:

echo "media-video/vlc ~x86" >> /etc/portage/package.keywords

Or with flagedit:

flagedit media-video/vlc  -- +~x86

This will enable us to use the most up to date (and possibly experimental) version of vlc.


[edit] USE flags

The next thing we'll want to do is set up our USE flags for vlc. This is the most important part of setting up our system to use vlc. If we skimp on the USE flags we set, we won't have a vlc capable of playing many file formats.

Pick the USE flags you want, and then add them to package.use for media-video/vlc.

echo "media-video/vlc X a52 alsa dts dvd ffmpeg mp3 mpeg win32codecs ncurses opengl sdl skins truetype wxwindows xv" >> /etc/portage/package.use

or with flagedit:

flagedit media-video/vlc +X +a52 +alsa +dts +dvd +ffmpeg +mp3 +mpeg +win32codecs +ncurses +opengl +sdl +skins +truetype +wxwindows +xv

[edit] VLC recommended flags

If you would like to know what the folks who built VLC player recommend for installing VLC visit this link: http://www.videolan.org/vlc/download-gentoo.html

To be able to emerge with the flags from the link above, wxGTK has to be compiled with the unicode and X USE flags.

echo "x11-libs/wxGTK unicode X" >> /etc/portage/package.use

Here is an incomplete list of available flags:

[edit] Audio and video codecs

  • dts Enables libdts (DTS Coherent Acoustics decoder) support
  • live enables Live.com streaming media support
  • matroska adds support for playback of Matroska-container audio/video files
  • theora to play Ogg Theora video files
  • vorbis Adds support for the Ogg Vorbis audio codec
  • win32codecs installs the binary codecs **

[edit] Audio and video output

  • aac adding this USE flag *should* add support for MP4/AAC audio (typically the audio stream used in H.264-encoded movies). By default, it will be ignored even if included as a USE flag. The solution is to first build ffmpeg with the aac flag (simply add it to /etc/make.conf if you like), and then build VLC with mpeg. See this Gentoo forum post for more details on this.
  • aalib adds support for ASCII output (see libcaca for color)
  • alsa adds support for ALSA (Advanced Linux Sound Architecture) audio output/recording
  • arts adds support for audio output through aRts
  • esd adds support for audio output through EsounD
  • fbcon adds framebuffer output option for video
  • ggi adds support for the LibGGI graphics card drivers
  • libcaca adds support for color ASCII output (see aalib for non-color ASCII)
  • opengl lets you use OpenGL for video output
  • oss adds OSS audio output/recording support
  • png snapshot support(?)
  • sdl adds SDL (Simple Direct Layer) as an audio and/or video output wrapper
  • speex Adds support for the speex audio codec
  • svga adds framebuffer support through SVGAlib
  • xinerama adds support for dual-screen output
  • xv direct video output format
  • x264 adding this USE flag adds support for H.264 MPEG4 which can be used to view encoded movies suitable for Playstation 3

[edit] Hardware support

  • 3dfx Adds support for 3dfx video cards
  • dvd will let you play DVDs
  • joystick enables joystick support
  • lirc uses LIRC library for remote controls
  • v4l to watch/record TV (see also dvb)

[edit] Interface

  • ncurses a command-line interface
  • skins adds support for GUI skins
  • wxwindows will also install an VLC gui (using WxGTK)
  • xosd Sends display using the X On Screen Display library
  • lirc adds support for lirc
  • http Web frontend
  • telnet Telnet interface to vlm
  • rc TCP, socket, and pipe based interface to vlc and vlm

[edit] Optional features

  • bidi adds support for FriBiDi libraries
  • ipv6 adds support for IPv6
  • samba enables Samba input support

[edit] Emerge

The last step in installing vlc is the actual emerge of the software itself.

To do this, we run:

File: Command
emerge -av vlc

The -av command line option will give us the option to review our settings and optionally cancel the install.

[edit] Using VLC

Now you can run vlc from the command line like:

File: Command
vlc mediafile.ext

[edit] LIRC

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.

Next, open a copy of 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 keypresses. (n00b to a n00b note: ~/.lircrc is a text file named .lircrc in your home directory. you can create/edit this by running(alt+f2): gedit .lircrc)

You can see some of the keys by running vlc --help --advanced. They are also all listed in the source code, in src/libvlc.h.

And to see the names for the keys on your remote, type irw in Konsole and press the keys on your remote.

For your convenience, here's the most recent key listing:

  • key-fullscreen
  • key-play-pause
  • key-pause
  • key-play
  • key-faster
  • key-slower
  • key-next
  • key-prev
  • key-stop
  • key-position
  • key-jump-3sec
  • key-jump+3sec
  • key-jump-10sec
  • key-jump+10sec
  • key-jump-1min
  • key-jump+1min
  • key-jump-5min
  • key-jump+5min
  • key-nav-activate
  • key-nav-up
  • key-nav-down
  • key-nav-left
  • key-nav-right
  • key-disc-menu
  • key-title-prev
  • key-title-next
  • key-chapter-prev
  • key-chapter-next
  • key-quit
  • key-vol-up
  • key-vol-down
  • key-vol-mute
  • key-subdelay-up
  • key-subdelay-down
  • key-audiodelay-up
  • key-audiodelay-down
  • key-audio-track
  • key-subtitle-track
  • key-intf-show
  • key-intf-hide
  • key-snapshot
  • key-set-bookmark1
  • key-set-bookmark2
  • key-set-bookmark3
  • key-set-bookmark4
  • key-set-bookmark5
  • key-set-bookmark6
  • key-set-bookmark7
  • key-set-bookmark8
  • key-set-bookmark9
  • key-set-bookmark10
  • key-play-bookmark1
  • key-play-bookmark2
  • key-play-bookmark3
  • key-play-bookmark4
  • key-play-bookmark5
  • key-play-bookmark6
  • key-play-bookmark7
  • key-play-bookmark8
  • key-play-bookmark9
  • key-play-bookmark10
  • key-history-back
  • key-history-forward
  • key-record

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

Download this file here

[edit] Matroska

VLC also has the best support of all the media players for Matroska. Matroska is an open-source multimedia container format (similar, but far superior, to AVI) which can store things like DVD menus and chapters.

If you create a Matroska file with chapters, then you can program your remote to skip ahead and forward with the keys above.

[edit] Command Line Examples

Code: General structure
vlc -vvv --color <Input Selection> \
         --sout '#<Encoding selection>:<Output selection>'
Code: Input selection examples
v4l:/dev/video0:norm=pal:channel=1:adev=/dev/dsp:audio=1
Code: TV specific input modifiers
channel=1 // composite, depends on your hardware
audio=1 // stereo
Code: Encoding selection examples
transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256, \
         venc=ffmpeg{keyint=80,hurry-up,vt=800000},deinterlace}
Code: Output selection examples
# UDP multicast, connect with 'vlc udp://@239.255.12.13'
std{access=udp,mux=ts,url=239.255.12.13}

# multicast and local display
duplicate{dst=display,dst=std{access=udp,mux=ts,url=239.255.12.13}

# record stream and view locally
duplicate{dst=display,dst=std{access=file,mux=ts,url="/tmp/a.avi"},
std{access=http,mux=ts,url=192.168.1.1:1234} }
Code: More command line arguments
--ttl 12 // useful for multicasts

[edit] Server Examples

Code: VLC as a programmable personal media server
#Use http://yourhost:8080 to access
nohup vlc -I http & tail -f nohup.out

Start it in your media directory and you can add those files to the playlist
through the web interface.

Press <ctrl-c> to stop the tail and get back to the command prompt, vlc continues in the background.

Use pgrep -fl vlc to verify and pkill vlc or killall vlc to kill

Code: VLC as a programmable personal media server
# separate vlc media display server instance
# reachable at http://yourhost:8081
nohup vlc -I http --http-host :8081 --loop udp: & tail -f nohup.out

# To see the video. Run in foreground.
vlc --loop udp:

Listens for content on UDP port 1234.

Press <ctrl-c> to stop the tail

Code: play your media remotely a la AirTunes to the preceding server
vlc <input> --sout '#std{access=http,mux=ts,url=yourhost:1234}' 

[edit] Notes

  • Some stuff like selecting a TV norm or a composite input seems to work only from the command line.
  • On Gentoo, install the ffmpeg package. It contains a lot of media support. Maybe it's best to add 'ffmpeg' to the USE variable in /etc/make.conf.
  • With latest ffmpeg the problem occured that no codec is found. Workaround is to emerge an older version of ffmpeg (adding >media-video/ffmpeg-0.4.9_p20070330 to /etc/portage/package.mask should do the trick).
  • To get a reasonable media format support for VLC under Gentoo, you may need to adjust your /etc/portage data. My current USE setup for the VLC package is:
Code: /etc/portage/package.use
media-video/vlc stream screen httpd vlm cdda cdio cddb freetype \ dts mod ogg vorbis theora xv x11 ffmpeg mad aac a52 \ dts mpeg live ssl bidi flac matroska

[edit] See Also

[edit] Troubleshooting

[edit] VLC shows no video for divx/xvid

Check your version of ffmpeg. If it's media-video/ffmpeg-0.4.9_p20070616 (or "-r1") try to add the following

File: /etc/portage/package.mask
=media-video/ffmpeg-0.4.9_p20070616*

and then re-emerge ffmpeg and vlc.

If previous version of ffmpeg is missing in portage, try to run:

emerge -C ffmpeg
emerge -uDNav ffmpeg
emerge -uDNav vlc
revdep-rebuild

[edit] TODO

What still needs to be done:

  • Add some more detailed information about VLC
  • Show some more and better examples of VLC usage
  • Complete the playing and stream serving information
  • Troubleshooting tips are always nice
  • Add some tips about dvb usage
  • Subtitle support (?)
Personal tools