15

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?

11

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)

  • @MatthewRock Have you tried vlc without X session? – Pandya Sep 2 '15 at 11:01
  • Works without X. Nice! – MatthewRock Sep 2 '15 at 21:02
  • 2
    You must have permission to write to /dev/fb0. So either sudo, or sudo usermod -aG video $USER. Or else fbi fails, and vlc renders ASCII art. Maybe audio group is also needed. – Ciro Santilli 新疆改造中心996ICU六四事件 Aug 28 '16 at 18:31
3

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).

-1

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.

Also note that for running X11 applications, rootston would launch Xwayland which is like an invisible mini-X-server running in the background.

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

  • I offered a valid answer to the question "How to watch films/images without X?". rootston is not based on X but on wayland instead. Yet I get downlvoted with no explanation. This is ungrateful, inconsiderate and rude and it makes me feel angry. – Rolf Oct 19 '18 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.