AWS Janus Gateway strangeness

Can anyone think of a reason why this might happen? (janus gateway is a webRTC gateway –

  • Free tier t2.micro AWS, brand new account
  • select ami-886e3aff (via, create instance, all defaults; new security group with all tcp and upd ports open; used default vpc, new key
  • chown 400 hsh7.pem
  • ssh -i hsh7.pem -v ubuntu@public-ip
  • installation steps below

result: go to http://public-ip/janus-gateway-streamtest.html in Firefox 40

In my house I can see a testcard.

On no other network can anyone see a testcard.



sudo apt-get update && sudo apt-get upgrade

sudo aptitude install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev pkg-config gengetopt libtool automake dh-autoreconf gupnp-igd-1.0

git clone
cd janus-gateway
./configure --disable-websockets --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus
sudo make install
sudo make configs

sudo pico /opt/janus/etc/janus/janus.plugin.streaming.cfg

type = rtp
id = 1
description = RPWC H264 test streaming
audio = yes
audioport = 8005
audiopt = 10
audiortpmap = opus/48000/2
video = yes
videoport = 8004
videopt = 96
videortpmap = H264/90000
videofmtp = profile-level-id=42e028\;packetization-mode=1

Installing gStreamer and Nginx

sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad libgstreamer-plugins-base1.0-dev

sudo aptitude install nginx

cd /var/www/html

sudo cp -r /opt/janus/share/janus/demos/* .

sudo curl -O

sudo service nginx start

test – 2 x windows

gst-launch-0.10 videotestsrc ! video/x-raw-rgb,width=640,height=480,framerate=30/1 ! videoscale ! videorate ! ffmpegcolorspace ! timeoverlay ! x264enc bitrate=256000 profile=1 tune=zerolatency ! rtph264pay ! udpsink host= port=8004

/opt/janus/bin/janus -F /opt/janus/etc/janus

HackspaceHat part 2: Streaming to a remote sever

We’ve made more progress on the HackspaceHat (HackspaceHat is a telepresence hat for exploring Hackspaces). Part 1 has a bit more background.


  • We have a hat! At Barney’s suggestion it’s an Isambard Kingdom Brunel-style stovepipe hat (£6!), giving it a Bristol theme but also plenty of room for electronics / batteries etc. Other hackspaces would need to choose a hat appropriate to their locale.
  • We’ve decided on a means to ensure that people are aware that the camera and audio are being used. Our initial thought was an emergency services style flashing blue light, but Alaric had a better idea: an “On The Air” sign with a light built into the hat.
  • We did a local test of the components draped over the hat to work out the position of the camera.
  • We realised we should use it for reporting live from Bristol Mini Maker Faire!
  • We’ve managed to get it working on a remote server, after some bother with ec2.

Here’s some information about the remote part. It still doesn’t work on an ec2 instance and I’m quite baffled as to why not – any ideas appreciated. It’s very strange because it does work from within my house when run on an ec2. But not when accessed from anywhere else.

Here’s what I did:

  • Ran up a new instance of Ubuntu LTS 15.04 on ec2 under a VPC
  • Installed janus-gateway and gstreamer

I opened up all the ports required for Janus-gateway with my video stream (inbound ports):

Custom UDP Rule UDP 8004
Custom TCP Rule TCP 8088

I ran this test gstreamer pipeline, which just creates a testcard and streams it to port 8004 on localhost:

gst-launch-0.10 videotestsrc ! video/x-raw-rgb,width=640,height=480,framerate=30/1 ! videoscale ! videorate ! ffmpegcolorspace ! timeoverlay ! x264enc bitrate=256000 profile=1 tune=zerolatency ! rtph264pay ! udpsink host= port=8004

Downloaded my testpage into /usr/share/nginx/www/

cd /var/www/html
sudo curl -O

Started Janus gateway with this config at /opt/janus/etc/janus/janus.plugin.streaming.cfg:

type = rtp
id = 1234
description = H.264 live stream coming from gstreamer
audio = no
video = yes
videoport = 8004
videopt = 126
videortpmap = H264/90000
videofmtp = profile-level-id=42e01f\;packetization-mode=1

/opt/janus/bin/janus -F /opt/janus/etc/janus

Went to http://<ec2_public_ip>/janus-gateway-streamtest.html on Firefox 39.

Expected behaviour: see a testcard, like this:


…and inside my home network I do, but on any other network, I don’t see anything, and sometimes get an ICE error in the console:

Object { janus: "hangup", session_id: 10826300, sender: 1905332350, reason: "ICE failed" } janus.js:196:3


Exactly the same set up on an identical Linode instance works perfectly, from everywhere.

The difference might be that ec2 instances have all incoming ports firewalled by default, but it’s very strange even so. Why would it only work in my house?

Anyway, it works! sort of! I set up a gstreamer pipeline on a pi 2 sending its streams to the linode instance and that was fine, though not very peer-to-peer (kudos to AndrewN for arguing that that was actually more efficient if there are multiple clients accessing it).

danbri and I tested it Bristol->Sarajevo with an irc command channel (“turn right!”).

It kind of works over 3G too, which raises interesting possibilities.

Next jobs:

  • Try and make it more p2p
  • Run up a stun / turn server instead of using the Janus defaults
  • Add in an audio command channel
  • Continue investigating the ec2 problems