Changes between Version 9 and Version 10 of gstreamer


Ignore:
Timestamp:
03/03/2020 12:11:49 AM (5 years ago)
Author:
Tim Harvey
Comment:

added rtmp section

Legend:

Unmodified
Added
Removed
Modified
  • gstreamer

    v9 v10  
    12501250
    12511251
     1252
     1253[=#rtmp]
     1254== RTMP Streaming
     1255Real-Time Messaging Protocol (RTMP) is a protocol for streaming audio, video and data over the internet. It was originally developed by Macromedia and proprietary but has since been released for public use. It is a TCP-based protocol which maintains persistent connections.
     1256
     1257Using RTMP requires you have:
     1258 * an RTMP server (ie Youtube or Nginx)
     1259 * a stream transmitter (ie Gateworks board)
     1260 * a stream receiver (ie Web browser or Gateworks board)
     1261
     1262[=#youtube]
     1263=== !YouTube Live Streaming
     1264It is possible to stream video to !​YouTube Live Streaming from the Gateworks board using GStreamer's rtmpsink element.
     1265
     1266To create a !YouTube live feed via RTMP:
     1267 - goto !YouTube Live Control Room (https://www.youtube.com/livestreaming/)
     1268 - goto http://youtube.com and login to your account
     1269 - click the Camera icon on the top left to add a stream and select 'Go Live'
     1270 - select Stream at the top
     1271 - create a title and specify your !YouTube attributes (ie Public, etc etc) then hit 'Create Stream'
     1272 - take note of your 'Stream key' needed for the encoder pipeline
     1273 - start your gstreamer pipeline to capture/encode/stream via {{{rtpmsink}}} to the youtube 'Streamer URL' (see [#rtmpsink below])
     1274 - once YouTube says your stream is ready (indicating its receiving data) hit the 'GO LIVE' button at the top left
     1275 - Now you can hit the 'Share' icon at the top left to get a URL to share to view the stream
     1276
     1277 
     1278[=#rtmpsink]
     1279=== GStreamer rtmpsink transmitter
     1280Once you have an RTMP server you can use GStreamer to stream live content to it with the {{{rtmpsink}}} element.
     1281
     1282Examples:
     1283 * color-bar pattern from videotestsrc and audio from audiotestsrc
     1284{{{#!bash
     1285gst-launch-1.0 \
     1286  videotestsrc ! "video/x-raw,width=640,height=360,framerate=15/1" ! \
     1287  v4l2h264enc extra-controls="controls,h264_profile=4,video_bitrate=620000" ! \
     1288  h264parse ! \
     1289  mux. \
     1290audiotestsrc is-live=true ! "audio/x-raw,format=S16LE,endianness=1234, signed=true,width=16,depth=16,rate=44100,channels=2" ! \
     1291  voaacenc bitrate=128000 ! \
     1292  aacparse ! "audio/mpeg,mpegversion=4,stream-format=raw" ! \
     1293  mux. \
     1294flvmux streamable=true name=mux ! queue ! \
     1295 rtmpsink location="rtmp://a.rtmp.youtube.com/live2/ee12-bsgt-e22v-8qr1"
     1296}}}
     1297 * captured video/audio:
     1298{{{#!bash
     1299gst-launch-1.0 \
     1300  v4l2src device=$DEVICE ! \
     1301  v4l2h264enc extra-controls="controls,h264_profile=4,video_bitrate=620000" ! \
     1302  h264parse ! \
     1303  mux. \
     1304alsasrc device="sysdefault:CARD=sgtl5000audio" ! \
     1305  voaacenc bitrate=128000 ! \
     1306  aacparse ! "audio/mpeg,mpegversion=4,stream-format=raw" ! \
     1307  mux. \
     1308flvmux streamable=true name=mux ! queue ! \
     1309 rtmpsink location="rtmp://a.rtmp.youtube.com/live2/ee12-bsgt-e22v-8qr1"
     1310}}}
     1311
     1312Note that the {{{location}}} property of the {{{rtmpsink}}} is configured on your server. For !YouTube for example they provide the URL and you need to append the 'Stream Key' to that path
     1313
     1314
    12521315[=#troubleshooting]
    12531316= Troubleshooting