add archive
This commit is contained in:
1 parent
2c13e75a92
commit
7a667d8a5f
5 files changed
+119
-12
No files matched your search
@@ -33,6 +33,10 @@ BGM_FADE_OUT = 1.2
|
||||
# 큐 1초당 화면 높이의 몇 배를 훑을지. 원본은 사람이 구간을 골랐다(known_issue 참조).
|
||||
SCROLL_SCREENS_PER_SECOND = 0.35
|
||||
|
||||
PROOF_COUNT = 8 # 완성본 전체에서 고르게 뽑는 시점 수
|
||||
PROOF_SIZE = (180, 320)
|
||||
PROOF_GAP = 10
|
||||
|
||||
BAND_HEIGHT = 300
|
||||
BAND_RISE_SECONDS = 0.6
|
||||
NOL_BLUE = (0x41, 0x54, 0xFF)
|
||||
@@ -246,11 +250,20 @@ def compose_frames(timeline: NarrationTimeline, plan: LongcutPlan, poster: Image
|
||||
yield image
|
||||
|
||||
|
||||
def proof_sheet(tiles: list[Image.Image]) -> Image.Image:
|
||||
width = (PROOF_SIZE[0] + PROOF_GAP) * len(tiles) - PROOF_GAP
|
||||
sheet = Image.new("RGB", (width, PROOF_SIZE[1]), "black")
|
||||
for order, tile in enumerate(tiles):
|
||||
sheet.paste(tile, (order * (PROOF_SIZE[0] + PROOF_GAP), 0))
|
||||
return sheet
|
||||
|
||||
|
||||
def compose_longcut(poster: bytes | Path | Image.Image, clip: bytes,
|
||||
timeline: NarrationTimeline, narration_mp3: bytes,
|
||||
sections: Sequence[DetailSection], info: EndBandInfo, *,
|
||||
bgm_mp3: bytes | None = None, qr: Image.Image | None = None,
|
||||
plan: LongcutPlan | None = None) -> LongcutResult:
|
||||
plan: LongcutPlan | None = None,
|
||||
preview: bool = False) -> LongcutResult:
|
||||
if isinstance(poster, Image.Image):
|
||||
source = poster.convert("RGB")
|
||||
else:
|
||||
@@ -261,8 +274,19 @@ def compose_longcut(poster: bytes | Path | Image.Image, clip: bytes,
|
||||
used = {scene.section for scene in plan.scenes if scene.section}
|
||||
images = {section.name: section.image for section in sections if section.name in used}
|
||||
|
||||
frames = compose_frames(timeline, plan, source, clip, images, info, qr)
|
||||
video = encode_mp4(frames, (W, H), mix_audio(narration_mp3, bgm_mp3, timeline.total),
|
||||
total_frames = round(timeline.total * FPS)
|
||||
# 훅 구간만 보면 뒤쪽 스크롤과 엔드밴드를 검수할 수 없어 전체에서 고르게 뽑는다
|
||||
proof_at = {round(step * total_frames / PROOF_COUNT) for step in range(PROOF_COUNT)}
|
||||
tiles: list[Image.Image] = []
|
||||
|
||||
def frames() -> Iterator[Image.Image]:
|
||||
for index, frame in enumerate(
|
||||
compose_frames(timeline, plan, source, clip, images, info, qr)):
|
||||
if preview and index in proof_at:
|
||||
tiles.append(frame.resize(PROOF_SIZE))
|
||||
yield frame
|
||||
|
||||
video = encode_mp4(frames(), (W, H), mix_audio(narration_mp3, bgm_mp3, timeline.total),
|
||||
fps=FPS)
|
||||
return LongcutResult(video=video, duration=timeline.total,
|
||||
frames=round(timeline.total * FPS), plan=plan)
|
||||
return LongcutResult(video=video, duration=timeline.total, frames=total_frames,
|
||||
plan=plan, proof=proof_sheet(tiles) if tiles else None)
|
||||
Reference in new issue
Block a user