Live Chat!

stupid way to make mplayer repeatly play

0 votos Vota!!

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.

14 Responses to “stupid way to make mplayer repeatly play”

  1. “mplayer -loop 0 foo” would repeat foo indefinitely. A single ‘q’ or ctrl-c would stop it.

  2. Ramprasad: Thanks. Somehow -loop doesn’t work for my particular song.flv, but it works for .mp3, .wav and video .flv from youtube.

  3. blackbelt_jones Says:

    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.

  4. blackbelt_jones Says:

    PS Great idea for a blog, btw

  5. blackbelt_jones: Yup. Obviously, Ramprasad had mention that :)

  6. I like the following loop structure:

    while $(sleep 2); do date; done

    Substitute whatever for the ‘date’ command.

  7. dan: That is neat! thanks.

  8. I like audacious to play a song.

  9. tony1grendel Says:

    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.

  10. tony1grendel: Yeah! But I precious my keyboard :P

  11. good idea dute ! -loop 0 thanks !

  12. mplayer -loop 0 endless

    mplayer -loop n times

    ;)

  13. 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

  14. Brendan Macmillan Says:

    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

Leave a Reply

Security Code: