LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-26-2007, 08:08 AM   #1
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Start two instances of a program simultaneously using bash


Hello everybody.

I am trying to compare two video files which have been encoded in theora at different quality settings. I am (trying) to use mplayer in konsole(bash). My current method (SMASH! CLICK! SMASH!) leaves the two videos slightly out of sync which makes them difficult to compare. So, does anyone know a way to make bash start two different commands at exactly the same time?

Thanks for any help.
 
Old 05-26-2007, 08:33 AM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
You can probably do something like
Code:
$ mplayer -slave vid1.avi & mplayer vid2.avi
(that should start them very close to simultaneously).

P.S., I can’t help but think there is some program specifically written for comparing two videos side-by-side (if only I could give you a name).

Last edited by osor; 05-26-2007 at 08:45 AM. Reason: Corrected original by adding “-slave”
 
Old 05-26-2007, 08:33 AM   #3
Okie
Senior Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 1,154

Rep: Reputation: 187Reputation: 187
maybe this? (no guarantees though)

type in both commands in the same line separated by either && or |
 
Old 05-26-2007, 08:47 AM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Okie
type in both commands in the same line separated by either && or |
&& represents “AND” and will run the second instance after the first instance (only if the first instance exited successfully).

| represents a pipe, and will run both simultaneously (but the input of the second will be borked/uncontrollable because it will be connected to the output of the first).

& is your most likely best option. It will put the first instance in “the background”, allowing the second instance to run. Of course, mplayer is expecting a terminal for stdin, so you might have to tell it otherwise (i.e., use the “-slave” option).
 
Old 05-26-2007, 12:10 PM   #5
Okie
Senior Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 1,154

Rep: Reputation: 187Reputation: 187
thanks Osar...
 
Old 05-26-2007, 12:54 PM   #6
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Original Poster
Rep: Reputation: 39
Thanks for the replies. As expected && and | do not work. A single & seems to work but they are still a good second out of sync. Am I right in thinking that hardware limitations are now the problem?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
inetd-like program that wont spawn new instances, but kills service on disconnection? PureRumble Linux - Software 0 04-28-2007 08:15 PM
Can't run two instances of a java program audibel Linux - Software 0 02-19-2005 04:01 PM
apt-get update-Multiple program instances sumguy231 Linux - Software 0 11-27-2004 09:29 PM
How do you determine the number of NFS instances to start? BrianK Linux - Networking 6 10-26-2004 05:23 AM
How to start xcin and KDE simultaneously satimis *BSD 0 04-08-2004 04:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration