OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / rec10 / trunk / src / tv2mkv.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2011 Yukikaze
5 import os
6 import os.path
7 import tv2mp4
8 import configreader
9 import subprocess
10 import auto_process
11 def ts2mkv(pin, pout, opt):
12     tpout=pout.replace(".mkv",".mp4")
13     tv2mp4.ts2mp4(pin, tpout, opt)
14     mp42mkv(pout, tpout)
15     if os.path.exists(pout) and os.path.getsize(pout)>os.path.getsize(tpout)*0.9:
16         os.remove(tpout)
17 def mp42mkv(pmkv,pmp4):
18     exe = configreader.getConfPath("mkvmerge")
19     e1=exe +" -o \""+pmkv+u"\" \""+pmp4+"\""
20     p=subprocess.Popen(e1,shell=True)
21     os.waitpid(p.pid, 0)