问题描述
严格使用Python脚本(即无GUI)工作,我需要为每个文件渲染四个带画外音(.wav)的.png文件。我知道.png文件已加载;我已经能够从脚本渲染缩略图.png文件。我也知道.wav文件在那里。
我过去曾经做过类似的项目,并且正在使用以前有效的代码。
我的.blend设置与以前相同:
文件格式设置为FFMPEG视频
颜色设置为RGB
容器设置为MPEG4
视频编解码器设置为H.264
音频编解码器设置为AAC
代码:
2020-08-24 21:41:32,055 [my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-StreamThread-1] WARN o.apache.kafka.clients.NetworkClient - [] [Consumer clientId=my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-StreamThread-1-consumer,groupId=my-kafka-streams-app] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected
2020-08-24 21:41:32,186 [kafka-admin-client-thread | my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-admin] WARN o.apache.kafka.clients.NetworkClient - [] [AdminClient clientId=my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-admin] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
2020-08-24 21:41:32,250 [kafka-producer-network-thread | my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-StreamThread-1-producer] WARN o.apache.kafka.clients.NetworkClient - [] [Producer clientId=my-kafka-streams-app-23a462fe-28c6-415a-a08a-b11d3ffffc2e-StreamThread-1-producer] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
错误消息:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import audioread
import bpy
import os
import sys
#import wave
s = bpy.context.scene
sed = s.sequence_editor
sequences = sed.sequences
vse = s.sequence_editor
event_ID = sys.argv[8]
event = str(event_ID)
print("event_ID = " + event_ID)
pathout = "/var/www/html/data/event"
#Declare arrays#
fileOut =[] * 5
fileOut.append("")
screen = [] * 5
screen.append("/var/www/html/py-scripts/frame1-play.png")
#Read in voiceovers#
fileOut.append("/var/www/html/data/event1/event1-1.wav")
fileOut.append("/var/www/html/data/event1/event1-2.wav")
fileOut.append("/var/www/html/data/event1/event1-3.wav")
fileOut.append("/var/www/html/data/event1/event1-4.wav")
#Include frames per voiceover#
vLen1 = 187
print(fileOut[1] + ' length in frames = ' + str(vLen1))
vLen2 = 254
print(fileOut[2] + ' length in frames = ' + str(vLen2))
vLen3 = 333
print(fileOut[3] + ' length in frames = ' + str(vLen3))
vLen4 = 367
print(fileOut[4] + ' length in frames = ' + str(vLen4))
#change voice overs
s1 = fileOut[1]
frame_start1 = 1
frame_end1 = frame_start1+vLen1+9
sound_strip1 = sequences.new_sound("Sound1",s1,2,frame_start1)
sound_strip1.frame_final_end = frame_end1
print("frame_start1 = " + str(frame_start1))
print("frame_end1 = " + str(frame_end1))
s2 = fileOut[2]
frame_start2 = frame_end1+1
frame_end2 = frame_start2+vLen2+9
sound_strip2 = sequences.new_sound("Sound2",s2,frame_start2)
sound_strip2.frame_final_end = frame_end2
print("frame_start2 = " + str(frame_start2))
print("frame_end2 = " + str(frame_end2))
s3 = fileOut[3]
frame_start3 = frame_end2+1
frame_end3 = frame_start3+vLen3+9
sound_strip3 = sequences.new_sound("Sound3",s3,frame_start3)
sound_strip3.frame_final_end = frame_end3
print("frame_start3 = " + str(frame_start3))
print("frame_end3 = " + str(frame_end3))
s4 = fileOut[4]
frame_start4 = frame_end3+1
frame_end4 = frame_start4+vLen4+9
sound_strip4 = sequences.new_sound("Sound4",s4,frame_start4)
sound_strip4.frame_final_end = frame_end4
print("frame_start4 = " + str(frame_start4))
print("frame_end4 = " + str(frame_end4))
#Define screens#
for v in range(1,5):
scrn = pathout + event + '/event' + event + '-screen' + str(v) + '.png'
print('screen = ' + scrn)
screen.append(scrn)
#Change screens#
frame_starti0 = 1
frame_endi0 = 2
image_strip0 = sequences.new_image("Image0",screen[0],10,frame_starti0)
image_strip0.frame_final_end = frame_endi0
image_strip0.blend_type = 'ALPHA_OVER'
frame_starti1 = frame_start1
frame_endi1 = frame_end1
image_strip1 = sequences.new_image("Image1",screen[1],6,frame_starti1)
image_strip1.frame_final_end = frame_endi1
image_strip1.blend_type = 'ALPHA_OVER'
frame_starti2 = frame_start2
frame_endi2 = frame_end2
image_strip2 = sequences.new_image("Image2",screen[2],7,frame_starti2)
image_strip2.frame_final_end = frame_endi2
image_strip2.blend_type = 'ALPHA_OVER'
frame_starti3 = frame_start3
frame_endi3 = frame_end3
image_strip3 = sequences.new_image("Image3",screen[3],8,frame_starti3)
image_strip3.frame_final_end = frame_endi3
image_strip3.blend_type = 'ALPHA_OVER'
frame_starti4 = frame_start4
frame_endi4 = frame_end4
image_strip4 = sequences.new_image("Image4",screen[4],9,frame_starti4)
image_strip4.frame_final_end = frame_endi4
image_strip4.blend_type = 'ALPHA_OVER'
renderout = pathout + event + "/vid" + "-" + event + ".m4v"
print("renderout = " + renderout)
thumbout = pathout + event + "/vid" + "-" + event + ".png"
print("thumbout = " + thumbout)
#if not os.path.isfile(thumbout):
bpy.context.scene.frame_current = 1
bpy.context.scene.frame_end = frame_end4-1
bpy.context.scene.render.resolution_x = 350
bpy.context.scene.render.resolution_y = 200
bpy.context.scene.render.image_settings.file_format = 'PNG'
bpy.context.scene.render.filepath = thumbout
cont1 = bpy.context.area
print("cont1 = " + str(cont1))
bpy.ops.render.render(use_viewport = True,write_still=True)
sequences.remove(image_strip0)
#SEQUENCE_EDITOR
bpy.context.scene.render.resolution_x = 700
bpy.context.scene.render.resolution_y = 400
bpy.context.scene.render.image_settings.file_format = 'FFMPEG'
bpy.context.scene.render.filepath = renderout
cont2 = bpy.context.area
print("cont2 = " + str(cont2))
bpy.ops.render.render(use_viewport = True,animation=True)
sequences.remove(sound_strip1)
sequences.remove(sound_strip2)
sequences.remove(sound_strip3)
sequences.remove(sound_strip4)
sequences.remove(image_strip1)
sequences.remove(image_strip2)
sequences.remove(image_strip3)
sequences.remove(image_strip4)
呈现.png的上下文为NONE。 呈现.m4v的上下文也为NONE。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)