Activate desinterlace

This commit is contained in:
Yorick Barbanneau 2015-12-09 00:02:47 +01:00
parent 02cda94439
commit f4610fc436

View file

@ -11,7 +11,6 @@ import re
import os import os
import subprocess import subprocess
import logging import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
@ -20,11 +19,10 @@ def usage():
params = { params = {
"desinterlace": False, "desinterlace": False,
"file_output": "video", "file_output": "",
"file_input": "", "file_input": "",
"vbitrate": "600k", "vbitrate": "600k",
"abitrate": "96k", "abitrate": "96k",
"video_quality": "good",
"h264_vcommand": [ "h264_vcommand": [
"-trellis", "0", "-trellis", "0",
"-me_method", "umh", "-me_method", "umh",
@ -35,9 +33,14 @@ params = {
"-g", "250" "-g", "250"
], ],
"h264_acommand": ["-strict", "experimental"], "h264_acommand": ["-strict", "experimental"],
"webm_vcommand": "-rc_lookahead 16 -keyint_min 0 -g 250 -skip_threshold \ "webm_vcommand": [
0 -level 116", "-rc_lookahead", "16",
"webm_acommand": "-strict -2", "-keyint_min", "0"
"-g", "250",
"-skip_threshold", "0",
"-level", "116"
],
"webm_acommand": ["-strict", "experimental"],
"verbose": True, "verbose": True,
"pattern": "", "pattern": "",
"twopass": False, "twopass": False,
@ -49,7 +52,7 @@ VERSION = "0.1dev"
def execute(command, shell=False): def execute(command, shell=False):
""" """
Execute a system command and return its results. Execute a system command and return its results.
Thanxx Strycote from Lutyris.net Thanxx Strycote from Lutris.net
""" """
try: try:
stdout, stderr = subprocess.Popen(command, stdout, stderr = subprocess.Popen(command,
@ -117,7 +120,9 @@ def processArg(sysarg):
if opt in ("-o", "--output"): if opt in ("-o", "--output"):
params["file_output"] = arg params["file_output"] = arg
if opt in ("-d", "--desinterlace"): if opt in ("-d", "--desinterlace"):
params["desinterlace"] = True logging.info("Desinterlace activated")
params["h264_vcommand"] += ["-vf", "yadif"]
params["webm_vcommand"] += ["-vf", "yadif"]
if opt in ("-i", "--input"): if opt in ("-i", "--input"):
params["file_input"] = arg params["file_input"] = arg
if opt in ("-p", "--pattern"): if opt in ("-p", "--pattern"):
@ -172,6 +177,7 @@ def encode_h264(src, dest):
dest+".mp4", dest+".mp4",
"-loglevel", "quiet" "-loglevel", "quiet"
] ]
logging.debug(encode)
subprocess.run(encode) subprocess.run(encode)
@ -180,7 +186,6 @@ if __name__ == "__main__":
if not exec_ffmpeg: if not exec_ffmpeg:
print('ffmpeg not found, exiting') print('ffmpeg not found, exiting')
sys.exit(2) sys.exit(2)
print('export_video v%s with FFMPEG %s', VERSION, exec_ffmpeg)
processArg(sys.argv[1:]) processArg(sys.argv[1:])
if not params["file_input"]: if not params["file_input"]:
print("you must specify a file / directory input") print("you must specify a file / directory input")