Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want mplayer and VLC start playing at exact time. Player should:

  1. Load video file, buffer it, prepare everything;
  2. Wait for UNIX time to be N seconds M milliseconds
  3. Start playing according to framerate (without long-term deviations)

How it's better to attain this?

share|improve this question

You could use a FIFO as input in MPlayer and start playback at the specified time.

I copy paste some minimal code examples I used in a script years ago that were used to skip in videos for scripting reasons.

  1. Create a FIFO:

    [ ! -p /tmp/mplayer-fifo ] && mkfifo /tmp/mplayer-fifo
    
  2. Start MPlayer with e.g.

    mplayer myfile.avi -input /tmp/mplayer-fifo
    
  3. Send the skip command from another script with

    echo "seek 10" > /tmp/mplayer-fifo
    

You can instead use the FIFO to start and pause the video. Use at to run the play command at a specific time.

If the video is started and then immediately paused and then just waits for the "play" directive, then all buffering should be avoided.

share|improve this answer
    
Thanks. I wrote my own alarm clock with at and a fifo. I had to set the seek value to -9999 to get to the start of a song. However, I then used crontab and had to dismiss the earlier alarm clock version with at and a fifo. – polym Oct 13 '15 at 10:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .