|
|
@@ -0,0 +1,92 @@
|
|
|
+#!/bin/bash
|
|
|
+
|
|
|
+vbitrate=4000
|
|
|
+vbitrate=1000
|
|
|
+
|
|
|
+abitrate=128000
|
|
|
+
|
|
|
+feed_id=1
|
|
|
+audio_feed_id=1
|
|
|
+audio_sink_id=1
|
|
|
+
|
|
|
+. $SNOWMIX/scripts/gstreamer-settings
|
|
|
+. $SNOWMIX/scripts/snowmix-settings
|
|
|
+
|
|
|
+width=$feed_width
|
|
|
+height=$feed_height
|
|
|
+framerate=$(echo "$framerate" | cut -f 1 -d.) #this is getting populated with 25.000 which x264enc doesn't like
|
|
|
+audiorate=$feed_rate
|
|
|
+channels=$feed_channels
|
|
|
+
|
|
|
+#width=1024
|
|
|
+#height=768
|
|
|
+#framerate=25
|
|
|
+#audiorate=48000
|
|
|
+#channels=2
|
|
|
+
|
|
|
+###################### Settings ########################
|
|
|
+########################################################
|
|
|
+# THe following settings should not be changed
|
|
|
+h264_level=4.1
|
|
|
+h264_profile=high
|
|
|
+h264_bframes=0
|
|
|
+keyint=$(echo "2 * $framerate" |bc)
|
|
|
+
|
|
|
+
|
|
|
+VIDEOCONVERT=videoconvert
|
|
|
+VIDEO='video/x-raw, format=(string)BGRA, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive'
|
|
|
+AUDIO=audio/x-raw
|
|
|
+# VIDEO=video/x-raw-yuv
|
|
|
+afid="format=(string)S16LE, "
|
|
|
+
|
|
|
+ENCAUDIOFORMAT='aacparse ! audio/mpeg,mpegversion=4,stream-format=raw'
|
|
|
+videoencoder="x264enc bitrate=$vbitrate key-int-max=$keyint bframes=$h264_bframes byte-stream=false aud=true" #speed-preset=1"
|
|
|
+videoencoder="x264enc bitrate=$vbitrate key-int-max=$keyint bframes=$h264_bframes byte-stream=false aud=true speed-preset=5"
|
|
|
+#default=6=medium, 5=fast, 4=faster...0=none
|
|
|
+
|
|
|
+audioencoder="faac bitrate=$abitrate"
|
|
|
+audioencoder="voaacenc bitrate=$abitrate" #FIXME I changed faac to voaacenc as faac is not on my machine
|
|
|
+
|
|
|
+serverurl='rtmp://curso.especificosba.com.ar/src/movie'
|
|
|
+serverurl='rtmp://localhost/rpi/movie'
|
|
|
+serverurl='rtmp://localhost/rpi2/movie'
|
|
|
+
|
|
|
+location=$serverurl
|
|
|
+framerate="$framerate/1" #Fraction
|
|
|
+
|
|
|
+ENCVIDEOFORMAT='h264parse ! video/x-h264,level=(string)'$h264_level',profile='$h264_profile
|
|
|
+ENCVIDEOFORMAT="h264parse ! video/x-h264,level=(string)$h264_level,profile=$h264_profile"
|
|
|
+
|
|
|
+VIDEOFORMAT=$VIDEO', framerate='$framerate', width='$width', height='$height
|
|
|
+AUDIOFORMAT=$AUDIO', '$afid' endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)'$audiorate', channels=(int)'$channels
|
|
|
+
|
|
|
+# ctrsocket must match system socket in running Snowmix
|
|
|
+ctrsocket=/tmp/mixer1
|
|
|
+# audiosink must match audio sink in running Snowmix
|
|
|
+audiosink=1
|
|
|
+VIDEOSRC='shmsrc socket-path='$ctrsocket' do-timestamp=true is-live=true'
|
|
|
+AUDIOSRC="fdsrc fd=0 do-timestamp=true"
|
|
|
+
|
|
|
+
|
|
|
+( echo "audio sink ctr isaudio $audiosink" ; sleep 100000000 ) | \
|
|
|
+ /bin/nc 127.0.0.1 9999 | \
|
|
|
+ (head -1
|
|
|
+ gst-launch-1.0 -v \
|
|
|
+ $VIDEOSRC !\
|
|
|
+ $VIDEOFORMAT !\
|
|
|
+ queue !\
|
|
|
+ $VIDEOCONVERT !\
|
|
|
+ $videoencoder !\
|
|
|
+ $ENCVIDEOFORMAT !\
|
|
|
+ queue !\
|
|
|
+ mux. $AUDIOSRC !\
|
|
|
+ $AUDIOFORMAT !\
|
|
|
+ queue !\
|
|
|
+ $audioencoder !\
|
|
|
+ $ENCAUDIOFORMAT !\
|
|
|
+ queue !\
|
|
|
+ flvmux streamable=true name=mux !\
|
|
|
+ queue !\
|
|
|
+ rtmpsink location="$location"
|
|
|
+ )
|
|
|
+exit
|