Skip to content

Instantly share code, notes, and snippets.

View kuu's full-sized avatar

Kuu Miyazaki kuu

  • Tokyo - Japan
View GitHub Profile
@kuu
kuu / extract-audio-from-rtmp.js
Created July 20, 2020 03:20
Sample code for extracting audio from RTMP stream
const fs = require('fs');
const path = require('path');
const {Writable, Transform} = require('stream');
const {writeData, type: {FLVFile, FLVHeader, FLVTag}} = require('@mediafish/flv');
const {createSimpleServer} = require('@mediafish/rtmp-server');
class Terminator extends Writable {
constructor() {
super({objectMode: true});
}
@kuu
kuu / index.js
Last active April 27, 2020 10:52
A script to parse SCTE-35 SpliceInfo message
#!/usr/bin/env node
printInfo(process.argv[2]);
function printInfo(base64String) {
if (!base64String) {
return console.log('Base64 string should be provided');
}
const spliceInfo = parseSpliceInfo(Buffer.from(base64String, 'base64'));
@kuu
kuu / get-xml.js
Last active August 21, 2020 07:22
Node example for downloading event XMLs
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const {URL} = require('url');
const qs = require('querystring');
const ElementalApi = require('elemental-api');
const xmlJs = require('xml-js');
const HOST = process.argv[2];
#!/usr/bin/env node
const hlx = require('hlx-lib');
const srcUrl = process.argv[2];
const {Transform} = require('stream');
class DurationChecker extends Transform {
constructor() {
@kuu
kuu / delete-all-objects.py
Created September 2, 2019 06:02
CLI for delete all objects in MediaStore container
#!/usr/bin/python
import sys
import subprocess
import json
args = sys.argv
def deleteObject(endpoint, path, name):
print ('deleteObject("{0}", "{1}", "{2}"))'.format(endpoint, path, name))
@kuu
kuu / print-streams.js
Last active August 7, 2018 23:21
Print stream info
const OoyalaApi = require('ooyala-api');
const api = new OoyalaApi('API Key', 'API Secret', {concurrency: 6});
print();
function print() {
return api.get('/v2/assets', {where: `asset_type='video'`, limit: 500}, {recursive: true})
.then(async items => {
for (const asset of items) {
@kuu
kuu / storage-summary.js
Created June 5, 2018 13:58
Get storage summary for each account
const OoyalaApi = require('ooyala-api');
const providers = [
{
name: 'Account-1',
key: 'API-KEY for Account-1',
secret: 'API-SECRET for Account-1'
},
{
name: 'Account-2',
const OoyalaApi = require('ooyala-api');
const api = new OoyalaApi("Your-API-Key", "Your-API-Secret");
api.get('/v2/assets', {limit: 500}, {recursive: true})
.then(list => {
return list.filter(asset => asset.asset_type === 'video');
})
.then(list => {
return Promise.all(list.map(asset => getSourceFileSize(asset.embed_code)));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IQ JS SDK Demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="//player.ooyala.com/static/v4/stable/4.10.6/core.min.js"></script>
<script src="//player.ooyala.com/static/v4/stable/4.10.6/video-plugin/main_html5.min.js"></script>
<script src="//player.ooyala.com/static/v4/stable/4.10.6/video-plugin/osmf_flash.min.js"></script>
<script src="//player.ooyala.com/static/v4/stable/4.10.6/video-plugin/bit_wrapper.min.js"></script>

Setup

Each of us runs six servers on a single local machine, so that we can show responsive demos. Below are the instructions on how to run the servers locally.

#/bin/sh