29611
|
1 #!/bin/sh
|
14410
|
2 # example how to output video on multiple windows in sync.
|
|
3 # might be even more useful in combination with vo ggi
|
|
4 # to distribute the video arbitrarily
|
|
5
|
|
6 dir=/tmp/$$
|
|
7 count=$1
|
|
8 shift
|
|
9
|
|
10 if test 0"$count" -lt 1; then
|
|
11 echo "At least 1 slave instance must be used."
|
|
12 echo ""
|
|
13 echo "Usage:"
|
|
14 echo "./mplmult.sh n mplayer-opts"
|
|
15 echo "n number of MPlayer instances that display the video"
|
|
16 echo "mplayer-opts anything you would specify to mplayer,"
|
|
17 echo " more than one file will usually not work"
|
|
18 exit 1
|
|
19 fi
|
|
20
|
|
21 mkdir -m 700 $dir
|
|
22 if test $? -ne 0; then
|
|
23 echo "Could not create temp dir!"
|
|
24 exit 1
|
|
25 fi
|
|
26
|
|
27 mkfifo $dir/stream.yuv
|
|
28 i=1
|
|
29 fifo_list=""
|
|
30 while test $i -le $count; do
|
|
31 fifo_list="$dir/mp$i $fifo_list"
|
29611
|
32 i=$(($i+1))
|
14410
|
33 done
|
|
34
|
|
35 mkfifo $fifo_list
|
|
36 (cat $dir/stream.yuv | tee $fifo_list > /dev/null ) &
|
|
37 for fifo in $fifo_list; do
|
|
38 # -benchmark is neccessary so that it will not do any timing.
|
|
39 # the master instance already takes care of it and not specifying
|
|
40 # it will break A-V sync.
|
|
41 mplayer -nocache -quiet -benchmark "$fifo" > /dev/null 2>&1 &
|
|
42 done
|
|
43 mplayer -nocache -fixed-vo -vo yuv4mpeg:file=$dir/stream.yuv "$@"
|
|
44
|
|
45 rm -rf $dir
|