当前位置: 首页>>代码示例>>Python>>正文


Python Log.e方法代码示例

本文整理汇总了Python中util.Log.e方法的典型用法代码示例。如果您正苦于以下问题:Python Log.e方法的具体用法?Python Log.e怎么用?Python Log.e使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Log的用法示例。


在下文中一共展示了Log.e方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import e [as 别名]
	def __init__(self, filename):
		if(filename[0] != '/'):
			Log.w(TAG, "Filename is not absolute, this may cause issues dispatching jobs.")
		ffprobe = subprocess.Popen(["ffprobe","-v", "quiet", "-print_format", "json", "-show_format", "-show_streams",filename], stdout=subprocess.PIPE)
		#Get everything from stdout once ffprobe exits, and
		try:
			ffprobe_string = ffprobe.communicate()[0]
			self.ffprobe_dict=json.loads(ffprobe_string)
		except ValueError:
			Log.e(TAG, "File could not be read, are you sure it exists?")
		ffmpeg_interlace = subprocess.Popen(["ffmpeg", "-filter:v", "idet", "-frames:v", "400", "-an", "-f", "null", "-", "-i", filename],stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		interlaced_details = ffmpeg_interlace.communicate()[1]
		interlaced_lines = interlaced_details.split("\n")
		num_progressive = 0
		for line in interlaced_lines:
			if line.find("idet") != -1 and line.find("Progressive") != -1:
				#find the number of progressive frames in this line.
				nframes = line.split("Progressive:")[1].split("Undetermined")[0]
				num_progressive = num_progressive + int(nframes)
		if num_progressive < 20:
			self.is_interlaced = True
		self.video_stream = self.parse_video(self.ffprobe_dict)
		self.audio_streams = self.parse_audio(self.ffprobe_dict)
		self.sub_streams = self.parse_subs(self.ffprobe_dict)
		self.file_format = self.ffprobe_dict["format"]["format_name"]
		self.duration = float(self.ffprobe_dict["format"]["duration"])
开发者ID:magmastonealex,项目名称:ffproc,代码行数:28,代码来源:MediaParser.py

示例2:

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import e [as 别名]
import re
from util import Log

from parser import Parser
from task import Task, TaskTypes

TAG = "ffproc"

useredis = True

try:
	from rq import Connection, Queue
	from redis import Redis
except:
	useredis = False
	Log.e(TAG, "rq and redis libraries not found. Disabling redis support...")



parser = argparse.ArgumentParser(description='Enqueue media files for transcoding, using a variety of profiles.')
parser.add_argument('--profile', help='Force a particular profile')
parser.add_argument('--immediate', action='store_true',help="Don't use Redis, just run the transcode immediately")
parser.add_argument('--redis', default="127.0.0.1",nargs=1,type=str,help="Redis IP address, if not localhost")
parser.add_argument('--showcommand', action='store_true',help='(debug) Show the FFMPEG command used')
parser.add_argument('--dryrun', action='store_true',help='(debug) Stop short of actually enqueing the file')

parser.add_argument('file', metavar='file', type=str,
                    help='The file to transcode')
arguments = parser.parse_args()

if arguments.immediate == True:
开发者ID:olipayne,项目名称:ffproc,代码行数:33,代码来源:ffproc.py

示例3: ffmpeg_tasks_create

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import e [as 别名]
def ffmpeg_tasks_create(parser, options):
	streams = media_transform(parser,options)
	if streams["video"]==False and streams["audio"]==False and streams["remux"]==False:
		return None
	ffmpeg=[]
	astreamindex = 0



	for stream in streams["tcodeData"][::-1]:
		
		#Map the stream into the output. Order will be video, stereo, surround based on media_transform function, and iterating the list backwards.
		
		#Note that if we're using custom downconverting, then we can't map the regular channel - we need to build a filtergraph.
		if stream["type"] == "audio" and stream["ffprocdown"] == True:
				ffmpeg.append("-filter_complex")
				ffmpeg.append("[0:"+str(stream["index"])+"]pan=stereo| FL < FL + 0.7*FC + 0.3*BL + 0.3*SL | FR < FR + 0.7*FC + 0.3*BR + 0.3*SR, dynaudnorm[a]")
				ffmpeg.append("-map")
				ffmpeg.append("[a]")
		else:
			ffmpeg.append("-map")
			ffmpeg.append("0:"+str(stream["index"]))

		if stream["type"] == "video":
			ffmpeg.append("-c:v")
			codec_to_ffmpeg = stream["codec"]
			if codec_to_ffmpeg == "copy":
				ffmpeg.append("copy")
			elif codec_to_ffmpeg == "h264":
				#Behold, the insane list of arguments needed to tune h.264 for decent compression even 
				ffmpeg.append("libx264")
				ffmpeg.append("-crf")
				ffmpeg.append(options["video"]["quality"])
				ffmpeg.append("-level:v")
				ffmpeg.append("4.1")
				ffmpeg.append("-preset")
				ffmpeg.append(options["video"]["encodepreset"])
				ffmpeg.append("-bf")
				ffmpeg.append("16")
				ffmpeg.append("-b_strategy")
				ffmpeg.append("2")
				ffmpeg.append("-subq")
				ffmpeg.append("10")
				ffmpeg.append("-refs")
				ffmpeg.append("4")
			elif codec_to_ffmpeg == "hevc":
				ffmpeg.append("libx265")
				ffmpeg.append("-crf")
				ffmpeg.append(options["video"]["quality"])
			else:
				Log.e(TAG, "Unknown codec selected, you're on your own!")
				ffmpeg.append(stream["codec"])

			if stream["scaleopts"] != False and stream["deinterlacing"] == True:
				#Scaling and deinterlacing
				ffmpeg.append("-vf")
				ffmpeg.append("yadif=0:-1:0,scale=-1:"+str(stream["scaleopts"]))
				ffmpeg.append("-sws_flags")
				ffmpeg.append("lanczos")
			elif stream["scaleopts"] == False and stream["deinterlacing"] == True:
				#Just deinterlacing
				ffmpeg.append("-vf")
				ffmpeg.append("yadif=0:-1:0")
			elif stream["scaleopts"] != False and stream["deinterlacing"] == False:
				#Just scaling
				ffmpeg.append("-vf")
				ffmpeg.append("scale=-1:"+str(stream["scaleopts"]))
				ffmpeg.append("-sws_flags")
				ffmpeg.append("lanczos")
			else:
				#Nothing
				pass
		elif stream["type"] == "audio":
			ffmpeg.append("-c:a:"+str(astreamindex))
			codec_to_ffmpeg = stream["codec"]

			if codec_to_ffmpeg == "copy":
				ffmpeg.append("copy")
			elif codec_to_ffmpeg == "aac":
				ffmpeg.append("libfdk_aac")
				ffmpeg.append("-b:a:"+str(astreamindex))
				ffmpeg.append(stream["bitrate"])
			else:
				Log.e(TAG, "Unknown codec selected, you're on your own!")
				ffmpeg.append(stream["codec"])
			if stream["ffprocdown"] == False and stream["downconvert"] == True:
				#Use stock downconverting, not our own pan & dynaudnorm filter.
				ffmpeg.append("-ac:a:"+str(astreamindex))
				ffmpeg.append("2")
			astreamindex=astreamindex+1


	task_type = TaskTypes.REMUX

	if streams["video"] == True:
		task_type = TaskTypes.VIDEO
	elif streams["audio"] == True:
		task_type = TaskTypes.AUDIO

	return Task(tasktype=task_type, command="ffmpeg", arguments=ffmpeg)
开发者ID:olipayne,项目名称:ffproc,代码行数:102,代码来源:transformer.py


注:本文中的util.Log.e方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。