LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-27-2004, 02:45 PM   #1
jqcaducifer
Member
 
Registered: Jul 2003
Distribution: Fedora 3
Posts: 133

Rep: Reputation: 15
MPlayer Background Process


Hi
In some script, I want to make mplayer run in the background, and the command I have is:
Code:
mplayer -vo null -ao alsa /dev/video0 > /dev/null &
The problem is, this doesn't work. Mplayer remains in the foreground. The only way I can make mplayer become background is if i execute the command first, without the ampersand, and then do CTRL-Z and then the bg command.
Is some way to get mplayer into the background within a script, without me having to type anything?
Thanks
 
Old 11-28-2004, 10:50 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
What exactly are you trying to do? It looks like that command will play the audio from /dev/video0, while writing normal standard-output messages to /dev/null, and standard-error messages to your console or terminal. Even if it does run in the background, you will still hear the audio. Is that what you want?

If you want the error messages (and anything else that is still bring printed to your console) to be directed to /dev/null also, use this command:

Code:
mplayer -vo null -ao alsa /dev/video0 > /dev/null 2>&1 &
If you don't want to hear the audio, you should use a different audio output driver. Either -ao pcm or -ao null would prevent the audio from being played through your speakers.
 
Old 11-29-2004, 01:40 PM   #3
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
wapcaplet: the problem is, apparently mplayer stops itself when it is being backgrounded... no apparent way around it AFAIK...

jqcaducifer: Maybe try another player, since apparently it's only for audio?
 
Old 11-29-2004, 02:22 PM   #4
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I know for a fact that mplayer can run just fine in the background, since I've done it many times. It may depend on what you're trying to do, though. When I've run it in the background, it's for writing output to a file, rather than producing any output that I can see or hear.
 
Old 11-29-2004, 02:51 PM   #5
jqcaducifer
Member
 
Registered: Jul 2003
Distribution: Fedora 3
Posts: 133

Original Poster
Rep: Reputation: 15
Well, here's my situation:

I'm trying to stream audio from the FM Reciever on my Hauppauge WinTV-350 card. The problem is ussually, the driver (ivtv) had /dev/video24 to listen to only the FM audio, but currently the driver's support of the device is broken. The only output is via /dev/video0, which outputs the FM audio, but also has a blank black screen for video.

MPlayer is the only player I've been able to find that can direct the video to null, so as to not display a black screen, and still play the audio.

So is there another player that could achieve this purpose that would be better? MPlayer has been very unstable, and freezes very often with messages like "Too many video packets in buffer".

Thanks
 
Old 11-29-2004, 03:31 PM   #6
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
True for outputting to a file, but to actually playback something, it refuses to be backgrounded

jqcaducifer, have you tried GnomeRadio? http://mfcn.ilo.de/gnomeradio/
Also, http://www.exploits.org/v4l/ has a larger list of existing players, scroll down to the radio section.
 
Old 12-31-2004, 03:20 PM   #7
Tim Retout
LQ Newbie
 
Registered: Dec 2004
Location: UK
Distribution: Debian
Posts: 21

Rep: Reputation: 15
Lightbulb

Here's the answer, in the MPlayer FAQ:

Code:
mplayer options filename < /dev/null &
Give MPlayer /dev/null on STDIN. Works for me. I was trying to listen to radio over the internet, without needing GUI apps, or needing an open terminal window. To get rid of all the text, you still need to route STDOUT and STDERR to /dev/null, like so:

Code:
mplayer options filename < /dev/null >&0 2>&0 &
Hope that helps.

Last edited by Tim Retout; 12-31-2004 at 03:35 PM.
 
Old 01-01-2005, 01:25 PM   #8
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
Nice to know! Thx.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
really background a process Henster Linux - Newbie 1 07-01-2005 06:29 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 01:27 AM
Background Process mojozoox Linux - General 1 08-26-2003 03:16 PM
Background process h8r Linux - Newbie 5 01-13-2003 05:21 PM
background process gurra Programming 9 09-30-2001 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration