Statistics
| Branch: | Tag: | Revision:

streamers-build / scripts / source.sh @ 63b72e10

History | View | Annotate | Download (1.68 KB)

1
#!/bin/bash
2

    
3
#default values
4
FILE=/dev/stdin
5

    
6
VIDEO_BPS=500000
7
AUDIO_BPS=64000
8
VIDEO_CODEC=mpeg4
9
AUDIO_CODEC=libmp3lame
10
IPC_IP="127.0.0.1"
11
IPC_PORT=7777
12

    
13
PORT=6666
14
SOURCE_COPIES=3
15

    
16
# Usage: set paramters in this script (after the usage function), then run it with the command line option below
17
function usage () {
18
   echo "Usage: $0 [options]"
19
   echo "  options (and default values)"
20
   echo "  -f file: media file to stream ($FILE)"
21
   echo "  -v rate: video encoding rate in bps ($VIDEO_BPS)"
22
   echo "  -a rate: audio encoding rate in bps ($AUDIO_BPS)"
23
   echo "  -V codec: video encoder ($VIDEO_CODEC)"
24
   echo "  -A codec: audio encoder ($AUDIO_CODEC)"
25
   echo "  -l : the stream is a live source with its own timing"
26
   echo "  -p port: UDP port used by the streamer ($PORT)"
27
   echo "  -m copies: copies of the stream sent out directly by the source ($SOURCE_COPIES)"
28
   echo "  -I ip: IPC ip ($IPC_IP)"
29
   echo "  -P port: IPC port ($IPC_PORT)"
30
   exit $1
31
}
32

    
33
while getopts "f:v:a:V:A:lp:m:hI:P:" opt; do
34
   case $opt in
35

    
36
   f )  FILE=$OPTARG ;;
37
   v )  VIDEO_BPS=$OPTARG ;;
38
   a )  AUDIO_BPS=$OPTARG ;;
39
   V )  VIDEO_CODEC=$OPTARG ;;
40
   A )  AUDIO_CODEC=$OPTARG ;;
41
   l )  CHUNKER_XTRA+=" -l" ;;
42
   p )  PORT=$OPTARG ;;
43
   m )  SOURCE_COPIES=$OPTARG ;;
44
   I )  IPC_IP=$OPTARG ;;
45
   P )  IPC_PORT=$OPTARG ;;
46
   h )  usage 0 ;;
47
   \?)  usage 1 ;;
48
   esac
49
done
50

    
51

    
52
# start the chunker
53
./chunker_streamer -i $FILE -a $AUDIO_BPS -v $VIDEO_BPS -A $AUDIO_CODEC -V $VIDEO_CODEC -F tcp://$IPC_IP:$IPC_PORT $CHUNKER_XTRA  2>&1 1>chunker_streamer.log | tee chunker_streamer.err &
54
CPID=$!
55

    
56
# start a streamer as well
57
./streamer-ml-monl-chunkstream-static -P $PORT -f tcp://0.0.0.0:$IPC_PORT -m $SOURCE_COPIES
58

    
59
kill -9 $CPID
60

    
61

    
62

    
63