It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Just wondering what the best Linux program for playing a single audio file is.

Here are my requirements:
* Must be open source
* Must be in the repos of all major Linux distributions
* Must be in the Raspberry Pi OS repos
* Must not require xorg or wayland, or any graphics hardware at all, to run
* Should support all major audio formats. WAV, OGG, and FLAC are required for my purposes.
* If given a single audio file on the command line, it should play that file, and then exit. (The task of finding an audio file to play should not be handled by this program.)

So, what program would you suggest? I know mplayer fits these requirements, but are there any others? (mpv will fail if xorg isn't running unless a command-line argument is used to disable video, while vlc/clvc don't exit after playing the track.)

Edit: Why the low rating?
Post edited March 12, 2021 by dtgreene
wtp
Post edited March 13, 2021 by darktjm
you can set vlc to quit after its finished playing.
avatar
Sachys: you can set vlc to quit after its finished playing.
How?

(Remember that this needs to work from the command line without xorg/wayland available.)

Also, does anyone have any similar recommendations for Android? (Here I require that it allows browsing by folder, can play just one track and then stop (instead of going onto the next), is open source, is available somewhere other than Google Play, and I would prefer for it to *not* have network access.)
avatar
dtgreene: How?

(Remember that this needs to work from the command line without xorg/wayland available.)
well, i have no idea on command lines (as a linux newbie) and (to me) its a new feature... but you do understand those things, so im sure if that function is there in the linux version you can find it through a more linux specific forum / site.
avatar
dtgreene: Also, does anyone have any similar recommendations for Android?
same thing on android, though i havent checked about network access. in this case it was clicking the three dots (at least on MY phone) and selecting the option. same with the sleep timer.

Edit: thats interesting. VLC requires no network permissions on android (on my phone at least) yet can scan my laptop (which is otherwise invisible). Thats not good!
Post edited March 12, 2021 by Sachys
avatar
dtgreene: Just wondering what the best Linux program for playing a single audio file is.

Here are my requirements:
* Must be open source
* Must be in the repos of all major Linux distributions
* Must be in the Raspberry Pi OS repos
* Must not require xorg or wayland, or any graphics hardware at all, to run
* Should support all major audio formats. WAV, OGG, and FLAC are required for my purposes.
* If given a single audio file on the command line, it should play that file, and then exit. (The task of finding an audio file to play should not be handled by this program.)

So, what program would you suggest? I know mplayer fits these requirements, but are there any others? (mpv will fail if xorg isn't running unless a command-line argument is used to disable video, while vlc/clvc don't exit after playing the track.)
https://linuxhint.com/play_mp3_files_commandline/
I also submit VLC.

It has multiple interfaces that you can employ from the command line, from a single-issue command to an ncurses TUI

(ncurses interface is one of my favorite ways to use vlc)
avatar
Pseudoman: I also submit VLC.

It has multiple interfaces that you can employ from the command line, from a single-issue command to an ncurses TUI

(ncurses interface is one of my favorite ways to use vlc)
What's the command to play just one file and then immediately exit?

(cvlc doesn't do that; it continues running when the track is done and I have to Ctrl-C it. nvlc is interesting, and something I may use, but not actually what the topic is asking for (in particular, it's not suitable for something like a cron job).)

Edit: Trying nvlc, I get a menu with "Playlist" and "Media Library", not a list of audio files in the current directory, so that isn't really useful to me.
Post edited March 12, 2021 by dtgreene
mpv (somehow overlooked that you mentioned it in your post already, but it should work very well and if you shouldn't need to specify that flag each time you call it, at least I don't have to). You can also create a config file containing your favorite options that are then used by default each time mpv runs.
Post edited March 12, 2021 by jpilot
low rated
im interested in this , but it needs to have a spam filter built in
Try
cvlc --play-and-exit /home/something/Music/playlist.xspf

If you need access to the same vt you can just hide it in the background (though, there are 6 others...).
avatar
dtgreene: Edit: Why the low rating?
Ignore that damn thing and install Jerkmuter. At least then you won't have to see all this pointless and negative ratings and points (except high rated of course), and move on.
Post edited March 12, 2021 by sanscript
I use a program called Amarok, I don't know how supported it is on most distros but it's pretty good.
avatar
Pseudoman: I also submit VLC.

It has multiple interfaces that you can employ from the command line, from a single-issue command to an ncurses TUI

(ncurses interface is one of my favorite ways to use vlc)
avatar
dtgreene: What's the command to play just one file and then immediately exit?

(cvlc doesn't do that; it continues running when the track is done and I have to Ctrl-C it. nvlc is interesting, and something I may use, but not actually what the topic is asking for (in particular, it's not suitable for something like a cron job).)

Edit: Trying nvlc, I get a menu with "Playlist" and "Media Library", not a list of audio files in the current directory, so that isn't really useful to me.
I think you need to specify a special item in the playlist that instructs vlc to exit, like:
cvlc item1.mp3 item2.mp3 vlc://quit

reference: https://linux.die.net/man/1/vlc
Post edited March 12, 2021 by Pseudoman
avatar
dtgreene: I know mplayer fits these requirements, but are there any others?
I was going to suggest mplayer.
What has you looking for others?

Would Xine work for you?
I can't remember if it works without X11, but yonks ago Xine and mplayer were the two that simply played everything I threw at them.
avatar
dtgreene: What's the command to play just one file and then immediately exit?

(cvlc doesn't do that; it continues running when the track is done and I have to Ctrl-C it. nvlc is interesting, and something I may use, but not actually what the topic is asking for (in particular, it's not suitable for something like a cron job).)

Edit: Trying nvlc, I get a menu with "Playlist" and "Media Library", not a list of audio files in the current directory, so that isn't really useful to me.
avatar
Pseudoman: I think you need to specify a special item in the playlist that instructs vlc to exit, like:
cvlc item1.mp3 item2.mp3 vlc://quit

reference: https://linux.die.net/man/1/vlc
That works, but it's annoying to have to do that every time, so it doesn't solve my issue.