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


Groups > linux.debian.user > #184482 > unrolled thread

Problem pulseaudio

Started byMENGUAL Jean-Philippe <mengualjeanphi@free.fr>
First post2017-08-01 10:30 +0200
Last post2017-08-01 20:50 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  Problem pulseaudio MENGUAL Jean-Philippe <mengualjeanphi@free.fr> - 2017-08-01 10:30 +0200
    Re: Problem pulseaudio Greg Wooledge <wooledg@eeg.ccf.org> - 2017-08-01 14:20 +0200
    Re: Problem pulseaudio Nicolas George <george@nsup.org> - 2017-08-01 20:50 +0200
      Re: Problem pulseaudio MENGUAL Jean-Philippe <mengualjeanphi@free.fr> - 2017-08-01 22:20 +0200
      Re: Problem pulseaudio MENGUAL Jean-Philippe <mengualjeanphi@free.fr> - 2017-08-02 08:40 +0200
        Re: Problem pulseaudio "Juan R. de Silva" <juan.r.d.silva@gmail.com> - 2017-08-02 16:50 +0200
    Re: Problem pulseaudio "Juan R. de Silva" <juan.r.d.silva@gmail.com> - 2017-08-01 20:50 +0200

#184482 — Problem pulseaudio

FromMENGUAL Jean-Philippe <mengualjeanphi@free.fr>
Date2017-08-01 10:30 +0200
SubjectProblem pulseaudio
Message-ID<u9AIW-P3-21@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi,


My purpose is to run mplayer in a crontab. My line:

00 00 * * * mplayer file


If I run mplayer in CLI, everything is good. If cron does it, no sound.
And log is: Audio becomes stuck!


displayed permanently in the MPlayer screen.


I use a fresh testing.


I have just changed to mpv. Here no such logs after crontab, but still
no sound.


How can I get more logs? Should I reportbug to mpv or pulseaudio? Where
could I check? Not a permission problem on Pulseaudio as cron user would
run mpv instead of my regular user?



Best regards,


-- 
signature_jp_2
Logo Hypra 	JEAN-PHILIPPE MENGUAL
DIRECTEUR TECHNIQUE ET QUALITÉ
102, rue des poissonniers, 75018, Paris
Tel : +331 84 73 06 61 <tel:+33184730661> Mob : +336 76 34 93 37
<tel:+33676349337>
jpmengual@hypra.fr <mailto:jpmengual@hypra.fr>
www.hypra.fr <http://www.hypra.fr/>
Facebook Hypra <https://www.facebook.com/hyprasoftware/> Twitter Hypra
<https://twitter.com/Hypra_> Linkedin Jean-Philippe
<https://fr.linkedin.com/in/jean-philippe-mengual-800133135>


[toc] | [next] | [standalone]


#184484

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-08-01 14:20 +0200
Message-ID<u9Ejv-3Ut-3@gated-at.bofh.it>
In reply to#184482
On Tue, Aug 01, 2017 at 08:30:57AM +0200, MENGUAL Jean-Philippe wrote:
> My purpose is to run mplayer in a crontab. My line:
> 
> 00 00 * * * mplayer file

But your *Subject* header says "Problem pulseaudio".  I presume this
means you are using pulseaudio.

When you invoke mplayer from cron, it does not have any of the
environment variables that your desktop session sets.  No DISPLAY
or XAUTHORITY to talk to the X server, no TERM to define which
set of terminal escape sequences to use (and no controlling terminal
in the first place), and -- relevant to you -- no pulseaudio environment
variables.

See <https://www.freedesktop.org/wiki/Software/PulseAudio/FAQ/#index5h3>

> If I run mplayer in CLI, everything is good. If cron does it, no sound.
> And log is: Audio becomes stuck!

Probably because in the absence of the pulseaudio variables, mplayer
cannot talk to your pulseaudio daemon.

If it were *me*, I would simply remove pulseaudio and stop attempting
to use it.  But you probably run some kind of Desktop Environment which
relies on it, so I'm guessing that's not an option for you.

The second idea that comes to mind would be for you to dump your desktop
session's environment variables to a file upon login, and then source
that file from a bash script invoked by cron when you want to run mplayer.

The problem with this is, I have no idea when or how the pulseaudio
environment variables get set (since I don't use it).  Thus, I don't
know where to put the command to dump the variables to a file.

But assuming you can figure that out, create the following *bash script*
and put it somewhere:

#!/bin/bash
declare -px > ~/.cache/env-variables

At login, arrange for it to run from *wherever* it's supposed to run
from.  That's the part I can't guess.  Happy hunting.

Then from cron, call a second *bash script* that runs this:

#!/bin/bash
source ~/.cache/env-variables
mplayer file

Do not put these commands directly inside crontab, because those commands
run under sh, not bash.

[toc] | [prev] | [next] | [standalone]


#184500

FromNicolas George <george@nsup.org>
Date2017-08-01 20:50 +0200
Message-ID<u9KoW-7AC-1@gated-at.bofh.it>
In reply to#184482

[Multipart message — attachments visible in raw view] — view raw

Le quartidi 14 thermidor, an CCXXV, Juan R. de Silva a écrit :
> > If I run mplayer in CLI, everything is good. If cron does it, no sound.
> I had a similar problem when wanted to run vlc in a crontab. The solution 
> was to execute in crontab the following command:
> 
> env DISPLAY=:0 /home/your_username/full_path_goes_here/play_something.sh

Setting the DISPLAY environment variable is for video, not for audio as
in Jean-Philippe's problem.

Regards,

-- 
  Nicolas George

[toc] | [prev] | [next] | [standalone]


#184508

FromMENGUAL Jean-Philippe <mengualjeanphi@free.fr>
Date2017-08-01 22:20 +0200
Message-ID<u9LO1-9K-7@gated-at.bofh.it>
In reply to#184500

[Multipart message — attachments visible in raw view] — view raw

Hi,

You probably are right, Nicolas, that is what I thought at first
reading. However I tried. And it seems to work. I will try in more
various situations and let you informed of the success of the thing.
Many thanks Juan.

Best regards,


Le 01/08/2017 à 20:47, Nicolas George a écrit :
> Le quartidi 14 thermidor, an CCXXV, Juan R. de Silva a écrit :
>>> If I run mplayer in CLI, everything is good. If cron does it, no sound.
>> I had a similar problem when wanted to run vlc in a crontab. The solution 
>> was to execute in crontab the following command:
>>
>> env DISPLAY=:0 /home/your_username/full_path_goes_here/play_something.sh
> 
> Setting the DISPLAY environment variable is for video, not for audio as
> in Jean-Philippe's problem.
> 
> Regards,
> 

-- 
Logo Hypra 	JEAN-PHILIPPE MENGUAL
DIRECTEUR TECHNIQUE ET QUALITÉ
102, rue des poissonniers, 75018, Paris
Tel : +331 84 73 06 61 <tel:+33184730661> Mob : +336 76 34 93 37
<tel:+33676349337>
jpmengual@hypra.fr <mailto:jpmengual@hypra.fr>
www.hypra.fr <http://www.hypra.fr/>
Facebook Hypra <https://www.facebook.com/hyprasoftware/> Twitter Hypra
<https://twitter.com/Hypra_> Linkedin Jean-Philippe
<https://fr.linkedin.com/in/jean-philippe-mengual-800133135>



[toc] | [prev] | [next] | [standalone]


#184526

FromMENGUAL Jean-Philippe <mengualjeanphi@free.fr>
Date2017-08-02 08:40 +0200
Message-ID<u9Vu2-6ig-19@gated-at.bofh.it>
In reply to#184500

[Multipart message — attachments visible in raw view] — view raw

Hi,


I confirm, it works perfectly. Mqny thanks Juan


Regards


Le 01/08/2017 à 20:47, Nicolas George a écrit :
> Le quartidi 14 thermidor, an CCXXV, Juan R. de Silva a écrit :
>>> If I run mplayer in CLI, everything is good. If cron does it, no sound.
>> I had a similar problem when wanted to run vlc in a crontab. The solution 
>> was to execute in crontab the following command:
>>
>> env DISPLAY=:0 /home/your_username/full_path_goes_here/play_something.sh
> Setting the DISPLAY environment variable is for video, not for audio as
> in Jean-Philippe's problem.
>
> Regards,
>

-- 
signature_jp_2
Logo Hypra 	JEAN-PHILIPPE MENGUAL
DIRECTEUR TECHNIQUE ET QUALITÉ
102, rue des poissonniers, 75018, Paris
Tel : +331 84 73 06 61 <tel:+33184730661> Mob : +336 76 34 93 37
<tel:+33676349337>
jpmengual@hypra.fr <mailto:jpmengual@hypra.fr>
www.hypra.fr <http://www.hypra.fr/>
Facebook Hypra <https://www.facebook.com/hyprasoftware/> Twitter Hypra
<https://twitter.com/Hypra_> Linkedin Jean-Philippe
<https://fr.linkedin.com/in/jean-philippe-mengual-800133135>


[toc] | [prev] | [next] | [standalone]


#184544

From"Juan R. de Silva" <juan.r.d.silva@gmail.com>
Date2017-08-02 16:50 +0200
Message-ID<ua38d-2Gm-1@gated-at.bofh.it>
In reply to#184526
On Wed, 02 Aug 2017 08:34:52 +0200, MENGUAL Jean-Philippe wrote:

> Hi,
> 
> 
> I confirm, it works perfectly. Mqny thanks Juan

Glad to it helped.

[toc] | [prev] | [next] | [standalone]


#184501

From"Juan R. de Silva" <juan.r.d.silva@gmail.com>
Date2017-08-01 20:50 +0200
Message-ID<u9KoW-7AC-3@gated-at.bofh.it>
In reply to#184482
On Tue, 01 Aug 2017 08:30:57 +0200, MENGUAL Jean-Philippe wrote:

> Hi,
> 
> 
> My purpose is to run mplayer in a crontab. My line:
> 
> 00 00 * * * mplayer file
> 
> 
> If I run mplayer in CLI, everything is good. If cron does it, no sound.
> And log is: Audio becomes stuck!
> 
> 
> displayed permanently in the MPlayer screen.
> 
> 
> I use a fresh testing.
> 
> 
> I have just changed to mpv. Here no such logs after crontab, but still
> no sound.
> 
> 
> How can I get more logs? Should I reportbug to mpv or pulseaudio? Where
> could I check? Not a permission problem on Pulseaudio as cron user would
> run mpv instead of my regular user?
> 

I had a similar problem when wanted to run vlc in a crontab. The solution 
was to execute in crontab the following command:

env DISPLAY=:0 /home/your_username/full_path_goes_here/play_something.sh

play_something.sh contained actual bash command to run vlc with path to an 
mp3 file to play.

This way vlc get the required environment variable set by desktop session.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web