Explorar o código

initial commit

David %!s(int64=10) %!d(string=hai) anos
achega
96a90ecac1
Modificáronse 6 ficheiros con 593 adicións e 0 borrados
  1. 182 0
      completo-2cam.ini
  2. 175 0
      completo.ini
  3. 73 0
      working-tcp-video.sh
  4. 12 0
      working-udp-audio.sh
  5. 78 0
      working-udp-mjpeg.sh
  6. 73 0
      working-udp-video.sh

+ 182 - 0
completo-2cam.ini

@@ -0,0 +1,182 @@
+require version 0.5.1
+
+################################################################################
+# Basic Feeds Settings
+# Copyright by Peter Maersk-Moller 2012 - All rights reserved
+
+# Listen on port 9999 for command control connections
+system control port 9999
+
+# Set system Geometry to 1024x576
+#system geometry 1024 576 BGRA
+system geometry 1024 768 BGRA
+
+# Set system frame rate to 24
+system frame rate 25
+
+# Set output control socket
+system socket /tmp/mixer1
+
+# Set feed idle time - feed 0 will always be idle. If no file is given,
+# idle image will be all black.
+#feed idle 0 1 dead-1024x576.bgra
+feed idle 0 1 
+
+# Define feed #1, set geometry to 704x576, define as live, set idle time
+# to 100 frames and set idle image, scale to 1/2 and specify control socket.
+# Furthermore the feed is defined as live meaning Snowmix will drop frames if
+# it is late.
+feed add 1 Feed #1
+feed geometry 1 1024 768
+feed live 1
+feed idle 1 100 frames/dead-1024x768.bgra
+#feed scale 1 1 1
+feed socket 1 /tmp/feed1-control-pipe
+
+# Define feed #2, set geometry to 704x576, define as live, set idle time
+# to 100 frames and set idle image, scale to 320/768 and specify control socket
+# Furthermore the feed is defined as live meaning Snowmix will drop frames if
+# it is late.
+feed add 2 Feed #2
+feed geometry 2 800 600
+#576
+feed live 2
+#feed idle 2 100 frames/dead-704x576.bgra
+feed scale 2 1 1
+feed socket 2 /tmp/feed2-control-pipe
+
+# Load a transparent image and place it at 4,4
+#image load 0 images/tv2-news-logo.png
+image load 0 /home/nginx/logoeba.png
+#place id, image id, x y
+image place 0 0 40 700
+
+################################################################################
+audio feed verbose 0
+audio mixer verbose 0
+audio sink verbose 0
+
+audio feed add 1 Audio feed #1
+audio feed channels 1 2
+audio feed rate 1 48000
+audio feed format 1 16 signed
+audio feed mute off 1
+#audio feed volume 1 1
+audio feed delay 1 50
+
+audio feed add 2 Audio feed #2
+audio feed channels 2 2
+audio feed rate 2 48000
+audio feed format 2 16 signed
+audio feed mute off 2
+#audio feed volume 2 1
+audio feed delay 2 50
+
+audio mixer add 1 Main Live Mixer
+audio mixer channels 1 2
+audio mixer rate 1 48000
+audio mixer mute off 1
+#audio mixer volume 1 1
+audio mixer source feed 1 1
+audio mixer source feed 1 2
+#audio mixer source volume 1 1 1.0
+#audio mixer source volume 1 2 1.0
+audio mixer source mute off 1 1
+#audio mixer source mute off 1 2
+
+# Dummy sink
+audio sink add 0 Dummy Audio
+audio sink channels 0 2
+audio sink rate 0 48000
+audio sink format 0 16 signed
+audio sink mute on 0
+audio sink source mixer 0 1
+
+# Sink for 'ctr isaudio'
+audio sink add 1 Main Live Sink
+audio sink channels 1 2
+audio sink rate 1 48000
+audio sink format 1 16 signed
+audio sink mute off 1
+audio sink source mixer 1 1
+
+audio sink verbose 1
+audio sink start 0
+audio mixer start 1
+audio feed verbose 1
+audio mixer verbose 1
+
+#FIXME channels
+################################################################################
+stack  0
+
+# Define some text strings identified by their text id.
+text string 0 Snowmix Virtual Feed Setup by Peter Maersk-Moller
+text string 1 This is feed #1
+text string 2 This is feed #2
+text string 6 [#RUNTIME,1]
+text string 7 [#RUNTIME,2]
+text string 10 [#FEEDSTATE,2,RUNNING]Running 2
+text string 11 [#FEEDSTATE,2,PENDING]Pending 2
+text string 12 [#FEEDSTATE,2,STALLED]Stalled 2
+text string 13 [#FEEDSTATE,2,DISCONNECTED]Lost Signal 2
+text string 20 [#DATETIME] CET
+
+# This defines 3 font selections identified by their font id
+text font 0 Sans Bold 8
+text font 1 Sans Bold 12
+text font 2 Sans Bold 14
+text font 0 Sans Bold 7
+
+command create create_virtual_feeds
+  vfeed add 1 Feed #1
+  vfeed source feed 1 1
+  vfeed add 2 Feed #2
+  vfeed source feed 2 2
+command end
+
+# vfeed place rect [<vir id> [<x> <y> <clip w> <clip h> <clip x> <clip y> [<rotation> <scale_x> <scale_y> <alpha>]]]
+# vfeed place rect id x  y   c_w c_h c_x cy rot s_x s_y alp
+command create place_virtual_feed_pip
+  vfeed place rect 1 000 000 1024 768 000 00 0.0 1.0 1.0 1.0
+
+#800x600 * 0.4 => 320x240
+#1024x768 - 320x240 = 704x528
+  vfeed place rect 2 704 528 0320 240 000 00 0.0 0.4 0.4 1.0
+  loop
+command end
+
+command create place_virtual_feed_main
+  vfeed place rect 1 000 000 1024 768 000 00 0.0 1.0 1.0 1.0
+  vfeed place rect 2 704 384 0800 600 000 00 0.0 0.4 0.4 0.0
+#  vfeed place rect 2 0 0 1   1   0   0  0   1   1   0.1
+  loop
+command end
+
+command create place_virtual_feed_secondary
+  vfeed place rect 1 000 000 1024 768 000 00 0.0 1.0 1.0 0.0
+  vfeed place rect 2 000 000 0800 600 000 00 0.0 1.0 1.0 1.0
+#  vfeed place rect 2 0 0 1   1   0   0  0   1   1   0.1
+  loop
+command end
+
+create_virtual_feeds
+place_virtual_feed_pip
+
+# The 'loop' command is essential and tells Snowmix to loop the command,
+# to point at the start of the command before next frame..
+command create Show
+  vfeed overlay 1
+  vfeed overlay 2
+  image overlay 0
+#  text overlay 1 3
+#  text overlay 2 4..end
+#  text overlay 0
+  loop
+command end
+
+# >>>>>>>>>>>>>>>>>> I M P O R T A N T <<<<<<<<<<<<<<<<<<<<<<<
+# This command tells Snowmix to run the command 'Show' for each frame after
+# feeds have been stacked as defined by the 'stack command'
+overlay finish Show
+# >>>>>>>>>>>>>>>>>> I M P O R T A N T <<<<<<<<<<<<<<<<<<<<<<<

+ 175 - 0
completo.ini

@@ -0,0 +1,175 @@
+require version 0.5.1
+
+################################################################################
+# Basic Feeds Settings
+# Copyright by Peter Maersk-Moller 2012 - All rights reserved
+
+# Listen on port 9999 for command control connections
+system control port 9999
+
+# Set system Geometry to 1024x576
+#system geometry 1024 576 BGRA
+system geometry 1024 768 BGRA
+
+# Set system frame rate to 24
+system frame rate 25
+
+# Set output control socket
+system socket /tmp/mixer1
+
+# Set feed idle time - feed 0 will always be idle. If no file is given,
+# idle image will be all black.
+#feed idle 0 1 dead-1024x576.bgra
+feed idle 0 1 
+
+# Define feed #1, set geometry to 704x576, define as live, set idle time
+# to 100 frames and set idle image, scale to 1/2 and specify control socket.
+# Furthermore the feed is defined as live meaning Snowmix will drop frames if
+# it is late.
+feed add 1 Feed #1
+feed geometry 1 1024 768
+feed live 1
+feed idle 1 100 frames/dead-1024x768.bgra
+#feed scale 1 1 1
+feed socket 1 /tmp/feed1-control-pipe
+
+# Define feed #2, set geometry to 704x576, define as live, set idle time
+# to 100 frames and set idle image, scale to 320/768 and specify control socket
+# Furthermore the feed is defined as live meaning Snowmix will drop frames if
+# it is late.
+feed add 2 Feed #2
+feed geometry 2 800 600
+#576
+feed live 2
+#feed idle 2 100 frames/dead-704x576.bgra
+feed scale 2 1 1
+feed socket 2 /tmp/feed2-control-pipe
+
+# Load a transparent image and place it at 4,4
+#image load 0 images/tv2-news-logo.png
+image load 0 /home/nginx/logoeba.png
+#place id, image id, x y
+image place 0 0 40 700
+
+################################################################################
+audio feed verbose 0
+audio mixer verbose 0
+audio sink verbose 0
+
+audio feed add 1 Audio feed #1
+audio feed channels 1 2
+audio feed rate 1 48000
+audio feed format 1 16 signed
+audio feed mute off 1
+#audio feed volume 1 1
+audio feed delay 1 50
+
+audio feed add 2 Audio feed #2
+audio feed channels 2 2
+audio feed rate 2 48000
+audio feed format 2 16 signed
+audio feed mute off 2
+#audio feed volume 2 1
+audio feed delay 2 50
+
+audio mixer add 1 Main Live Mixer
+audio mixer channels 1 2
+audio mixer rate 1 48000
+audio mixer mute off 1
+#audio mixer volume 1 1
+audio mixer source feed 1 1
+audio mixer source feed 1 2
+#audio mixer source volume 1 1 1.0
+#audio mixer source volume 1 2 1.0
+audio mixer source mute off 1 1
+#audio mixer source mute off 1 2
+
+# Dummy sink
+audio sink add 0 Dummy Audio
+audio sink channels 0 2
+audio sink rate 0 48000
+audio sink format 0 16 signed
+audio sink mute on 0
+audio sink source mixer 0 1
+
+# Sink for 'ctr isaudio'
+audio sink add 1 Main Live Sink
+audio sink channels 1 2
+audio sink rate 1 48000
+audio sink format 1 16 signed
+audio sink mute off 1
+audio sink source mixer 1 1
+
+audio sink verbose 1
+audio sink start 0
+audio mixer start 1
+audio feed verbose 1
+audio mixer verbose 1
+
+#FIXME channels
+################################################################################
+stack  0
+
+# Define some text strings identified by their text id.
+text string 0 Snowmix Virtual Feed Setup by Peter Maersk-Moller
+text string 1 This is feed #1
+text string 2 This is feed #2
+text string 6 [#RUNTIME,1]
+text string 7 [#RUNTIME,2]
+text string 10 [#FEEDSTATE,2,RUNNING]Running 2
+text string 11 [#FEEDSTATE,2,PENDING]Pending 2
+text string 12 [#FEEDSTATE,2,STALLED]Stalled 2
+text string 13 [#FEEDSTATE,2,DISCONNECTED]Lost Signal 2
+text string 20 [#DATETIME] CET
+
+# This defines 3 font selections identified by their font id
+text font 0 Sans Bold 8
+text font 1 Sans Bold 12
+text font 2 Sans Bold 14
+text font 0 Sans Bold 7
+
+command create create_virtual_feeds
+  vfeed add 1 Feed #1
+  vfeed source feed 1 1
+  vfeed add 2 Feed #2
+  vfeed source feed 2 2
+command end
+
+# vfeed place rect [<vir id> [<x> <y> <clip w> <clip h> <clip x> <clip y> [<rotation> <scale_x> <scale_y> <alpha>]]]
+# vfeed place rect id x  y   c_w c_h c_x cy rot s_x s_y alp
+command create place_virtual_feed_pip
+  vfeed place rect 1 000 000 1024 768 000 00 0.0 1.0 1.0 1.0
+
+#800x600 * 0.4 => 320x240
+#1024x768 - 320x240 = 704x528
+  vfeed place rect 2 704 528 0320 240 000 00 0.0 0.4 0.4 1.0
+  loop
+command end
+
+command create place_virtual_feed_main
+  vfeed place rect 1 000 000 1024 768 000 00 0.0 1.0 1.0 1.0
+  vfeed place rect 2 704 384 0800 600 000 00 0.0 0.4 0.4 0.0
+#  vfeed place rect 2 0 0 1   1   0   0  0   1   1   0.1
+  loop
+command end
+
+create_virtual_feeds
+place_virtual_feed_pip
+
+# The 'loop' command is essential and tells Snowmix to loop the command,
+# to point at the start of the command before next frame..
+command create Show
+  vfeed overlay 1
+  vfeed overlay 2
+  image overlay 0
+#  text overlay 1 3
+#  text overlay 2 4..end
+#  text overlay 0
+  loop
+command end
+
+# >>>>>>>>>>>>>>>>>> I M P O R T A N T <<<<<<<<<<<<<<<<<<<<<<<
+# This command tells Snowmix to run the command 'Show' for each frame after
+# feeds have been stacked as defined by the 'stack command'
+overlay finish Show
+# >>>>>>>>>>>>>>>>>> I M P O R T A N T <<<<<<<<<<<<<<<<<<<<<<<

+ 73 - 0
working-tcp-video.sh

@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# IMPORTANT >>>>>You need to get port, ip and feed_id right<<<<<
+if [ "X$SNOWMIX" = X ] ; then
+  echo "You need to set the SNOWMIX environment variable"
+  exit 1
+fi
+if [ "X$SNOWMIX_PORT" = X ] ; then export SNOWMIX_PORT=9999 ;fi
+if [ "X$SNOWMIX_IP" = X ] ; then export SNOWMIX_IP=127.0.0.1 ;fi
+
+if [ $# -lt 1 ] ; then
+  echo "Missing argument\nUsage $0 <feed id> [<audio feed id> [<input file>]"
+  echo "Setting audio feed to 0 disables audio"
+  exit 1
+fi
+
+# Set video feed and audio feed id
+feed_id=$1
+audio_feed_id=0 #DISABLE AUDIO
+
+# Load the Snowmix and GStreamer settings
+. $SNOWMIX/scripts/gstreamer-settings
+. $SNOWMIX/scripts/snowmix-settings
+# This will set
+# a) feed_rate
+# b) feed_channels
+# c) feed_control_pipe
+# d) feed_width
+# e) feed_height
+# f) ctrsocket
+# g) system_width
+# h) system_height
+# i) ratefraction
+# j) snowmix
+# k) channels
+# l) rate
+
+
+if [ X$feed_control_pipe = X -o X$system_width = X -o X$system_height = X ] ; then
+  echo Failed to get control pipe or width or height from running snowmix
+  exit 1
+fi
+
+#echo "Snowmix Geometry        : $system_width x $system_height"
+#echo "Snowmix control socket  : $ctrsocket"
+echo "Video feed geometry     : $feed_width x $feed_height"
+echo "Video control socket    : $feed_control_pipe"
+echo "Video and audio feed id : $feed_id $audio_feed_id"
+
+if [ X$feed_rate = X -o X$feed_channels = X ] ; then
+  echo Failed to get rate or channels from running snowmix
+  echo Disabling audio
+else
+  echo "Audio rate and channels : $feed_rate $feed_channels"
+fi
+
+SHMSIZE='shm-size='`echo "$feed_width * $feed_height * 4 * 26"|bc`
+SHMOPTION="wait-for-connection=1 sync=true"
+SHMSINK1="shmsink socket-path=$feed_control_pipe $SHMSIZE $SHMOPTION"
+#AUDIOFORMAT="$AUDIOS16LE"', rate='$feed_rate', channels='$feed_channels
+VIDEOFORMAT=$VIDEOBGRA', width='$feed_width', height='$feed_height', framerate=30/1'
+SRC="tcpclientsrc host=192.168.1.208 port=5000 ! gdpdepay ! application/x-rtp, payload=96 ! rtph264depay ! avdec_h264 "
+while true ; do
+    # Remove the named pipe if it exist
+    rm -f $feed_control_pipe
+    com="gst-launch-1.0 -v $SRC ! videoconvert ! videorate ! videoscale ! videoconvert ! $VIDEOFORMAT ! queue ! $SHMSINK1"
+
+	echo "#####################"
+	echo $com;
+	echo "#####################"
+	eval $com
+    sleep 2
+done

+ 12 - 0
working-udp-audio.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+SOURCE="audiotestsrc is-live=true"
+SOURCE='udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec'
+BANDPASS="audiochebband mode=band-pass lower-frequency=50 upper-frequency=4500 poles=4"
+
+OUTPUT_FORMAT="audio/x-raw,format=S16LE,layout=interleaved, rate=48000, channels=2"
+
+(
+	echo 'audio feed ctr isaudio 1' 
+	gst-launch-1.0 -q $SOURCE ! audioconvert ! audioresample ! $BANDPASS ! audioconvert ! $OUTPUT_FORMAT ! fdsink fd=1 sync=true 
+) | nc 127.0.0.1 9999

+ 78 - 0
working-udp-mjpeg.sh

@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# IMPORTANT >>>>>You need to get port, ip and feed_id right<<<<<
+if [ "X$SNOWMIX" = X ] ; then
+  echo "You need to set the SNOWMIX environment variable"
+  exit 1
+fi
+if [ "X$SNOWMIX_PORT" = X ] ; then export SNOWMIX_PORT=9999 ;fi
+if [ "X$SNOWMIX_IP" = X ] ; then export SNOWMIX_IP=127.0.0.1 ;fi
+
+if [ $# -lt 1 ] ; then
+  echo "Missing argument\nUsage $0 <feed id> [<audio feed id> [<input file>]"
+  echo "Setting audio feed to 0 disables audio"
+  exit 1
+fi
+
+# Set video feed and audio feed id
+feed_id=$1
+audio_feed_id=0 #DISABLE AUDIO
+
+# Load the Snowmix and GStreamer settings
+. $SNOWMIX/scripts/gstreamer-settings
+. $SNOWMIX/scripts/snowmix-settings
+# This will set
+# a) feed_rate
+# b) feed_channels
+# c) feed_control_pipe
+# d) feed_width
+# e) feed_height
+# f) ctrsocket
+# g) system_width
+# h) system_height
+# i) ratefraction
+# j) snowmix
+# k) channels
+# l) rate
+
+
+if [ X$feed_control_pipe = X -o X$system_width = X -o X$system_height = X ] ; then
+  echo Failed to get control pipe or width or height from running snowmix
+  exit 1
+fi
+
+#echo "Snowmix Geometry        : $system_width x $system_height"
+#echo "Snowmix control socket  : $ctrsocket"
+echo "Video feed geometry     : $feed_width x $feed_height"
+echo "Video control socket    : $feed_control_pipe"
+echo "Video and audio feed id : $feed_id $audio_feed_id"
+
+if [ X$feed_rate = X -o X$feed_channels = X ] ; then
+  echo Failed to get rate or channels from running snowmix
+  echo Disabling audio
+else
+  echo "Audio rate and channels : $feed_rate $feed_channels"
+fi
+
+SHMSIZE='shm-size='`echo "$feed_width * $feed_height * 4 * 26"|bc`
+SHMOPTION="wait-for-connection=1 sync=true"
+SHMSINK1="shmsink socket-path=$feed_control_pipe $SHMSIZE $SHMOPTION"
+#AUDIOFORMAT="$AUDIOS16LE"', rate='$feed_rate', channels='$feed_channels
+VIDEOFORMAT=$VIDEOBGRA', width='$feed_width', height='$feed_height', framerate=30/1'
+SRC="udpsrc port=5002 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtpjpegdepay ! jpegdec"
+
+#gst-launch-1.0 -v udpsrc port=5002 ! application/x-rtp, payload=96 ! rtpjitterbuffer !  ! videoconvert ! videorate ! 
+#videoscale ! videoconvert ! video/x-raw,format=BGRA,pixel-aspect-ratio=1/1,interlace-mode=progressive, width=800, height=600,
+#framerate=30/1 ! queue ! shmsink socket-path=/tmp/feed2-control-pipe shm-size=81788928 wait-for-connection=1 sync=true
+
+while true ; do
+    # Remove the named pipe if it exist
+    rm -f $feed_control_pipe
+    com="gst-launch-1.0 -v $SRC ! videoconvert ! videorate ! videoscale ! videoconvert ! $VIDEOFORMAT ! queue ! $SHMSINK1"
+
+	echo "#####################"
+	echo $com;
+	echo "#####################"
+	eval $com
+    sleep 2
+done

+ 73 - 0
working-udp-video.sh

@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# IMPORTANT >>>>>You need to get port, ip and feed_id right<<<<<
+if [ "X$SNOWMIX" = X ] ; then
+  echo "You need to set the SNOWMIX environment variable"
+  exit 1
+fi
+if [ "X$SNOWMIX_PORT" = X ] ; then export SNOWMIX_PORT=9999 ;fi
+if [ "X$SNOWMIX_IP" = X ] ; then export SNOWMIX_IP=127.0.0.1 ;fi
+
+if [ $# -lt 1 ] ; then
+  echo "Missing argument\nUsage $0 <feed id> [<audio feed id> [<input file>]"
+  echo "Setting audio feed to 0 disables audio"
+  exit 1
+fi
+
+# Set video feed and audio feed id
+feed_id=$1
+audio_feed_id=0 #DISABLE AUDIO
+
+# Load the Snowmix and GStreamer settings
+. $SNOWMIX/scripts/gstreamer-settings
+. $SNOWMIX/scripts/snowmix-settings
+# This will set
+# a) feed_rate
+# b) feed_channels
+# c) feed_control_pipe
+# d) feed_width
+# e) feed_height
+# f) ctrsocket
+# g) system_width
+# h) system_height
+# i) ratefraction
+# j) snowmix
+# k) channels
+# l) rate
+
+
+if [ X$feed_control_pipe = X -o X$system_width = X -o X$system_height = X ] ; then
+  echo Failed to get control pipe or width or height from running snowmix
+  exit 1
+fi
+
+#echo "Snowmix Geometry        : $system_width x $system_height"
+#echo "Snowmix control socket  : $ctrsocket"
+echo "Video feed geometry     : $feed_width x $feed_height"
+echo "Video control socket    : $feed_control_pipe"
+echo "Video and audio feed id : $feed_id $audio_feed_id"
+
+if [ X$feed_rate = X -o X$feed_channels = X ] ; then
+  echo Failed to get rate or channels from running snowmix
+  echo Disabling audio
+else
+  echo "Audio rate and channels : $feed_rate $feed_channels"
+fi
+
+SHMSIZE='shm-size='`echo "$feed_width * $feed_height * 4 * 26"|bc`
+SHMOPTION="wait-for-connection=1 sync=true"
+SHMSINK1="shmsink socket-path=$feed_control_pipe $SHMSIZE $SHMOPTION"
+#AUDIOFORMAT="$AUDIOS16LE"', rate='$feed_rate', channels='$feed_channels
+VIDEOFORMAT=$VIDEOBGRA', width='$feed_width', height='$feed_height', framerate=30/1'
+SRC="udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 "
+while true ; do
+    # Remove the named pipe if it exist
+    rm -f $feed_control_pipe
+    com="gst-launch-1.0 -v $SRC ! videoconvert ! videorate ! videoscale ! videoconvert ! $VIDEOFORMAT ! queue ! $SHMSINK1"
+
+	echo "#####################"
+	echo $com;
+	echo "#####################"
+	eval $com
+    sleep 2
+done