18

I'm wondering if there is a way to watch films or images without running X server. I'm not using login manager - I log in to tty and start X server manually.

Hypothetical situation: I log in, but decide to only watch film, or maybe view few photos. I don't want to run X server and all the GUI stuff just for this purpose.

How can I watch films/images without X?

MatthewRock
  • 6,986

3 Answers3

14

For Images:

You can watch images with fbi:

NAME
       fbi - linux framebuffer imageviewer

SYNOPSIS
       fbi [ options ] file ...

DESCRIPTION
       fbi  displays  the  specified  file(s) on the linux console using the framebuffer device.  PhotoCD, jpeg, ppm,
       gif, tiff, xwd, bmp and png are supported directly.  For other formats fbi tries to use ImageMagick's convert.

Example command:

$ fbi path/to/file.jpg

For videos:

  • You can use vlc from tty/console:

    Example command:

    $ vlc /path/to/file.mp4
    
  • You can also use mplayer:

    $ mplayer /path/to/file.mp4
    

    Note: Video output drivers can be set by -vo option e.g caca, fbdev.(This external article may help)

Pandya
  • 24,618
4

It's availability depends on the kernel features, but by using the Linux framebuffer provided by the kernel (or Direct Framebuffer library, which allows hardware acceleration) it should be possible to play video on the console, too.

For example, using MPlayer: mplayer -vo fbdev filename.avi or mplayer -vo directfb filename.avi should do the trick if all the required pieces are in place. As pointed out in the other answer, vlc might be easier to get working and it also supports both the old FB and DirectFB.

Wikipedia article says the following about the framebuffer:

There are three applications of the Linux framebuffer.

  • An implementation of text Linux console that doesn't use hardware text mode (useful when that mode is unavailable, or to overcome its restrictions on glyph size, number of code points etc.). One popular aspect of this is the ability to have console show the Tux logo at boot up.
  • A possible graphic output method for a display server, independent of video adapter hardware and its drivers.

  • Graphic programs avoiding the heavy overhead of the X Window System.

The last item includes several Linux programs such as MPlayer, links2, Netsurf, fbida and libraries such as GGI, SDL, GTK+ and Qt Extended can use the framebuffer directly. This is particularly popular in embedded systems.

There is now a library DirectFB which provides a framework for hardware acceleration of the Linux framebuffer.

There's also a Q & A exactly on this topic on this very same forum, and of course the old Framebuffer HOWTO.

Most notably, you should have /dev/fb0 character device available (or more than one if there are multiple framebuffer devices available). At the bare minimum, the output of zcat /proc/config.gz |grep FB should contain CONFIG_FB=y, but I'm not quite sure if the modern GPUs with DRM also need a sort of a legacy driver to make FBDEV work (in my case, I seem to have CONFIG_DRM_I915_FBDEV=y for the Intel GPU).

zagrimsan
  • 766
0

You could run a super-light window manager based on wayland. For example I would recommend rootston (from the wlroots project). For example rootston -E vlc, you will get nothing else than vlc.

rootston has no menu, tray, clock, desktop, etc. There is nothing at all. However it is more of a proof of concept, and regularly crashes. It should be OK for watching a movie, though.

rootston is not based on X so it answers your question.

However for running application which are not compatible with wayland, Xwayland will be launched as a layer of compatibility and may contain X code.

If it's only the "GUI stuff" which bothers you, you could look into Openbox.

Rolf
  • 759
  • 2
  • 8
  • 16