Skip to content

Instantly share code, notes, and snippets.

@wiiaboo
wiiaboo / gist:757551
Created December 28, 2010 18:56
CorrectNTSCRationalFramerate() port
from fractions import Fraction
from math import floor
class AVRational:
num = 1
den = 1
def av_q2d(rational):
return float(Fraction(rational.num,rational.den))
#improve tcconv's algorithm
with open('test/tc1-vfr.txt','r') as v1f:
v1 = v1f.readlines()
del v1[0]
fpsa = float(v1.pop(0).split(' ')[1])
max = 60000
ts = fn1 = fn2 = last = 0
asm = 1000/fpsa
o=[b'# timecode format v2\n']
@wiiaboo
wiiaboo / encode.bat
Created January 20, 2011 20:39
Testan sum x264
SET frames=--seek 1000 --frames 3000
SET const=--preset placebo --index ll3.mkv.x264.index ll3.mkv --rc-lookahead 250 --ssim
SET const2=--preset placebo --index ll3.mkv.x264-10.index ll3.mkv --ssim
SET fgo5=--fgo 5
SET tune=--tune animation
SET fgo7=--fgo 7
SET psyani1=--psy-rd 0.4:0.1
SET psyani5=--psy-rd 0.4:0.5
SET psy1=--psy-rd 1.0:0.1
SET psy5=--psy-rd 1.0:0.5
# Macro for AvsPmod
# Adds trim(n,n) for every bookmark
bookmarks = avsp.GetBookmarkList()
bookmarks.sort()
avsp.InsertText("\n")
bkNum = len(bookmarks)
def trim(first,last,n):
return "Trim(%d,%d)%s" % (first, last-1, n)
if bkNum > 1:
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE Tags SYSTEM "matroskatags.dtd"> -->
<Chapters>
<EditionEntry>
<EditionFlagHidden>0</EditionFlagHidden>
<EditionFlagDefault>1</EditionFlagDefault>
<EditionFlagOrdered>1</EditionFlagOrdered>
<EditionUID>674122</EditionUID>
# Converts SSA and ASS subtitles to SRT format. Only supports UTF-8.
# Output may differ from Aegisub's exporter.
#
# Requires Python 2.6+.
#
# Copyright 2010 by Poor Coding Standards. All Rights Reserved
import codecs
import sys
diff --git a/vfr.py b/vfr.py
index 25cd3d7..2d11d62 100755
--- a/vfr.py
+++ b/vfr.py
@@ -522,7 +522,7 @@ def parse_trims(avs, fps, outfps=None, otc=None, input=None, label=None):
if outfps and fps != outfps:
ofps = parse_tc(outfps, int(Trims[-1][1])+2)[0]
if otc:
- max = convert_fps([int(Trims[-1][1])],tc,ofps)
+ max = convert_fps([[int(Trims[-1][1])]],tc,ofps)[0]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, zlib, glob, re
#import subprocess
#import shutil
#from optparse import OptionParser
def crc32_checksum(filename):
crc = 0
@wiiaboo
wiiaboo / fraps.bat
Created December 8, 2011 22:57
Fraps encoding script
@echo off
set debug=0
color 07
if %debug% == 1 echo [DEBUG MODE]
echo ***********************************************************
echo *
echo * ########################
echo * # FRAPS Encoding Batch #
@wiiaboo
wiiaboo / fiximportexceptions.patch
Created July 24, 2012 14:21
Fix import exceptions to work with Python 3
diff --git a/animecheck.py b/animecheck.py
index b0e461e..03c74c8 100755
--- a/animecheck.py
+++ b/animecheck.py
@@ -32,7 +32,11 @@ There is NO WARRANTY, to the extent permitted by law.
'''
import codecs
-import exceptions
+# Python 3 doesn't have an exceptions module