Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Streaming script (run once) ---
- #!/bin/bash
- # Reads video from the Blackmagic Intensity Pro, and splits in into
- # two streams.
- # One stream is sent to Justin.tv, the other is sent via RTP to two
- # local ports (audio and video), where another thread can read selected
- # slices and write them to disk.
- #
- # Steven Bell <botsnlinux@gmail.com>
- # 25 March 2013
- WEBCAST_SIZE="720x480"
- WEBCAST_FPS="20"
- WEBCAST_BITRATE="1000k"
- RECORD_SIZE="1920x1080"
- RECORD_FPS="30"
- # Streaming settings
- STREAM_KEY="XXXXXX"
- STREAM_URL="rtmp://live.justin.tv/app/$STREAM_KEY"
- VIDEO_RTP_PORT=1234
- AUDIO_RTP_PORT=1236
- # Paths
- export AVCONV_DATADIR=/home/steven/video/tools/libav/presets/
- AVCONV=/home/steven/video/tools/libav/avconv
- BMDTOOLS=/home/steven/video/tools/bmdtools
- $BMDTOOLS/bmdcapture -m 11 -F nut -f pipe:1 | \
- $AVCONV -i - \
- -f pulse -i default \
- -map 0:v \
- -map 1:a \
- -vcodec libx264 -pre:0.0 libx264-main \
- -acodec libmp3lame -ar 44100 -ab 32k \
- -r $WEBCAST_FPS -s $WEBCAST_SIZE -b $WEBCAST_BITRATE \
- -threads 0 \
- -y \
- -f flv "$STREAM_URL" \
- \
- -map 0:v \
- -vcodec mpeg4 -vb 15000k \
- -threads 0 \
- -r $RECORD_FPS -s $RECORD_SIZE \
- -f rtp rtp://127.0.0.1:$VIDEO_RTP_PORT \
- \
- -map 1:a \
- -acodec libmp3lame -ar 44100 -ab 32k \
- -threads 0 \
- -f rtp rtp://127.0.0.1:$AUDIO_RTP_PORT
- --- Recording command (run many times) ---
- #!/bin/bash
- FILENAME=$1
- export AVCONV_DATADIR=/home/steven/video/tools/libav/presets
- # My avconv seems to puke on rtp-ed mpeg headers
- #AVCONV_PATH=/home/steven/video/tools/libav/avconv
- AVCONV_PATH=avconv
- $AVCONV_PATH -i combined.sdp -vcodec copy -acodec copy -y $FILENAME
- --- SDP file ---
- v=0
- o=- 0 0 IN IP4 127.0.0.1
- s=No Name
- t=0 0
- a=tool:libavformat 55.0.0
- m=video 1234 RTP/AVP 96
- c=IN IP4 127.0.0.1
- a=rtpmap:96 H264/90000
- a=fmtp:96 packetization-mode=1
- m=audio 1236 RTP/AVP 14
- c=IN IP4 127.0.0.1
- b=AS:32
Add Comment
Please, Sign In to add comment