Skip to content

Instantly share code, notes, and snippets.

@akarak
akarak / sse-fastapi-redis.py
Created April 26, 2024 17:46 — forked from lbatteau/sse-fastapi-redis.py
Server-Sent Events in FastAPI with async Redis Pub/Sub
from aioredis import Channel, Redis
from fastapi import FastAPI
from fastapi.params import Depends
from fastapi_plugins import depends_redis, redis_plugin
from sse_starlette.sse import EventSourceResponse
from starlette.responses import HTMLResponse
html = """
<!DOCTYPE html>
<html>
@akarak
akarak / m3u8-to-mp4.md
Created January 26, 2023 22:15 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@akarak
akarak / debug_client.py
Last active January 17, 2022 12:03
http debug
import requests
import json
if __name__ == '__main__':
params = {'key': 'value'}
requests.post('http://...:8080', json.dumps(params))
@akarak
akarak / README.md
Created November 12, 2021 22:45 — forked from boneskull/README.md
MicroPython on ESP32: MQTT and DS18B20 temperature sensor full example
@akarak
akarak / GetSavedMapsFromGH.ps1
Created November 4, 2021 13:15
Get saved maps from GH using the Viz GH REST API
$gh = 'localhost:19398' # Viz GH REST endpoint
$user = 'R3Vlc3Q6' # Viz GH user (Guest)
$maps = Invoke-RestMethod -Uri "http://${gh}/search?searchTerms=SHARED_MEMORY_MAP" -Headers @{'Authorization' = "Basic ${user}"}
$maps | Select-XML -XPath '//atom:title/text()' -Namespace @{'atom' = 'http://www.w3.org/2005/Atom'} | ForEach-Object {
Write-Host $_
}
@akarak
akarak / GetScenePath.ps1
Last active March 7, 2023 16:39
Get scene path using the Viz GH REST API
$engine = 'localhost:61000' # Viz Engine REST endpoint
$gh = 'localhost:19398' # Viz GH REST endpoint
$user = 'R3Vlc3Q6' # Viz GH user (Guest)
$vizrt_namespaces = @{'types' = 'http://www.vizrt.com/types'}
$gh_request_headers = @{'Authorization' = "Basic ${user}"}
$engine_request_headers = @{'Content-Type' = 'application/json'; 'Accept' = 'application/json'}
$scenes = Invoke-RestMethod -Uri "http://${engine}/api/v1/renderer/layer" -Headers $engine_request_headers
$scenes | Select-Object -ExpandProperty Scene | Where-Object {$_ -NotMatch '00000000-0000-0000-0000-000000000000'} | ForEach-Object {
@akarak
akarak / OBS-SRT-DEBIAN.md
Created May 5, 2021 20:36 — forked from Kusmeroglu/OBS-SRT-DEBIAN.md
Notes on Installing SRT with OBS on Ubuntu / Debian / Linux

Notes on Installing SRT with OBS on Ubuntu / Debian / Linux

Feedback welcomed - if this becomes old or contains misleading information please let me know.

OBS provides some instructions on how to get SRT, but I found that they didn't quite work for me on a fresh minimal install of Ubuntu 20 (Focal). OBS on linux doesn't appear to come with SRT support out of the box.

The OBS Discord community was really helpful, but in the end it took a lot of futzing and following are my notes, in case this is helpful to anyone else.

By the way, if you are considering SRT with OBS, it was extremely painful to install correctly, but then it worked beautifully. The error correction SRT provides was very nice when my wireless signal was poor.

#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# GStreamer SDK Tutorials in Python
#
# basic-tutorial-2
#
"""
basic-tutorial-2: GStreamer concepts
http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+2%3A+GStreamer+concepts
"""
@akarak
akarak / kivy_decklink.py
Created April 4, 2020 16:43 — forked from cbenhagen/kivy_decklink.py
Example of using input from a Blackmagic Decklink or Ultrastudio card in kivy with the use of OpenCV and GStreamer.
I was able to find a VERY QUICK AND DIRTY way to use the media-autobuild suite to compile my own 64-bit static FFmpeg for Windows with the NDI library.
Download it and extract to a place on your computer, and keep note of the path. I put it in "D:\ndi\media-autobuild_suite-master", so for the sake of these instructions when you see "<autobuild>", you need to substitute whatever path you've put it in.
During the initial setup process, request to use the static build and add whatever else you'd like to have in your ffmpeg, then pause what you're doing when the on-screen prompts tell you the ffmpeg_options file has been written, then go into <autobuild>\build\ffmpeg_options.txt and add somewhere a line with
Code:
--enable-libndi_newtek