+import os
#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
stxt=stxt[s:]
txt="\n####mencoder-log_"+size+"####\n"+stxt
f.write(txt.encode('utf-8'))
- f.close()
\ No newline at end of file
+ f.close()
+
+def encode_ffmpeg(pin,pout,size,is2pass):
+ #ffmpeg -i input.m2v -vsync 400 -vcodec h264 -b bitrate k -s sizexsize -deinterlace -
+ #x264enc1=":me=hex:bframes=3"
+ #:frameref=3:subq=7:partitions=all:8x8dct:direct=auto:me=umh:bframes=3:weight_b
+ ffmpeg="ffmpeg"
+ vf1="-me hex -bframes 3 "
+ vf1="-ref 1 -subme 1 -me dia "
+ #vf2="-ref 3 -subq 7 -partitions all -direct auto -me umh -level 42 -profile high -bframes 3 -flags2 8x8dct+bpyramid+wpred+mixed_refs+brdo "
+ vf2="-vpre hq "
+ if size == "HD":
+ s = "-s 1280x720 "
+ bitrate = str(tv2avi.Bitrate_HD)
+ crf="crf=20"
+ elif size == "SD":
+ s ="-s 720x480 "
+ bitrate = str(tv2avi.Bitrate_SD)
+ crf="crf=20"
+ elif size == "FHD":
+ s ="-s 1920x1080 "
+ bitrate = str(tv2avi.Bitrate_FHD)
+ crf="crf=22"
+ elif size == "Short":
+ s= ""
+ bitrate = str(tv2avi.Bitrate_Short)
+ crf="crf=20"
+ elif size == "LowHD":
+ s = "-s 1280x720 "
+ bitrate = str(tv2avi.Bitrate_LowHD)
+ crf="crf=22"
+ else:
+ s = "-s 1280x720 "
+ bitrate = str(tv2avi.Bitrate_LowHD)
+ crf="crf=22"
+ if is2pass==1:
+ exe1=ffmpeg+" -y -i \""+pin+"\" -pass 1 -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf1+s+"-deinterlace -an -passlogfile \'" + pin + ".log\' " + " /dev/null"
+ exe2=ffmpeg+" -y -i \""+pin+"\" -pass 2 -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf2+s+"-deinterlace -an -passlogfile \'" + pin + ".log\' \"" +pout+"\"" #aviにすべきかどうか
+ os.system(exe1)
+ os.system(exe2)
+ else:
+ exe=ffmpeg+" -y -i \""+pin+"\" -vsync 400 -vcodec libx264 -b "+bitrate+"k "+vf2+s+"-deinterlace -an \"" +pout+"\""
\ No newline at end of file
e0="ffmpeg -i '"+pints+"' -vn -f aac -acodec copy '"+pinaac+"'"
#e1=wineexe+u" "+cfr2tc+u" '"+"Z:\\"+pin+"' '"+"Z:\\"+pin120+u"' '"+"Z:\\"+pintimecode+u"' 2"
e2=wineexe+u" "+cap2ass+u" -format srt \"Z:\\"+pints+"\" \"Z:\\"+pincap+"\""
- e3=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-127 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0"
- e3s=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-127 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --forced-track 0:no -s 0 -D -A '"+pincap+"' --track-order 0:0,1:0,2:0"
+ e3=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-100 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0"
+ e3s=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-100 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --forced-track 0:no -s 0 -D -A '"+pincap+"' --track-order 0:0,1:0,2:0"
#e3=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-225 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --track-order 0:0,1:0"
#e3s=exe +" -o '"+pout+u"' --forced-track 0:no -d 0 -A -S '"+pin+"' --sync 0:-225 --forced-track 0:no -a 0 -D -S '"+pinaac+"' --forced-track 0:no -s 0 -D -A '"+pincap+"' --track-order 0:0,1:0,2:0"
txt=txt+execcomd(e0)