annotate TOOLS/mplmult.sh @ 37170:4fc2db166644

Add missing #include.
author ib
date Fri, 05 Sep 2014 17:18:53 +0000
parents 7bdb1c022122
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29611
998475fffe0c Avoid bash-specific 'let' syntax in shell scripts.
diego
parents: 27199
diff changeset
1 #!/bin/sh
14410
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
2 # example how to output video on multiple windows in sync.
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
3 # might be even more useful in combination with vo ggi
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
4 # to distribute the video arbitrarily
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
5
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
6 dir=/tmp/$$
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
7 count=$1
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
8 shift
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
9
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
10 if test 0"$count" -lt 1; then
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
11 echo "At least 1 slave instance must be used."
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
12 echo ""
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
13 echo "Usage:"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
14 echo "./mplmult.sh n mplayer-opts"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
15 echo "n number of MPlayer instances that display the video"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
16 echo "mplayer-opts anything you would specify to mplayer,"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
17 echo " more than one file will usually not work"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
18 exit 1
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
19 fi
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
20
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
21 mkdir -m 700 $dir
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
22 if test $? -ne 0; then
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
23 echo "Could not create temp dir!"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
24 exit 1
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
25 fi
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
26
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
27 mkfifo $dir/stream.yuv
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
28 i=1
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
29 fifo_list=""
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
30 while test $i -le $count; do
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
31 fifo_list="$dir/mp$i $fifo_list"
29611
998475fffe0c Avoid bash-specific 'let' syntax in shell scripts.
diego
parents: 27199
diff changeset
32 i=$(($i+1))
14410
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
33 done
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
34
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
35 mkfifo $fifo_list
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
36 (cat $dir/stream.yuv | tee $fifo_list > /dev/null ) &
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
37 for fifo in $fifo_list; do
35596
7bdb1c022122 Minor improvements to the mplmult script.
reimar
parents: 29611
diff changeset
38 # -benchmark is necessary so that it will not do any timing.
14410
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
39 # the master instance already takes care of it and not specifying
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
40 # it will break A-V sync.
35596
7bdb1c022122 Minor improvements to the mplmult script.
reimar
parents: 29611
diff changeset
41 # -demuxer y4m is necessary because otherwise excessive probing
7bdb1c022122 Minor improvements to the mplmult script.
reimar
parents: 29611
diff changeset
42 # (probably by # the lavf demuxer) causes a long delay.
7bdb1c022122 Minor improvements to the mplmult script.
reimar
parents: 29611
diff changeset
43 mplayer -nocache -quiet -benchmark -demuxer y4m "$fifo" > /dev/null 2>&1 &
14410
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
44 done
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
45 mplayer -nocache -fixed-vo -vo yuv4mpeg:file=$dir/stream.yuv "$@"
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
46
9b7f3566b603 Playback video with multiple windows.
reimar
parents:
diff changeset
47 rm -rf $dir