Skip to content

Instantly share code, notes, and snippets.

View philhartung's full-sized avatar

Philipp Hartung philhartung

View GitHub Profile
@philhartung
philhartung / dante-aes67-relay.js
Last active February 19, 2024 09:11
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)
View dante-aes67-relay.js
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_sdp.js
Last active November 8, 2023 20:28
Quick and dirty AES67/Dante SAP/SDP Discovery Service. Change sdpConfig and addr accordingly
View aes67_sdp.js
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';
@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.
View ptp.py
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 / stream.sh
Last active October 2, 2023 12:33
Stream a video via network to OBS with low latency (<100ms)
View stream.sh
#!/bin/sh
# host is the IP of the receiving computer
host="192.168.0.101"
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-h264, width=1920, height=1080, framerate=30/1 ! rtph264pay ! udpsink host=$host port=5004
@philhartung
philhartung / aes67.py
Created December 8, 2021 15:33
Simple AES67 implementation using gstreamer. Does not implement any discovery.
View aes67.py
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 / ebur.sh
Last active April 21, 2023 21:23
EBUR128 loudness meter using ffplay, 800x480 resolution for Raspberry Pi touchscreen
View ebur.sh
#/bin/sh
ffplay -exitonkeydown -exitonmousedown -fs -fflags nobuffer -probesize 32 -analyzeduration 1 -f lavfi -i "amovie=default:f=alsa,asplit=2[sv][eb];\
[sv]showvolume=b=0:o=v:w=480:h=23[sv-v];\
[eb]ebur128=video=1:size=754x480[eb-v][out1];\
[eb-v][sv-v]hstack=2[out0]"
@philhartung
philhartung / aes67_play.sh
Last active January 29, 2023 17:50
Play a AES67 stream
View aes67_play.sh
#!/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
@philhartung
philhartung / aes67_icecast.sh
Last active December 7, 2022 14:20
AES67 <> Icecast relay with gstreamer
View aes67_icecast.sh
#!/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 / histogram.bat
Last active November 28, 2022 23:19
ffmpeg scripts for OBS on Windows
View histogram.bat
ffplay.exe -f dshow -i video="OBS Virtual Camera" -vf "format=yuva444p,split=2[a][b];[a]histogram=c=7:fgopacity=0.9[aa];[b][aa]overlay"
@philhartung
philhartung / aes67-multiply.js
Last active August 23, 2022 12:32
Easily multiply an AES67 Stream for load testing. SDP has to be adjusted accordingly
View aes67-multiply.js
const dgram = require('dgram');
const process = require('process');
const sdp = require('./sdp');
let client = dgram.createSocket({ type: 'udp4', reuseAddr: true });
let clients = [];
if(!process.argv[2] || !(parseInt(process.argv[2]) > 0)){
console.log('$ node multiply 12');