return optparse.Values(opts.__dict__)
def insert_mplayer_options(cmd, o):
- do_opt = partial(append_cmd, cmd)
-
- if o.deinterlace:
- cmd += ["-vf-pre", "yadif"]
- if o.noskip:
- cmd += ["-noskip"]
- if o.skipkb:
- cmd += ["-sb", str(o.skipkb * 1024)]
+ if o.mplayer_done:
+ return
+ do_opt = partial(append_cmd, cmd)
do_opt("-mc", o.mc)
- do_opt("-fps", o.ifps)
do_opt("-ss", o.startpos)
do_opt("-endpos", o.endpos)
do_opt("-dvd-device", o.dvd)
do_opt("-aid", o.audioid)
do_opt("-sid", o.subtitleid)
do_opt("-vf", o.vfilters)
- do_opt("-af-add", o.afilters)
+ do_opt("-af", o.afilters)
+
+ if o.deinterlace:
+ cmd += ["-vf-pre", "yadif"]
+ if o.detelecine:
+ cmd += ["-vf-pre", "pullup,softskip", "-ofps", "24000/1001"]
+ if o.noskip:
+ cmd += ["-noskip"]
+ if o.skipkb:
+ cmd += ["-sb", str(o.skipkb * 1024)]
class Command(object):
-class MencoderFixRemux(Command):
+class MencoderLossless(Command):
def init(self):
self.check_command("mencoder")
- self.check_no_file("remux.avi")
+ self.check_no_file("lossless.avi")
- orig = self.opts
- self.opts = duplicate_opts(orig)
- orig.input = "remux.avi"
- orig.dvd = orig.chapter = orig.startpos = orig.endpos = None
+ ofut = self.opts
+ self.opts = duplicate_opts(ofut)
+ ofut.input = "lossless.avi"
+ ofut.mplayer_done = True
def run(self):
+ fifo = False
+ if fifo:
+ os.mkfifo("lossless.avi")
o = self.opts
- cmd = [
- "mencoder",
- "-o", "remux.avi",
- "-oac", "copy", "-ovc", "copy",
- "-mc", "0.1",
- o.input,
- ]
- do_opt = partial(append_cmd, cmd)
- do_opt("-dvd-device", o.dvd)
- do_opt("-chapter", o.chapter)
- do_opt("-ss", o.startpos)
- do_opt("-endpos", o.endpos)
- self.do_exec(cmd)
-
-
+ cmd = []
+ cmd += ["mencoder", self.opts.input, "-o", "lossless.avi"]
+ cmd += ["-noconfig", "all"]
+ cmd += ["-oac", "copy", "-ovc", "lavc", "-lavcopts", "vcodec=ffv1:autoaspect"]
+ insert_mplayer_options(cmd, self.opts)
+ cmd += ["-vf-add", "harddup"]
+ self.do_exec(cmd, wait=not fifo)
commands=[MPlayer, X264, Wait, MencoderCopyAC3, MKVMerge],
mplayeropts=["-nosound"],
x264opts=["--preset", "veryslow", "--crf", "20"],
+ ),
+
+ "x264/lame/fast" :
+ Profile(
+ commands=[MPlayer, X264, Lame, Wait, MKVMerge],
+ mplayeropts=[],
+ x264opts=["--preset", "fast", "--crf", "23"],
lameopts=["--preset", "medium"],
),
parser = optparse.OptionParser(usage="%prog [options] input [output]")
parser.add_option("--dvd", action="store", dest="dvd")
- parser.add_option("--deinterlace", action="store_true", dest="deinterlace")
parser.add_option("--fixmux", action="store_true", dest="fixmux")
- parser.add_option("--mc", action="store", dest="mc", type="int")
+ parser.add_option("--deinterlace", action="store_true", dest="deinterlace")
+ parser.add_option("--detelecine", action="store_true", dest="detelecine")
+ parser.add_option("--mc", action="store", dest="mc", type="float")
parser.add_option("--noskip", action="store_true", dest="noskip")
parser.add_option("--vfilters", action="store", dest="vfilters")
parser.add_option("--afilters", action="store", dest="afilters")
parser.add_option("--chapter", action="store", dest="chapter")
- parser.add_option("--ifps", action="store", dest="ifps")
parser.add_option("--skipkb", action="store", dest="skipkb", type="int")
parser.add_option("--startpos", action="store", dest="startpos")
parser.add_option("--endpos", action="store", dest="endpos")
opts.input = input
opts.output = os.path.abspath(output)
+ opts.mplayer_done = False
return opts
try:
commands = []
- if opts.fixmux:
- profile.commands.insert(0, MencoderFixRemux)
+ if opts.fixmux or opts.detelecine:
+ profile.commands.insert(0, MencoderLossless)
for CommandClass in profile.commands:
if Command in CommandClass.__bases__:
command = CommandClass(profile, opts)