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