mpegize: add support for dcraw_emu
This commit is contained in:

committed by
Martijn Braam

parent
15a999cb87
commit
53854bdf73
21
mpegize.py
21
mpegize.py
@@ -498,6 +498,19 @@ class Mpegize:
|
||||
def display_frames(m, v):
|
||||
return "%d frames %s" % (v, m.display_usec(v * 1000000 / 30.))
|
||||
|
||||
def dcraw_detect(m):
|
||||
m.dcraw_bin = shutil.which("dcraw_emu")
|
||||
if not m.dcraw_bin and os.path.isfile("/usr/lib/libraw/dcraw_emu"):
|
||||
m.dcraw_bin = "/usr/lib/libraw/dcraw_emu"
|
||||
if not m.dcraw_bin:
|
||||
m.dcraw_bin = "dcraw"
|
||||
return m.dcraw_bin
|
||||
|
||||
def tiffname(m, f):
|
||||
if m.dcraw_bin == "dcraw":
|
||||
f = f[:-4]
|
||||
return f + '.tiff'
|
||||
|
||||
def jpegize(m):
|
||||
i = 0
|
||||
os.chdir(m.base)
|
||||
@@ -506,6 +519,7 @@ class Mpegize:
|
||||
l = list(l)
|
||||
l.sort()
|
||||
print("Have", m.display_frames(len(l)), "dngs")
|
||||
m.dcraw_detect()
|
||||
for n in l:
|
||||
if n[-4:] != ".dng":
|
||||
print("Something went terribly wrong")
|
||||
@@ -514,7 +528,8 @@ class Mpegize:
|
||||
print("Message: %.0f%%" % ((100*i) / len(l)))
|
||||
sys.stdout.flush()
|
||||
base = n[:-4]
|
||||
subprocess.run(['dcraw',
|
||||
tiffname = m.tiffname(n)
|
||||
subprocess.run([m.dcraw_bin,
|
||||
'-w', # -w Use camera white balance
|
||||
'+M', # +M use embedded color matrix
|
||||
'-H', '2', # -H 2 Recover highlights by blending them
|
||||
@@ -522,8 +537,8 @@ class Mpegize:
|
||||
'-q', '0', # -q 0 Debayer with fast bi-linear interpolation
|
||||
'-f', # -f Interpolate RGGB as four colors
|
||||
'-T', n]) # -T Output TIFF
|
||||
subprocess.run(['convert', base+'.tiff', base+'.jpeg'])
|
||||
os.unlink(base+'.tiff')
|
||||
subprocess.run(['convert', tiffname, base+'.jpeg'])
|
||||
os.unlink(tiffname)
|
||||
os.unlink(n)
|
||||
os.rename(base+'.jpeg', m.source+"/"+base+'.jpeg.sv')
|
||||
|
||||
|
Reference in New Issue
Block a user