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 have two videos and need to play them (by mplayer) exactly at the same time. How to do that ?

share|improve this question
    
Write a bash script? –  Cole Johnson Aug 18 '12 at 6:04
    
can be, but how it looks like ? –  marioosh Aug 18 '12 at 6:07
    
Just put the shebang line followed by the two commands I beleive –  Cole Johnson Aug 18 '12 at 6:08
1  
What do you mean by playing at the same time? Do you mean, on the same screen, using the same instance of mplayer, on multiple screens, on multiple workspaces, on different computers on the network?,.... Or do you mean to merge two videos into a single video? –  Peter.O Aug 18 '12 at 6:09
    
I mean two instances of mplayer (two windows) simply. I want to see the difference beetween that videos. –  marioosh Aug 18 '12 at 6:10
add comment

2 Answers 2

up vote 6 down vote accepted

Start up multiple background tasks. This means that the second one does not need to wait for the first one to finish loading. The & tell the command to run in the background.

From the command-line: In the first one, the number of . (dots) equals the number of instances.

set "/my/vid/path.mp4"   
for i in . . ;do (mplayer "$1" &) ;done   

or

set "/my/vid/path.mp4"; ( 
mplayer "$1" &
mplayer "$1" & )

or

( mplayer "/my/vid/path.mp4" &
  mplayer "/my/vid/path.mp4" & ) 

Or in a script called by play-two "/my/vid/path.mp4"

#!/bin/bash
mplayer "$1" &
mplayer "$1" &
share|improve this answer
    
I get bash: syntax error near unexpected token ;'` –  marioosh Aug 18 '12 at 6:24
    
You can put the commands on different lines. It is working fine for me.. I have just loaded 2x 4GB matroska vids and the synchronization is perfect... It is an interesing effect, for some clips :) –  Peter.O Aug 18 '12 at 6:26
    
Thanks. Last option works good for me :) –  marioosh Aug 18 '12 at 9:10
add comment

GNU parallel

In your particular case:

parallel  mplayer ::: file1.avi file2.avi
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.