Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #20289

Re: mpg123 to audio jack?

From "A. Dumas" <alexandre@dumas.fr.invalid>
Newsgroups comp.sys.raspberry-pi
Subject Re: mpg123 to audio jack?
Date 2019-06-15 10:06 +0200
Organization A noiseless patient Spider
Message-ID <qe28uk$1ge$1@dont-email.me> (permalink)
References <qdufp2$1lg9$1@gioia.aioe.org> <qdv9tq$u2n$1@dont-email.me> <qe134t$1atg$1@gioia.aioe.org>

Show all headers | View raw


Pete wrote, on 14-06-2019 23:21:
> A. Dumas <alexandre@dumas.fr.invalid> wrote:
>> The player program doesn't determine where the output goes, the system
>> does that. In a terminal window:
>>
>> amixer cset numid=3 1
>>
>> where the second parameter is: 0=auto (default), 1=jack, 2=hdmi
>> Doesn't need sudo and persists across reboots. I think it can also be
>> set via raspi-config (which does need sudo, although maybe not for this
>> setting, I never tried).
> 
> Ahh.  I have vague memories now of going through that when I was
> trying to get omxplayer to output to the jack.  It *didn't* work
> there, because it turns out that with omxplayer you have to use
> the "--adev local" option to redirect the output.  I guess it
> doesn't use alsa.

Yes, I wasn't precise: omxplayer is special, it speaks to hardware 
directly. I'm not sure how it determines a default output path if you 
don't specify it on the command line. Maybe simply hdmi always?

> As sometimes I do want audio out via hdmi -- playing a video for instance --
> it's probably more convenient to stick with omxplayer, as there's really
> nothing wrong with the job it does.

You can use the amixer command to set it to jack once (and for all), for 
mpg123 with alsa, and use "--adev hdmi" for video's? Short option "-o 
hdmi" works too. Or if output to jack is the exception, make a bash file:

#!/usr/bin/env bash
# set alsa output to jack
amixer cset numid=3 1
# play the file
mpg123 $*
# set alsa output to hdmi
amixer cset numid=3 2

Save it as e.g. myplayer, make it executable: "chmod 755 myplayer" and 
move it to /usr/local/bin/ (requires sudo). Then call it as you would 
mpg123 but with the new name. The commandline parameters get passed on.

I prefer mpd+mpc, by the way, because it plays streams, playlists and 
libraries. But mpg123 is more convenient for single files occasionally, 
I suppose.

Back to comp.sys.raspberry-pi | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

mpg123 to audio jack? neverland@GoodeveCa.net (Pete) - 2019-06-13 21:38 +0000
  Re: mpg123 to audio jack? Roger Bell_West <roger+csrp201906@nospam.firedrake.org> - 2019-06-13 22:56 +0000
  Re: mpg123 to audio jack? "A. Dumas" <alexandre@dumas.fr.invalid> - 2019-06-14 07:04 +0200
    Re: mpg123 to audio jack? neverland@GOODEVEca.net (Pete) - 2019-06-14 21:21 +0000
      Re: mpg123 to audio jack? "A. Dumas" <alexandre@dumas.fr.invalid> - 2019-06-15 10:06 +0200
        Re: mpg123 to audio jack? neverland@GOODEVEca.net (Pete) - 2019-06-16 18:27 +0000
  Re: mpg123 to audio jack? The Natural Philosopher <tnp@invalid.invalid> - 2019-06-14 09:25 +0100

csiph-web