Skip to content

Instantly share code, notes, and snippets.

View philhartung's full-sized avatar

Philipp Hartung philhartung

View GitHub Profile
@philhartung
philhartung / aes67_sdp.js
Last active November 8, 2023 20:28
Quick and dirty AES67/Dante SAP/SDP Discovery Service. Change sdpConfig and addr accordingly
var dgram = require('dgram');
var socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
const PORT = 9875;
const MULTICAST_ADDR = '239.255.255.255';
//options, need to be changed
var addr = '127.0.0.1';
var multicastAddr = '239.69.0.119';
#!/bin/sh
gst-launch-1.0 audiotestsrc freq=880 !\
audioconvert !\
audio/x-raw, format=S24BE, channels=2, rate=48000 !\
rtpL24pay !\
application/x-rtp, clock-rate=48000, channels=2 !\
udpsink host=239.69.0.119 port=5004 qos=true qos-dscp=34 multicast-iface=en5
@philhartung
philhartung / aes67_relay.sh
Last active July 9, 2020 12:30
Relay AES67 RTP Stream. SDP/SAP is not implement here.
#!/bin/sh
gst-launch-1.0 udpsrc address=239.69.161.58 port=5004 multicast-iface=eth0 !\
udpsink host=239.69.0.119 port=5004 qos=true qos-dscp=34 multicast-iface=eth1
@philhartung
philhartung / ptp.py
Last active October 5, 2023 03:16
Sync to PTPv2 clock and send RTP according to AES67. SAP/SDP not implemented here.
import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gst, GstNet, GObject, GLib
Gst.init([])
mainloop = GLib.MainLoop()
@philhartung
philhartung / ptp.js
Last active March 8, 2022 16:46
PTPv2 client and RTP relay with timestamping for AES67. Also includes SAP/SDP.
var sdp = require('./sdp');
//SDP Stuff
var samplerate = 48000;
var channels = 2;
var multicastAddr = '239.69.0.111';
var addr = '192.168.1.1';
var encoding = 'L24';
var name = 'RPi 4';
var sessID = Math.floor(Date.now() / 1000);
@philhartung
philhartung / rtp-to-speaker.js
Last active June 11, 2020 20:41
Play raw audio from RTP stream
const Speaker = require('speaker');
const dgram = require('dgram');
const client = dgram.createSocket('udp4');
var speaker = new Speaker({
channels: 2,
bitDepth: 16,
sampleRate: 48000
})
@philhartung
philhartung / dante-aes67-relay.js
Last active April 11, 2024 04:40
Relay a Dante multicast stream to AES67. This assumes the AES67 device is synced to the same PTP master, as no PTP timestamping is done (timestamp from Dante is copied to AES67 RTP packet)
const dgram = require('dgram');
const client = dgram.createSocket({ type: 'udp4', reuseAddr: true });
const sdp = require('./sdp');
//config
const addr = '10.10.1.100';
const danteMulticast = '239.255.220.221';
const aes67Multicast = '239.69.1.122';
const samplerate = 48000;
const channels = 2;
@philhartung
philhartung / aes67_icecast.sh
Last active December 7, 2022 14:20
AES67 <> Icecast relay with gstreamer
#!/bin/sh
gst-launch-1.0 udpsrc address=239.69.161.58 port=5004 multicast-iface=eth0 !\
application/x-rtp, clock-rate=48000, channels=2 !\
rtpjitterbuffer !\
rtpL24depay !\
audioconvert !\
lamemp3enc !\
shout2send mount=/test.mp3 port=8000 username=source password=XXX ip=10.10.0.100
@philhartung
philhartung / aes67_play.sh
Last active January 29, 2023 17:50
Play a AES67 stream
#!/bin/sh
gst-launch-1.0 udpsrc address=239.69.161.58 port=5004 multicast-iface=eth0 !\
application/x-rtp, clock-rate=48000, channels=2 !\
rtpjitterbuffer !\
rtpL24depay !\
audioconvert !\
audioresample !\
autoaudiosink
#!/bin/sh
ffplay -fs -f v4l2 -i /dev/video2 -input_format mjpeg -video_size 1920x1080 -framerate 60.0 -vf "format=yuv444p,split=4[a][b][c][d];\
[a]histogram=c=1,scale=w=-1:h=1080,pad=1920:ih:(ow-iw)/2[aa];\
[b]scale=1920x1080[bb];\
[c]waveform=scale=ire,scale=1920x1080,\
drawbox=0:85:1920:3:GreenYellow:fill,\
drawtext=text=100:x=0:y=50:fontsize=35:fontcolor=GreenYellow,\
drawbox=0:317:1920:3:GreenYellow:fill,\
drawtext=text=75:x=0:y=282:fontsize=35:fontcolor=GreenYellow,\
drawbox=0:546:1920:3:GreenYellow:fill,\