view TOOLS/mplmult.sh @ 34847:44210843ba79

Update MimeType key in the desktop file. This complies with the freedesktop.org shared MIME info database. The following MIME types not registered with IANA are used: application/ram application/vnd.rn-realmedia audio/flac (in addition to audio/x-flac, see (*) below) audio/mp2 (see (**) below) audio/vnd.rn-realaudio video/vnd.rn-realvideo video/webm (*) freedesktop.org changed that from the correct, non-standard type audio/x-flac in v0.80 "for consistency with other xiph.org types not yet registered in IANA" (**) freedesktop.org introduced that in v0.22, not using the correct, non-standard type audio/x-mp2 which was added in v0.60, but only as an alias
author ib
date Mon, 21 May 2012 09:45:29 +0000
parents 998475fffe0c
children 7bdb1c022122
line wrap: on
line source

#!/bin/sh
# example how to output video on multiple windows in sync.
# might be even more useful in combination with vo ggi
# to distribute the video arbitrarily

dir=/tmp/$$
count=$1
shift

if test 0"$count" -lt 1; then
  echo "At least 1 slave instance must be used."
  echo ""
  echo "Usage:"
  echo "./mplmult.sh n mplayer-opts"
  echo "n              number of MPlayer instances that display the video"
  echo "mplayer-opts   anything you would specify to mplayer,"
  echo "               more than one file will usually not work"
  exit 1
fi

mkdir -m 700 $dir
if test $? -ne 0; then
  echo "Could not create temp dir!"
  exit 1
fi

mkfifo $dir/stream.yuv
i=1
fifo_list=""
while test $i -le $count; do
  fifo_list="$dir/mp$i $fifo_list"
  i=$(($i+1))
done

mkfifo $fifo_list
(cat $dir/stream.yuv | tee $fifo_list > /dev/null ) &
for fifo in $fifo_list; do
  # -benchmark is neccessary so that it will not do any timing.
  # the master instance already takes care of it and not specifying
  # it will break A-V sync.
  mplayer -nocache -quiet -benchmark "$fifo" > /dev/null 2>&1 &
done
mplayer -nocache -fixed-vo -vo yuv4mpeg:file=$dir/stream.yuv "$@"

rm -rf $dir