Skip to content

Instantly share code, notes, and snippets.

@jkotra
Created July 3, 2017 15:26
Show Gist options
  • Save jkotra/272b6afebf24df0dbb71b6ef44646a18 to your computer and use it in GitHub Desktop.
Save jkotra/272b6afebf24df0dbb71b6ef44646a18 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
from conf import *
#####################################
#Jagadeesh Kotra
#https://github.com/jagadeesh-kotra/x264zones
#Contact: Hello@Jagadeesh.me
#####################################
f=open('{0}'.format(file), "r")
b1=f.read()
b2=b1.replace("\n", "").replace("type", "").replace("intdefault", "").replace("0", "").replace("R", "").split()
while len(b2) != 0:
banding=b2
z1=(banding[0])
z2=(banding[1])
z3="crf=0.0"
z4="b=0.0"
if bitrate > 0:
zones2='{1},{0},{2}'.format(z2, z1, z4)
f1=open("x.txt", "a+")
f1.write(zones2)
banding.pop(0)
banding.pop(0)
banding.pop(0)
else:
zones1='{1},{0},{2}'.format(z2, z1, z3)
f1=open("x.txt", "a+")
f1.write(zones1)
banding.pop(0)
banding.pop(0)
banding.pop(0)
final=open("x.txt", "r")
b3=final.read()
b4=b3.replace(".0", "/")
s = b4[:-1]
print ("--zones {0}".format(s))
os.remove("x.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment