Skip to content

Instantly share code, notes, and snippets.

View birme's full-sized avatar

Jonas Birmé birme

View GitHub Profile
var aws = require('aws-sdk');
var elastictranscoder = new aws.ElasticTranscoder();
function basename(path) {
return path.split('/').reverse()[0].split('.')[0];
}
exports.handler = (event, context) => {
console.log('Received event:', JSON.stringify(event, null, 2));
var key = event.Records[0].s3.object.key;
@birme
birme / lambda-grafana-adapter.js
Created July 17, 2017 13:22
lambda-grafana-adapter
const request = require('request');
const DATA_API = 'https://data.example.com/api';
const DATA_API_KEY = process.env.API_KEY;
exports.search = function(event, context, callback) {
const targets = [ 'ID1', 'ID2', 'ID3' ];
callback(null, targets);
};
@birme
birme / mse-tutorial.html
Created May 25, 2018 11:30
The basic principles for video streaming using MSE API
<!DOCTYPE html>
<html>
<body>
<video style="width: 640px; height: 360px; border: solid 1px;"></video>
<script>
var queue = [];
// Check that browser has support for media codec
var mimeCodec = 'video/mp4; codecs="avc1.4D401F"';
console.log(MediaSource.isTypeSupported(mimeCodec));
@birme
birme / face-detection.html
Last active October 15, 2020 13:48
A simple test of the Face Detection API in Chrome
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://player.eyevinn.technology/v0.2.4/build/eyevinn-html-player.css">
<style>
body { background-color: black; }
#status {
font-size: 20pt;
font-family: Verdana;
height: 40px;
/**
* This NodeJS gist creates a virtual linear channel (VOD2Live) with one ad break (105 sec) and a trailer,
* both on loop.
*
* npm install --save eyevinn-channel-engine
* node server.js
*
* Then play the HLS from:
* http://localhost:8000/live/master.m3u8?channel=1
*
@birme
birme / ingest-aws.js
Last active September 22, 2021 11:44
Watch-folder upload and transcode with AWS MediaConvert
// This gist shows an example of an ingest application based on Eyevinn Ingest Application Framework [1] plugins
// to watch a folder for a new MP4-file and upload and transcode on AWS using AWS MediaConvert.
// Copyright 2021 Jonas Birmé
//
// [1] https://eyevinn.github.io/ingest-application-framework/
const { AwsUploadModule } = require("@eyevinn/iaf-plugin-aws");
const { watch } = require("chokidar");
const { createReadStream } = require("fs");
@birme
birme / hls-repeat.js
Created November 1, 2021 09:31
An endpoint that on-the-fly repeats an HLS VOD
// $ node hls-repeat.js
// Example (2 reps): http://localhost:8000/slate-consuo2.mp4/master.m3u8?r=2
// where r is how many times the VOD to be repeated
const { HLSProxy } = require("@eyevinn/hls-proxy");
const HLSRepeatVod = require("@eyevinn/hls-repeat");
const proxy = new HLSProxy({
originHandler: async () => {
// Origin where the VOD is found
@birme
birme / gst-tsdemux.c
Created November 29, 2021 22:21
Demux an SRT/MPEG-TS stream using GStreamer
/*
* gcc -Wall gst-tsdemux.c -o gst-tsdemux $(pkg-config --cflags --libs gstreamer-1.0)
*/
#include <gst/gst.h>
#include "utils.h"
typedef struct _CustomData {
GstElement *pipeline;
GstElement *source;
@birme
birme / whpp.html
Created June 24, 2022 10:59
WHPP example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
</head>
<body>
<video autoplay muted playsinline controls></video>
<script type="text/javascript">
const url = "https://<whpp-url>";
https://maitv-vod.lab.eyevinn.technology/UNHINGED_Trailer_2020.mp4/master.m3u8