stupid way to make mplayer repeatly play
November 3rd, 2007 mysurface Posted in Bash, for, mplayer, sleep | Hits: 37353 |
I am so desperately wanna make mplayer repeat a song, somehow I obtain a song in flv format. I fail to figure out how to make mplayer repeat, so here make a stupid workaround with bash for.
for (( ; ; )); do mplayer nicesong.flv; sleep 0.1; done
Kill it by hitting ctrl+c two times very fast!
heh! Why I need sleep after mplayer? If you don’t put sleep, you won’t be able to kill it by hitting ctrl+c no matter how many times.
Live Chat!







November 3rd, 2007 at 2:35 am
“mplayer -loop 0 foo” would repeat foo indefinitely. A single ‘q’ or ctrl-c would stop it.
November 3rd, 2007 at 3:57 am
Ramprasad: Thanks. Somehow -loop doesn’t work for my particular song.flv, but it works for .mp3, .wav and video .flv from youtube.
November 3rd, 2007 at 8:01 pm
I don’t know anything about .flv, but -loop alone doesn’t complete the option. It’s -loop 2 for 2 repeats, -loop 3 for 3 repeats, etc, including -loop 0 for endless repeats.
November 3rd, 2007 at 8:02 pm
PS Great idea for a blog, btw
November 3rd, 2007 at 10:44 pm
blackbelt_jones: Yup. Obviously, Ramprasad had mention that :)
November 3rd, 2007 at 11:31 pm
I like the following loop structure:
while $(sleep 2); do date; done
Substitute whatever for the ‘date’ command.
November 3rd, 2007 at 11:45 pm
dan: That is neat! thanks.
November 13th, 2007 at 8:13 pm
I like audacious to play a song.
February 10th, 2008 at 5:44 pm
You don’t need sleep.
You can stop it by hitting ctrl+c, many many times. button mash it like crazy. I tried it with date, instead of mplayer …, and was able to get it terminated in a faster time. You just need to hit that c over and over fast.
February 10th, 2008 at 11:46 pm
tony1grendel: Yeah! But I precious my keyboard :P
April 10th, 2008 at 7:22 am
good idea dute ! -loop 0 thanks !
June 18th, 2008 at 12:08 am
mplayer -loop 0 endless
mplayer -loop n times
;)
October 8th, 2008 at 6:07 am
Put ‘-loop 0′ option AFTER the filename. It sounds silly, but it makes a difference. For example, “mplayer foo -loop 0″. In this case mplayer will reuse the current window. If you put -loop option before the filename then mplayer will close the window and open a new one. In Gnome Nautilus you can set “Open With” to use a custom command. I use this setting:
mplayer %f -loop 0
–
Noah
March 16th, 2009 at 5:41 pm
I did this with a while loop at first:
while echo “running…”; do mplayer foo; done;
But `-loop` is what I wanted! I had checked the man page, but I searched for “repeat”, so didn’t see it…
BTW: I just discovered that command-line completion also works for options! Nice e.g. Press TAB after the following:
mplayer foo -l