Raspberry Pi

How to Play Video from Terminal on Raspberry Pi

Raspberry Pi is a device that enables users to perform any activity, whether related to any computational task or using it for playing games. If you have the device, you can utilize it for multiple purposes. Users interested in playing video files on the Raspberry Pi terminal can do it easily by installing a lightweight media player called “mplayer”. It uses the command-line terminal to run your video files on the Raspberry Pi system.

This article is a detailed guide to play video from the terminal on Raspberry Pi using MPlayer.

How to Play Video from Terminal on Raspberry Pi

The MPlayer is a lightweight tool and you can install it on your Raspberry Pi system from its official repository using the following steps:

Step 1: Update Packages on Raspberry Pi

Before moving forward, let’s execute the following command to update pre-installed packages on the Raspberry Pi system.

$ sudo apt update && sudo apt upgrade

The command may take time so wait until it’s completed.

Step 2: Install MPlayer on Raspberry Pi

You can install MPlayer from the Raspberry Pi official repository through the following command:

$ sudo apt install mplayer -y

Step 3: Check MPlayer Installation

To confirm MPlayer is installed on Raspberry Pi, do apply the following command:

$ mplayer -v

Play Video from Terminal Using Mplayer

Now, to run any video from the terminal using MPlayer, follow the below-given command syntax:

$ mplayer <video_file_name>.format

In my case, I am playing a video file “my_video.mp4” through MPlayer, as shown in the image below.

You can also run the video file in full-screen mode using the following command syntax:

$ mplayer <video_file_name>.format

Use the left and right arrow keys from the keyboard to skip back or forward the video. Press the space button from the keyboard to pause the video or use the Esc button to close the video. For further help, you can apply the following command to enter the MPlayer help section.

$ mplayer -h

Remove MPlayer from Raspberry Pi

You can remove MPlayer from Raspberry Pi through the following command:

$ sudo apt remove mplayer -y

Conclusion

MPlayer is a lightweight command-line media player for playing video files from the terminal. This media player installation is simple since its repository is already included in the Raspberry Pi source repository list. After the installation, you can run your video files using the “mplayer” command with the file name you want to play.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.