AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Mplayer command line12/13/2023 ![]() Here, several methods are shown to install the VLC player on different Linux distributions. Later, we will use the VLC library plugins to play MP3 files by command line. ![]() Step 1: Install VLC Media Playerįirst, we will install the VLC media player on our Linux system. Here, in this method, we will use the ncurses media library function of the VLC player to open MP3 files by command line. As the VLC player uses an extensive amount of multimedia library codec, you can use those media library functions to open MP3 files by command line. Video Lan Client (VLC) media player is mostly used on Linux to watch movies and high-quality videos. Method 1: Use VLC Functions to Play MP3 by Command Line In this post, we will use the VLC media player, MPG123, and a few other tools to play MP3 audio files by command line on our Linux system. Moreover, some tools provide detailed information about the running MP3 file in the command shell. Most Linux users prefer the command-line-based user I/O method to operate their system. Using Linux with the command-line interface is preferable and hassle-free we can play MP3 files by the command-line interface. All in all, this might end up being something where the amount of time spent is not worth it, to be honest.Normally, we use different GUI-based media players to open MP3, mp4, and other multimedia files. I will continue looking into this but I would love to hear from someone if I made a mistake somewhere. I believe this has something to do with the way mplayer handles STDIN and is not the same thing as entering p to play or pause music. Again, just like before, any further inputs to the pipe will just change tracks. You will hear music start to play from mplayer. $ mplayer -playlist brutal_tunez.txt /tmp/mp3control.pipe Then start mplayer redirecting its STDIN to the named pipe. To start off, create a new named pipe anywhere in your filesystem. The main difference is that these are part of the filesystem and can be used to communicate between different terminal sessions. ![]() Named PipesĪlso called FIFOs, named pipes, just like regular pipes ( |), redirect output to other processes. However, even though I used p in my example, I have found that you can echo anything (including nothing) and it will still accomplish the same goal of changing the track no matter what you input. This has the effect of changing the tracks for mplayer. (Note, 0 refers to STDIN, 1 to STDOUT, etc.). ![]() Using this $PID, we can input what we want to STDIN for mplayer by redirecting it to /proc/$PID/fd/0. Make sure mplayer is actually running! $ pidof mplayer We can communicate with a process in a different terminal session by redirecting input to the process' file definitions directory at /proc/$pid/fd/ where $pid is the process' PID.įirstly, find the process ID using pidof. Explaining FIFOs is a little harder (I just recently learned of them) so I will do that last. I have found 2 ways so far: Using /proc/$pid/fd/0 and Named Pipes (FIFOs). However, I have been able to change tracks, at least in terms of going to the next track. I have not been able to find a way to play/pause tracks. I am actually in the middle of trying to do this exact thing! I am going to share what I have discovered so far in case it helps anyone.
0 Comments
Read More
Leave a Reply. |