Skip to content

Instantly share code, notes, and snippets.

View sinkers's full-sized avatar

Andrew Sinclair sinkers

View GitHub Profile
@sinkers
sinkers / gist:5cc2854e01a05a2db650
Created July 11, 2014 07:07
Creating multiple DASH renditions with a bitrate text overlay, using ffmpeg and Bento
#!/bin/sh
# encode_bitrate_overlay.sh
#
#
# Created by Andrew Sinclair on 11/07/2014.
#
#!/bin/bash
VIDSOURCE=$1
OUTNAME=$2
@sinkers
sinkers / livestreammonitor.py
Created July 14, 2014 04:50
Script for live video streaming monitoring with notifications
#!/usr/bin/python
'''
Script to monitor live streams and send an Amazon SNS if the stream is down (and possibly take restorative action)
Future:
Black detect: ffmpeg -i out.mp4 -vf blackdetect -f null -
Note the following doesn't seem to fully work without looking at the debug logs
On live ffmpeg -y -i rtmp://cp30129.live.edgefcs.net/live/videoops-videoops@50541 -vf blackdetect -t 10 -loglevel debug -f null -
'''
@sinkers
sinkers / gist:4e35c1b9922b8bd85452
Last active August 28, 2018 18:50
Encoding HLS and DASH in a simple script, lot's of tweaks to go
#!/usr/bin/python
# Script to encode HLS and DASH from a multi TS mezzanine file
# Places encoded files in a folder of the same name as the source input
# Steps
# 1. Check file with mediainfo (optional)
# 2. Encode to resolutions as mp4
# 3. Split into TS segments and create playlists
# 4. Create variant playlist
import subprocess
@sinkers
sinkers / gist:7200afc08a6118f073a9
Created August 25, 2014 04:55
Simple tornado based server
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
import tornado.netutil
import requests
import os
import netifaces
from worker import app
from worker import register
@sinkers
sinkers / gist:fac6da1475dc49c038ac
Created August 25, 2014 05:04
Simple task submission to Celery
# First part is a unit test script effectively, this code would go in the Flask app
from celery import Celery
# There needs to be a seperate tasks module, see below
import tasks
# Celery uses redis to commuicate between tasks
celery = Celery("app", broker='redis://localhost:6379',backend='redis://localhost:6379')
# This submits the task to run via Celery
@sinkers
sinkers / tasks.py
Created September 5, 2014 02:36
Celery chord issue
# tasks.py
from celery import task, Celery, subtask, group
import time
REDIS_SERVER = 'redis://localhost:6379'
celery = Celery("app", broker=REDIS_SERVER, backend=REDIS_SERVER)
@task()
def task1(input):
@sinkers
sinkers / check_keyframes.py
Last active November 16, 2019 19:56
Checking keyframe alignment using ffprobe
import re
import subprocess
import logging
import math
import json
import pygal
import sys
logger = logging.getLogger(__name__)
'''
@sinkers
sinkers / gist:b82afb75ccc78404f60e
Created September 7, 2014 07:15
Created Bento but not working
mp4info --verbose init.mp4
File:
major brand: isom
minor version: 200
compatible brand: isom
compatible brand: iso2
compatible brand: avc1
compatible brand: mp41
compatible brand: iso6
@sinkers
sinkers / gist:6fabe057ee9a966a621a
Created September 8, 2014 02:03
Working PR Android License request and response
http://playready.directtaps.net/pr/svc/rightsmanager.asmx?PlayEnablers=786627D8-C2A6-44BE-8F88-08AE255B01A7
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AcquireLicense xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols">
<challenge>
<Challenge xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/messages">
<LA xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols" Id="SignedData" xml:space="preserve">
<Version>1</Version>
<ContentHeader>
@sinkers
sinkers / gist:170b1a35cc1114adac88
Created September 8, 2014 02:04
Not working PR Android request response
http://playready.directtaps.net/pr/svc/rightsmanager.asmx?PlayEnablers=786627D8-C2A6-44BE-8F88-08AE255B01A7
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AcquireLicense xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols">
<challenge>
<Challenge xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/messages">
<LA xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols" Id="SignedData" xml:space="preserve">
<Version>1</Version>
<ContentHeader>