A new window will open showing the video (in this case the video “What is Kubernetes’ ‘ from LinuxHint’s Youtube channel.
With your keyboard arrows you can manage the video position and you can pause it with your Space key on the keyboard.
Playing remote media from websites from Linux terminal:
Now you’ll see how to play videos from websites in your Linux terminal. The first way using mplayer is almost obsolete and only allows playing videos without SSL certificates, later you’ll see how to play videos on secured websites. To continue we need to edit the mplayer configuration file in the user home we are playing with. With nano or any text editor edit the file located at <YourHome>/.mplayer/config
In my case:
Within the configuration file add the line:
As shown below:
Press CTRL+X and Y to save and exit.
Now we can test it:
And the video shows up.
Another terminal media player is mpv which is based on mplayer, to install it on the terminal run:
Once installed to play a video just run:
In this case:
To play remote media files, for example for Youtube we need a workaround first, on the terminal run:
Playing remote videos from a specific timestamp is also possible with Mpv using the following syntax:
The command above will play the specified video form the minute 5. You can edit the start time by editing the –start=05:00 option.
By pressing the key f, you can make the video Full screen, you can restore the default size by pressing the f again or ESC, these options are the same for Mplayer. By pressing Ctrl + and Ctrl – you can increase and decrease the audio speed, it is useful when the audio and video speed don’t match. With keys r and t you can change the subtitles position.
Additional terminal media players:
Another option to play media from the Linux console is mpg123, You can install it by running:
There are also exclusive music players, without support for videos such as Music Player Daemon.
Playing videos from terminal is a good solution, yet the default program configurations fail to play most popular video websites such as Youtube, all users from all OS, Windows, MacOS and Linux, for which the mentioned programs are available, report difficulties with customized solutions to achieve terminal remote playing. For ssh sessions the best option remains to copy the media files into the local device to play.
For remote playing videos, troubleshooting process includes editing the /etc/.config/mpv/mpv.conf with “no-ytdl”, if necessary you will need to create mpv’s configuration file. In other cases the no-ydl will need to be disabled to play, this option is used to bypass the built-in ytdl_hook.lua file which sometimes brings problems. You may also need to downgrade your ytdl, you can achieve it by running “sudo pip install youtube_dl==2017.07.30.1”.
Vlc Player, despite isn’t a terminal video player, remains the best option for remote media playing, if you need help with VLC LinuxHint has 2 clear articles for you to read at https://linuxhint.com/install-vlc-media-player-2-2-x-linux/ and https://linuxhint.com/vlc-media-player-for-linux/.
I hope you found this tutorial on Playing media in Linux terminal useful. Keep following LinuxHint for more tips and updates.