| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #!/bin/bash
- SNOWMIX=/usr/local/lib/Snowmix-0.5.1
- vbitrate=4000
- vbitrate=1000
- vbitrate=700
- abitrate=64000
- 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"
- #VIDEOCONVERT="video/x-raw, width=800, height=600 ! videoconvert"
- # 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=4"
- videoencoder="x264enc bitrate=$vbitrate key-int-max=$keyint bframes=$h264_bframes byte-stream=false aud=true speed-preset=4"
- #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"
- VIDEO='video/x-raw, format=(string)BGRA, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive'
- VIDEOFORMAT=$VIDEO', framerate='$framerate', width='$width', height='$height
- AUDIO=audio/x-raw
- 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" ) | \
- /bin/nc -q -1 127.0.0.1 9999 | \
- (head -1
- gst-launch-1.0 -q -e \
- $VIDEOSRC !\
- $VIDEOFORMAT !\
- queue !\
- $VIDEOCONVERT !\
- $videoencoder !\
- $ENCVIDEOFORMAT !\
- queue !\
- mux. $AUDIOSRC !\
- $AUDIOFORMAT !\
- queue !\
- $audioencoder !\
- $ENCAUDIOFORMAT !\
- queue !\
- flvmux streamable=true name=mux !\
- queue !\
- fdsink
- )
- exit
|