Skip to content

Instantly share code, notes, and snippets.

View sinkers's full-sized avatar

Andrew Sinclair sinkers

View GitHub Profile
@sinkers
sinkers / gist:5567058
Created May 13, 2013 09:02
Generating keyframes for ffmpeg HLS encoding
def keyframe_string(video_length, keyframe_int):
# Generates a string of times in ffmpeg format hh:mm:ss.000, hh:mm:ss.000
# Creates times for 0 to video length every keyframe_int
# video_length: in milliseconds
# keyframe_int: in seconds
keyframe_str = ""
if (keyframe_int > 0):
# convert to secs from millisecs
length_secs = float(video_length) / 1000
num_keyframes = length_secs / keyframe_int
@sinkers
sinkers / gist:766f86755ad7b36e60e1
Created June 17, 2014 06:14
Check keyframe alignment with ffprobe
#!/usr/bin/python
'''
This simple script allows you to input a file where you want to evaluate where the keyframes are
You simply input an infile that you want to evaluate
Where you expect the keyframes e.g. every 2 seconds
and the framerate e.g. 25 fps
It then scans the file and reports on where it expects keyframes and where they actually are
'''
<adRequest networkId="375613" version="1" profile="375613:MSN_AU_iOS_Live">
<capabilities>
<supportsSlotTemplate />
<supportsAdUnitInMultipleSlots />
<supportNullCreative />
<supportsSlotCallback />
<requiresVideoCallbackUrl />
<supportsFallbackAds />
<expectMultipleCreativeRenditions />
<requiresRendererManifest />
<adRequest networkId="375613" version="1" profile="375613:MSN_AU_iOS_Live">
<capabilities>
<supportsSlotTemplate />
<supportsAdUnitInMultipleSlots />
<supportNullCreative />
<supportsSlotCallback />
<requiresVideoCallbackUrl />
<supportsFallbackAds />
<expectMultipleCreativeRenditions />
<requiresRendererManifest />
@sinkers
sinkers / gist:f7309393298ca407b84e
Created June 18, 2014 00:26
iOS not requesting wrapper ad
<adRequest networkId="375613" version="1" profile="375613:MSN_AU_iOS_Live">
<capabilities>
<supportsSlotTemplate />
<supportsAdUnitInMultipleSlots />
<supportNullCreative />
<supportsSlotCallback />
<requiresVideoCallbackUrl />
<supportsFallbackAds />
<expectMultipleCreativeRenditions />
<requiresRendererManifest />
@sinkers
sinkers / gist:5fae09f089f746c9fcaf
Created June 24, 2014 06:06
Creating XML for Brightcove Once
from lxml import etree
import brightcove
'''
This script extracts data from a given brightcove account and formats a request suitable for ingest into Brightcove ONCE
Sample format:
<items>
<!--
fetched from https://api.brightcove.com/services/library?command=search_videos&all=the%20battles&none=blind&all=series:the%20voice&video_fields=lastModifiedDate,name,referenceid,renditions,id,cuepoints&media_delivery=http&sort_by=MODIFIED_DATE:DSC&token=&
@sinkers
sinkers / freewheelvmap.py
Last active April 2, 2019 17:26
Generating a Freewheel VMAP 1.0 Ad Tag
import requests
import random
import xml.dom.minidom
'''
Simple script to simulate what needs to go in a Freewheel ad request
This example is for VMAP but what needs to be requested is similar on other response types e.g. FW Smart XML
To use Smart XML response just change the resp parameter to "xml"
'''
<adRequest networkId="90750" version="1" profile="90750:ooyala_android">
<capabilities>
<supportsSlotTemplate />
<supportsAdUnitInMultipleSlots />
<supportNullCreative />
<supportsSlotCallback />
<requiresVideoCallbackUrl />
<supportsFallbackAds />
<expectMultipleCreativeRenditions />
<requiresRendererManifest />
@sinkers
sinkers / gist:148a39f8d926a443501a
Created July 11, 2014 01:42
Simple script for encoding files for use with Akamai HD and generating a SMIL file
#!/bin/bash
VIDSOURCE=$1
OUTNAME=$2
RESOLUTION1="320x180"
RESOLUTION2="512x288"
RESOLUTION3="640x360"
RESOLUTION4="960x540"
RESOLUTION5="1024x576"
RESOLUTION6="1280x720"
RESOLUTION7="1920x1080"
@sinkers
sinkers / gist:c4d39960018bca3540d4
Created July 11, 2014 04:12
Script for multiple bitrate encoding with text on each bitrate for testing
#!/bin/sh
# encode_bitrate_overlay.sh
#
#
# Created by Andrew Sinclair on 11/07/2014.
#
#!/bin/bash
VIDSOURCE=$1
OUTNAME=$2