Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.