As a system administrator, you probably spend a lot of time at your terminal. We all have a tool that we begrudge having to leave the command line to use, whether it's for a web browser or a desktop GUI application.
If you poke around GitHub for long enough, you can find a command line utility to replace the graphical front end of just about every service out there, at least those with an accessible API. Some of these tools work better than others, of course, but a lot of them are worth poking around to see if they work for you.
Today we're going to look at three tools for enjoying sound and video at your Linux terminal: youtube-dl, mplayer, and cava. I originally profiled these tools as a part of my 24 Days of Linux Toys series on Opensource.com; a user there suggested that you might choose mpv as a suitable mplayer replacement, but I'll leave that up to the reader to explore and decide.
Listen to the radio
MPlayer is a versatile multimedia player that will support just about any media format you throw at it. If MPlayer is not already installed, you can probably find it packaged for your distribution. On Fedora, I found it in RPM Fusion (be aware that this is not an "official" repository for Fedora, so exercise caution as you would with any unfamiliar binary source):
$ sudo dnf install mplayer
MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh (88.1 WKNC; they're pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was:
$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3
MPlayer is open source under the GPLv3, and you can find out more about the project and download source code from the project's website.
Visualize your music
If you want to do more than just listen, and get a visual representation of what you're listening to, try cava. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. You can install cava much in the same way, through:
$ sudo dnf install mplayer
Watch a video
Finally, let's double down on our first tool, MPlayer, and add in one more, youtube-dl.
As its name would imply, youtube-dl is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with thorough documentation to make video acquisition easy. A note: please don't use youtube-dl in any context that would violate the copyright laws in your jurisdiction.
youtube-dl is licensed under a public domain dedication known as the Unlicense that's similar to Creative Common's CC0. There are some interesting legal opinions out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use.
In its simplest form, we're going to use youtube-dl to grab a video for playback in our terminal. First, install it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as:
$ sudo dnf install youtube-dl
Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace video from Gemmy's Videos available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large!
$ youtube-dl pec8P5K4s8c -o fireplace.mp4
You may need to install libcaca for your system if it's not already installed. If you just use MPlayer to launch the video from the command line as-is ($ mplayer fireplace.mp4), it will play, but in a window all of its own; not exactly what we were going for.
First, I set my libcaca settings to force it to use ncurses as the display driver, keeping the output in my terminal, with:
$ export CACA_DRIVER=ncurses
Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of libcaca and silencing text output from MPlayer):
$ mplayer -really-quiet -vo caca fireplace.mp4
And, there you go!
저자 소개
Red Hat Certified Engineer. Linux desktop enthusiast. Map/geospatial nerd. Raspberry Pi tinkerer. Data analysis and visualization geek. Occasional Pythonista.
유사한 검색 결과
Slash VM provisioning time on Red Hat Openshift Virtualization using Red Hat Ansible Automation Platform
Red Hat Ansible Automation Platform: Measuring Business Impact with Dashboard and Analytics
Technically Speaking | Platform engineering for AI agents
Technically Speaking | Driving healthcare discoveries with AI
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래