Compare commits

..

No commits in common. "12c27dbb4856234ebd410c8d04f4596a2c5dc8d1" and "55b4c47e66484b89ff0b4048ff6c882869b76231" have entirely different histories.

2 changed files with 16 additions and 37 deletions

View file

@ -492,35 +492,6 @@ def process_frame(item, prompt, character=None, position=0, seed=None):
img.update_find()
return img
def process_image(document, prompt, character=None, position=0, seed=None):
model = "seedream-4-5-251128"
if isinstance(character, Document):
character = public_document_url(character)
image = public_document_url(document)
if character is not None:
image = [image, character]
data = {
"model": model,
"prompt": prompt,
"image": image,
"size": "2560x1440",
}
if seed:
data["seed"] = seed
url = bytedance_image_generation(data)
img = add_ai_image(document, position, url)
img.refresh_from_db()
img.data["model"] = model
img.data["prompt"] = prompt
img.data["source"] = document.get_id()
if character:
img.data["source"] += " " + character.split("?")[0]
print(img, img.data)
img.save()
img.update_sort()
img.update_find()
return img
def replace_background(image, background, prompt=None, seed=None):
model = "seedream-4-5-251128"
position = 0
@ -567,8 +538,6 @@ REPLACE_CHARACTER_PROMPT = "Replace the foreground character in image 1 with the
REPLACE_CHARACTER_PROMPT = "Replace the foreground character in image 1 with the character in image 2, keep the posture, clothing, background, light, atmosphere from image 1, but take the facial features and personality from image 2. Make sure the size of the character is adjusted since the new character is a child and make sure the size of the head matches the body. The quality of the image should be the same between foreground and background, adjust the quality of the character to match the background. Use the style of image 1 for the character: if image 1 is a photo make the character a real person, if image 1 is a drawing make the character a drawn character, if image 1 is a comic use a comic character, restore any blurred out regions of the image"
REPLACE_CHARACTER_PROMPT = "Replace the main character in image 1 with the character in image 2, keep the posture, clothing, background, light, atmosphere from image 1, but take the facial features and personality from image 2. Make sure the size of the character is adjusted since the new character is a child and make sure the size of the head matches the body. The quality of the image should be the same between foreground and background, adjust the quality of the character to match the background. Use the style of image 1 for the character: if image 1 is a photo make the character a real person, if image 1 is a drawing make the character a drawn character, if image 1 is a comic use a comic character, restore any blurred out regions of the image"
def fal_replace_character(item, character, position=0):
if isinstance(item, str):

View file

@ -556,11 +556,10 @@ def render_all(options):
if '/audio' in timeline:
ext = '.wav'
out = '%s' % timeline.replace('.kdenlive', ext)
tmp_out = '%s' % timeline.replace('.kdenlive', ".tmp" + ext)
cmd = get_melt() + [
timeline,
'-quiet',
'-consumer', 'avformat:%s' % tmp_out,
'-consumer', 'avformat:%s' % out,
]
if ext == '.wav':
cmd += ['vn=1']
@ -572,7 +571,20 @@ def render_all(options):
cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
if needs_update(timeline, out):
subprocess.call(cmd)
shutil.move(tmp_out, out)
if ext == '.wav' and timeline.endswith('audio.kdenlive'):
cmd = [
'ffmpeg', '-y',
'-nostats', '-loglevel', 'error',
'-i',
timeline.replace('.kdenlive', ext),
timeline.replace('.kdenlive', '.mp4')
]
wav = timeline.replace('.kdenlive', ext)
mp4 = timeline.replace('.kdenlive', '.mp4')
if needs_update(wav, mp4):
subprocess.call(cmd)
if not options.get("keep_parts"):
os.unlink(wav)
cmds = []
fragment_prefix = Path(fragment_prefix)
@ -683,10 +695,9 @@ def render_all(options):
if '/audio' in timelines[0]:
ext = '.wav'
out = base_prefix / (timeline + ext)
tmp_out = base_prefix / (timeline + ".tmp" +ext)
cmd = get_melt() + timelines + [
'-quiet',
'-consumer', 'avformat:%s' % tmp_out,
'-consumer', 'avformat:%s' % out,
]
if ext == '.wav':
cmd += ['vn=1']
@ -698,7 +709,6 @@ def render_all(options):
cmd += ['vcodec=libx264', 'x264opts=keyint=1', 'crf=15']
if needs_update(timelines[0], out):
cmds.append(cmd)
shutil.move(tmp_out, out)
for src, out1, out2 in (
("audio-front.wav", "fl.wav", "fr.wav"),