OSDN Git Service

rec10 0.9.5 function.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 2 Apr 2010 12:30:00 +0000 (12:30 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 2 Apr 2010 12:30:00 +0000 (12:30 +0000)
encode for mobile function.(option 8,9,0)

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@547 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/timerec.py
rec10/trunk/src/ts2x264.py

index 97e1229..0cf2602 100644 (file)
@@ -598,12 +598,25 @@ def type_encode_que(typetxt,chtxt,title,bt,et,opt):
             if re.search("4", opt):
                 makeMP4=1
             recdblist.printutf8(pin)
-            if makeMP4==1:
-                pout = recpath + "/" + title + ".mp4"
-                tv2mp4.ts2mp4(pin, pout, opt)
+            if not re.search("0", opt):
+                if makeMP4==1:
+                    pout = recpath + "/" + title + ".mp4"
+                    tv2mp4.ts2mp4(pin, pout, opt)
+                else:
+                    pout = recpath + "/" + title + ".mkv"
+                    tv2mkv.ts2mkv(pin, pout, opt)
+                if re.search("8", opt) or re.search("9", opt):
+                    optt=opt
+                    optt=optt.replace("8","\\8")
+                    optt=optt.replace("9","\\9")
+                    pout = recpath + "/" + "m_"+title + ".mp4"
+                    tv2mp4.ts2mp4(pin, pout, optt)
             else:
-                pout = recpath + "/" + title + ".mkv"
-                tv2mkv.ts2mkv(pin, pout, opt)
+                optt=opt
+                optt=optt.replace("8","\\8")
+                optt=optt.replace("9","\\9")
+                pout = recpath + "/" + "m_"+title + ".mp4"
+                tv2mp4.ts2mp4(pin, pout, optt)
             recdb.del_reckey(typetxting, title, chtxt, btime)
             time.sleep(10)
             if re.search("E", opt):
index aa880d9..2c03d4c 100644 (file)
@@ -29,6 +29,10 @@ def ts2x264(pin, pout, opts):#sizeは"HD"か"SD"
         size = "FullHD"
     if re.search("W",opts):
         size = "WVGA"
+    if re.search("\\8", opts):
+        size = "QVGA_BASE"
+    if re.search("\\9", opts):
+        size = "WVGA_BASE"
     if re.search("v", opts):
         is24fps=1
         crf=int(configreader.getenv("animation_crf"))
@@ -100,6 +104,14 @@ def encode(pin,pout,size,is24fps,quality,crf):
         encvf = encvf + ",scale=720:-2::0:3,expand=720:480"+harddup
         x264streamsize=u"720x480"
         x264_bitrate="1250"
+    elif size == "QVGA_BASE":
+        encvf = encvf + ",scale=320:-2::0:3,expand=320:240"+harddup
+        x264streamsize=u"320x240"
+        x264_bitrate="300"
+    elif size == "WVGA_BASE":
+        encvf = encvf + ",scale=-2:480::0:3,expand=854:480"+harddup
+        x264streamsize=u"854x480"
+        x264_bitrate="1500"
     else:
         encvf = encvf + ",scale=-2:720::0:3,expand=1280:720"+harddup
         x264streamsize=u"1280x720"
@@ -116,6 +128,10 @@ def encode(pin,pout,size,is24fps,quality,crf):
         x264preset=u"--preset slow"
     elif quality==6:
         x264preset=u"--preset slower"
+    if size == "WVGA_BASE" or size == "QVGA_BASE":
+        x264profile=" --level 32 --profile base "
+    else:
+        x264profile=" --level 41 --profile high "
     x264crf=u"--crf "+str(crf)
     os.environ['LANG']="ja_JP.UTF-8"
     random.seed(pin)
@@ -123,7 +139,7 @@ def encode(pin,pout,size,is24fps,quality,crf):
     streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 999999)))
     os.system(u"mkfifo "+streampath)
     encexe=mencoder+u" \""+pin+u"\" -vfm ffmpeg -quiet -sws 9 "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" &"
-    encexe=encexe+u" nice -n 19 "+x264+" "+x264crf+u" "+x264_addline+u"  --threads auto  --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
+    encexe=encexe+u" nice -n 19 "+x264+" "+x264crf+u" "+x264_addline+u"  --threads auto"+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
     encexe=u"nice -n 19 " +encexe
     recdblist.printutf8(encexe)
     txt=txt+"Cmd : "+encexe+"\n"
@@ -165,6 +181,14 @@ def encode_ffmpeg(pin,pout,size,is24fps,quality,crf):
         s = "-s 720x480 "
         x264streamsize=u"720x480"
         x264_bitrate="1250"
+    elif size == "QVGA_BASE":
+        s = "-s 320x240 "
+        x264streamsize=u"320x240"
+        x264_bitrate="300"
+    elif size == "WVGA_BASE":
+        s = "-s 854x480 "
+        x264streamsize=u"854x480"
+        x264_bitrate="1500"
     else:
         s = "-s 1280x720 "
         x264streamsize=u"1280x720"
@@ -181,11 +205,15 @@ def encode_ffmpeg(pin,pout,size,is24fps,quality,crf):
         x264preset=u"--preset slow"
     elif quality==6:
         x264preset=u"--preset slower"
+    if size == "WVGA_BASE" or size == "QVGA_BASE":
+        x264profile=" --level 32 --profile base "
+    else:
+        x264profile=" --level 41 --profile high "
     x264crf=u"--crf "+str(crf)
     txt=""
     os.environ['LANG']="ja_JP.UTF-8"
     exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+"-deinterlace -an -f rawvideo - |"
-    exe=exe+u" nice -n 19 "+x264+" "+x264crf+u" "+x264_addline+u" --threads auto --level 41 --profile high "+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" - "+x264streamsize
+    exe=exe+u" nice -n 19 "+x264+" "+x264crf+u" "+x264_addline+u" --threads auto "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" - "+x264streamsize
     txt=txt+"Cmd : "+exe+"\n"
     exe = "nice -n 19 " + exe
     txt=txt+"Cmd : "+exe+"\n"