OSDN Git Service

3c2a9ce626b357ac02dc9370b501c97133a415d2
[rec10/rec10-git.git] / rec10 / trunk / src / tv2mkv.py
1 import auto_process
2 #!/usr/bin/python
3 # coding: UTF-8
4 # Rec10 TS Recording Tools
5 # Copyright (C) 2009-2010 Yukikaze
6 import os
7 import os.path
8 import tv2mp4
9 import configreader
10 import subprocess
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.getpath("mkvmerge")
19     e1=exe +" -o \""+pmkv+u"\" \""+pmp4+"\""
20     p=subprocess.Popen(e1,shell=True)
21     os.waitpid(p.pid, 0)