I want to be able to play quality video from a text console. I have two options set up, neither of which is ideal:

  1. I have mplayer set up to use the -vo fbdev2 option, which I understand to directly use a frame buffer provided by linux. This works, but it is not the best quality.

  2. I have a script that changes to tty 7 to play the video and then changes back. I thereby get the quality of X, but there are a few issues:

The problems with the second method are as follows.

  1. If I am not logged into a gui session on tty7 the video does not show (I just stare at the login screen).

  2. The contents of the gui session are flashed when the player is done. Not a big deal, but it just looks cludgy.

  3. If I change tty's during the video, I get pulled back to the tty that started the video when the video is done playing.

I would like to play a video from a text console (tty1-6) using X. As far as I can tell, that is the only way to get quality video and have it act like it is playing in the console I am using.

Any advice on how to set up a text console to launch mplayer in X would be much appreciated!

NOTE 1: I think an old install I had of Ubuntu 14 did this automatically when mplayer was called, as mplayer played with good quality from text console. I no longer have that setup to verify.

NOTE 2: What happens when I just call mplayer with vo -x11 is that it can not find a display, as DISPLAY is not set. The only valid value for DISPLAY is :0[.0], and when I use that display the video plays in tty7 but taking stdin from the tty that called the video.

NOTE 3: I am running Ubuntu Mate 16.04.1, amd64, and experience the same problem on multiple such systems with varying video cards.

  • Awesome! mpv with -vo drm worked and definitely looked better than mplayer with -vo fbdev2 (despite not being hardware acel). Can you please enlighten me as to why that worked? Also, the second option, with hardware acceleration, failed in mpv. It said it failed to set the command line option. Is there an extra dependency for that second option?
    – Kyle
    Commented Aug 4, 2016 at 23:06
  • I've turned my comments in to a proper answer, and also given a few hints about actually getting X11 to do what you want as well.
    – derobert
    Commented Aug 5, 2016 at 0:38

1 Answer 1


Turning my comment in to an answer:

My best recommendation is to use mpv, which supports video-out drivers (and a lot more!) that AFAIK mplayer does not. Although mplayer development has recently seen some activity, for a long time (mplayer 1.1: June 2012; 1.2: October 2015) it was effectively dead. mpv, on the other hand, has had consistent releases since its first one in August 2013; it's honestly far ahead of mplayer at this point.

With mpv, you can directly use the kernel's mode setting and direct rendering manager (DRM) with mpv -vo drm FILE. This should provide full-quality, fully-resolution output, but without hardware acceleration (I don't believe fbdev2 ever had hardware acceleration). If your mpv is compiled with it, you can also use OpenGL/DRM output (which is hardware accelerated): mpv -vo opengl:backend=drm-egl FILE. You can check by seeing which backends are listed by mpv -vo opengl:backend=help

Alternatively, you can run an X server without a desktop environment. For example, depending on how your distro has configured things permissions-wise, you may be able to start an X server running just mplayer (and exiting when mplayer quits) using something like this:

startx /usr/bin/mpv FILE -- :1 # full path required; runs w/o xterm
startx -e mpv FILE -- :1       # runs it inside an xterm, which you'll probably see flicker on screen at start/exit.

You could of course use something like $(command -v mpv) to get the full path for the first form. That starts up display :1, runs mpv on it, and then shuts down the X server when mpv is done (I tried with mplayer, but it didn't work on my machine—given, possibly mplayer is just broken on my machine, I haven't used it since switching to mpv). You could also leave an X server running w/o a desktop environment. You may find something like nodm useful to start an X server w/o the desktop environment.

  • So how might one recompile with OpenGL/DRM output support? I'm kind of new to this sort of thing. You can not do it using apt-get, can you?
    – Kyle
    Commented Aug 5, 2016 at 0:50
  • @Kyle It is indeed non-trivial... I suspect we already have a question on how to rebuild programs. apt-get can actually do a lot of the work for you (mainly, it can install all the dependencies)
    – derobert
    Commented Aug 5, 2016 at 0:55
  • 1
    @Kyle Basic instructions to recompile a Debian package are here: unix.stackexchange.com/questions/117503/… — you may want to ask a question specific to recompiling mkv w/ drm-egl though.
    – derobert
    Commented Aug 5, 2016 at 0:56
  • Sorry to have so many follow up questions, but is hardware acceleration likely to improve video quality, or is it generally only useful when there is jumping/skipping without it?
    – Kyle
    Commented Aug 5, 2016 at 1:28
  • 1
    @Kyle some of the opengl stuff can improve video quality, on sufficiently fast hardware (e.g., it can help smooth out low-framerate and framerate that doesn't match your display by blending adjacent frames, and there are shaders to do better scaling, denoising, etc.) But mostly it's to use less CPU to help playing back e.g., 1080p or 4k video on slower CPUs. Often uses less power (watts) as well, useful on laptops.
    – derobert
    Commented Aug 5, 2016 at 1:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .