mplayer-linux

How to watch videos in Linux console with the help of MPlayer

mplayer-linuxLinux console is something really special: someone is afraid of it, someone can’t work without it, and someone listens to the radio and watches videos with the help of it. Agree, it may sound strange, but you may watch videos without GUI. And MPlayer will be your assistant. MPlayer is a powerful multimedia player for GNU Linux. You may ask what do we need that for? Well, the first reason is to show Linux capabilities, and then, you never know what you might need. So, here we go.

The first thing we need to do is to set up a framebuffer and add a user (the user which is registered in the system) in the group ‘video’ in order for MPlayer to be able to show media on your screen without asking  for administrative right every time. In order to do this we install MPlayer and fbi image viewer (for viewing images in the terminal):

sudo apt-get install mplayer fbi

Then we go on with the settings.

Framebuffer

Open the file blacklist-framebuffer with any text editor

sudo nano /etc/modprobe.d/blacklist-framebuffer

look for the line blacklist vesafb and put # symbol in front of it. As a result we get the following line: #blacklist vesafb. Save the changes in the blacklist-framebuffer file. After that open modules file.

sudo nano /etc/initramfs-tools/modules

and add the following lines at the end of the file:

fbcon
vesafb

and save the changes in the modules file. Then we reassemble initramfs image file by typing in the following command in the console:

sudo update-initramfs –u

Now we’re done with framebuffer. Let’s continue with the Grub.

Grub

Again we need to edit files in the text editor:

sudo nano /boot/grub/grub.cfg

and in the core option we add a parameter vga=789 to the following line:

linux   /boot/vmlinuz-3.0.3-20-generic root=UUID=hsar4s-7rks-9ee2-ad25-c6a33d5cb234 ro   quiet vga=789 splash

That’s it, we’re done with Grub. Don’t forget to save the changes (also, you may reboot your computer). If you have a large-format screen then you need to install hwinfo app:

sudo apt-get install hwinfo

and launch it with –framebuffer key:

sudo hwinfo –framebuffer

Choose the mode for your monitor that you need from the list and add it to the vga=xxx as described above in the core parameters.

Adding current user to the “video” group

It’s important to get system privileges in order not use sudo command every time:

sudo usermode –a –G video user_name

where user_name is your system login.

That’s all about the settings. Now let’s see how to watch videos and images in the console. To do that just launch the following command for video:

mplayer -vo fbdev2 film.avi

and for images:

fbi file.png file_1.png

That’s all. Now you can convert  your old PC into a DVD player and enjoy your favorite movies.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>