Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
what is mplayer doing [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
nordic bro
Guru
Guru


Joined: 25 Oct 2003
Posts: 582

PostPosted: Thu Aug 28, 2008 10:42 pm    Post subject: what is mplayer doing [solved] Reply with quote

is there a way from the cmd line to know that mplayer is playing a video? or some dir maybe that it writes tmp files or something to? I want to change something in a bg script but only if mplayer is actually running a vid (and not just that mplayer itself has been started). is there some other linux/gentoo tool I can say "find out what mplayer is doing?"

I notice that in "top" I can use the fact that its cpu activity is much higher when it isn't idle so maybe I can ping top somehow in the bg but didn't know if this was a good way or if something else is a much better way.


Last edited by nordic bro on Thu Sep 04, 2008 8:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
isilia
Apprentice
Apprentice


Joined: 25 Feb 2008
Posts: 177

PostPosted: Fri Aug 29, 2008 12:57 am    Post subject: Reply with quote

Try fiddling with the ps command.
Back to top
View user's profile Send private message
EzInKy
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1734
Location: Kentucky

PostPosted: Fri Aug 29, 2008 1:30 am    Post subject: Reply with quote

Send the output of mplayer to a file and use that to check its status?
_________________
Time is what keeps everything from happening all at once.
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Fri Aug 29, 2008 7:45 am    Post subject: Reply with quote

ps aux | grep -i mplayer
that will give you back what mplayer is doing. The file played is given as an argument, look at the example:

ps aux | grep mplayer
gueorgua 29301 1.5 0.5 51584 18948 pts/2 SL+ 09:44 0:00 mplayer Animassacre - 1 - Apathy (Candle Nine Remix).mp3

yep, i am listening to Animassacre - 1 - Apathy (Candle Nine Remix).mp3
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2066
Location: /usa/utah

PostPosted: Wed Sep 03, 2008 5:27 am    Post subject: Re: what is mplayer doing Reply with quote

nordic bro wrote:
is there a way from the cmd line to know that mplayer is playing a video? or some dir maybe that it writes tmp files or something to? I want to change something in a bg script but only if mplayer is actually running a vid (and not just that mplayer itself has been started). is there some other linux/gentoo tool I can say "find out what mplayer is doing?"


Try this:

$ pidof mplayer

Will return the pid if its running, will be blank if it's not.

If you wanna go farther and get details on what mplayer is doing, you can use look into opening a fifo and then using slave mode (see the docs, google mplayer slave)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Sokertes
n00b
n00b


Joined: 14 Oct 2003
Posts: 24

PostPosted: Thu Sep 04, 2008 3:00 am    Post subject: Reply with quote

this will pend to a log file

mplayer videofile log=3 > mplayer.log
_________________
No complaints will be allowed. All complaints will be symlinked to /dev/null

All others will be rerouted through iptables
Back to top
View user's profile Send private message
nordic bro
Guru
Guru


Joined: 25 Oct 2003
Posts: 582

PostPosted: Thu Sep 04, 2008 8:01 pm    Post subject: Reply with quote

thanks guys, lots of ways to do this I guess.

for some reason when I run mplayer I get two identical procs except for pid - one is I don't know what and the other gets "L" in ps and seems to be the one to watch as far as cpu activity.

anyway, I settled on this:

Code:

top p $mplayer_pid -bd 0.25 n 3 | grep $mplayer_pid | awk '{print $9}'


top's %CPU is > 0 only when vid/aud are running so I run it 3x and add together just in case a transient 0 sneaks in.

I liked the tmp file idea but found the file can get monstrously large (and I have to clean up after it); it also seems like monitoring a fifo can feedback and crash mplayer otherwise that would've been pretty cool.

wrt ps, I never said mplayer was started with an arg :) but even if it is, from what I see ps doesn't say anything about mplayer's state, just that it's up (ps does have a %cpu but it's not an integer like top's and imm seems almost unusable for what I want).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum