Skip to content

Instantly share code, notes, and snippets.

SpiraMirabilis / updateDNS
Last active Dec 30, 2017
Use azure DNS as a dynamic DNS provider
View updateDNS
from azure.mgmt.dns import DnsManagementClient
#from azure.common.credentials import UserPassCredentials
from azure.common.credentials import ServicePrincipalCredentials
from json import load
from urllib2 import urlopen
# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'
SpiraMirabilis /
Created Dec 26, 2017
Converts any video to h264 and any audio tracks to AAC, maintins original bitrate. If video is an old xvid/divx that has packed bitstream it will fix that first. Validates the output file (correct codecs and within SECONDS_FUDGE duration or it is rejected) prior to deleting the original. If your ffmpeg doesn't have libfdk compiled in, just chang…
# This will transcode the file given as an argument into h264/aac. It is designed to be used automatically (triggered by inotify or systemd.path)
# so it is very strict on the output. It checks that the output is valid, an that it is the same duration as the input, if it is correct it will
# delete the original.
# If your ffmpeg is not compiled with libfdk_aac, you can change the libfdk_aac to "aac" and use ffmpeg's encoder which is almost as good as libfdk.
# SECONDS_FUDGE is the number of seconds plus or minus that the transcoded video has to be within duration from the original or we reject it
SECONDS_FUDGE=${SECONDS_FUDGE:-15} # 15 seconds is not too bad if we're mainly doing films.
function checkPacked() {