Play a Video in the Ubuntu Command Line

Configurare noua (How To)


In this article, we will explain how you can install the mplayer through your command line and then watch an .mp4 video through it.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system


Pasi de urmat

Installing the mplayer utility

The real capability of the mplayer

The Mplayer, when used with its GUI variant insead of the CLI, has the following features:

Mplayer is a movie player for Linux  although  it runs on many other platforms and CPU architectures. It plays most MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files, supported by many native and binary codecs. You can watch VCD, SVCD, DVD, Blu-ray, 3ivx, DivX 3/4/5, WMV and even H.264 movies, too. MPlayer supports a wide range of video and audio output drivers. It works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, libca‐ca, DirectFB, Quartz, Mac OS X CoreVideo, but you can also use GGI, SDL (and all their drivers), VESA (on every VESA-compatible card, even without X11), some low-level card-specific drivers (for Matrox, 3dfx and ATI) and some hardware MPEG decoder boards, such as the Siemens DVB, Hauppauge PVR (IVTV), DXR2 and DXR3/Hollywood+. Most of them support software or hardware scaling, so you can enjoy movies in fullscreen mode.

Mplayer Installation

The mplayer utility is easily available through the official Ubuntu repositories and can easily be installed through the command line using the apt-get command.

Open your Terminal application either through the system Application Launcher Search or through the Ctrl+Alt+T shortcut.

The next step is to update your system’s repository index through the following command:

$ sudo apt-get update

Update the package lists

This helps you in installing the latest available version of a software from the Internet. Please note that only an authorized user can add, remove and configure software on Ubuntu.

Now you are ready to install mplayer; you can do so by running the following command as sudo:

$ sudo apt-get install mplayer

Install Mplayer

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.

You can see all you can do with this application, and also verify that it is indeed installed on your system, through the following command:

$ man mplayer

Play Videos through the Mplayer

I will now explain how you can play a video saved to your system using the mplayer. This is the command syntax you can use:

$ mplayer -vo caca /location/of/file

The vo flag indicates that you want to play a video using the mplayer. The caca option means that you want to use the color text editor for displaying ASCII, thus playing a video in color. If you use the aa option instead, that would mean a black and white display which would be even sillier.

Here, I will be using the following command in order to play an mp4 video that resides in my /home/Videos/ directory:

$ mplayer -vo caca /home/Videos/SampleVideo.mp4

Here is what I could see in my Terminal:

Play Video on the Linux command line

Tip solutie



(11 din 17 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?