comicvid 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
comicvid/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """comicvid — Static images to animated video with Ken Burns + ASS subtitles + audio."""
2
+
3
+ __version__ = "0.1.0"
comicvid/audio.py ADDED
@@ -0,0 +1,69 @@
1
+ """Audio utilities: re-encode to AAC, probe duration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import subprocess
6
+ from pathlib import Path
7
+
8
+
9
+ def reencode_audio(
10
+ audio_path: Path,
11
+ output_path: Path,
12
+ ffmpeg: str = "ffmpeg",
13
+ sample_rate: int = 44100,
14
+ bitrate: str = "128k",
15
+ channels: int = 1,
16
+ ) -> bool:
17
+ """Re-encode any audio to AAC at a consistent format.
18
+
19
+ Args:
20
+ audio_path: Input audio file path.
21
+ output_path: Output AAC file path.
22
+ ffmpeg: FFmpeg binary.
23
+ sample_rate: Output sample rate in Hz.
24
+ bitrate: Output bitrate (e.g. '128k').
25
+ channels: Number of audio channels (1=mono).
26
+
27
+ Returns:
28
+ True on success.
29
+ """
30
+ cmd = [
31
+ ffmpeg, "-y",
32
+ "-i", str(audio_path),
33
+ "-c:a", "aac",
34
+ "-ar", str(sample_rate),
35
+ "-b:a", bitrate,
36
+ "-ac", str(channels),
37
+ str(output_path),
38
+ ]
39
+ result = subprocess.run(cmd, capture_output=True, text=True)
40
+ if result.returncode != 0:
41
+ print(f" [audio] reencode failed: {result.stderr[-500:]}")
42
+ return False
43
+ return True
44
+
45
+
46
+ def get_audio_duration(audio_path: Path, ffmpeg: str = "ffmpeg") -> float:
47
+ """Get audio duration in seconds using ffmpeg/ffprobe.
48
+
49
+ Args:
50
+ audio_path: Path to audio file.
51
+ ffmpeg: FFmpeg binary path.
52
+
53
+ Returns:
54
+ Duration in seconds, or 5.0 on failure.
55
+ """
56
+ result = subprocess.run(
57
+ [ffmpeg, "-i", str(audio_path), "-hide_banner"],
58
+ capture_output=True, text=True,
59
+ )
60
+ for line in result.stderr.split("\n"):
61
+ if "Duration" in line:
62
+ parts = line.strip().split(",")[0]
63
+ dur_str = parts.split("Duration:")[-1].strip()
64
+ h, m, s = dur_str.split(":")
65
+ try:
66
+ return int(h) * 3600 + int(m) * 60 + float(s)
67
+ except ValueError:
68
+ pass
69
+ return 5.0
comicvid/cli.py ADDED
@@ -0,0 +1,241 @@
1
+ """Click CLI entry point for comicvid."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ import click
9
+
10
+ from comicvid import __version__
11
+ from comicvid.pipeline import render_video
12
+ from comicvid.types import Config
13
+
14
+
15
+ @click.group(invoke_without_command=True)
16
+ @click.version_option(version=__version__, prog_name="comicvid")
17
+ @click.pass_context
18
+ def cli(ctx: click.Context) -> None:
19
+ """comicvid — Static images to animated video.
20
+
21
+ Turn a folder of images into a video with Ken Burns zoom,
22
+ ASS subtitles, and audio sync. Pure FFmpeg + Python.
23
+ """
24
+ if ctx.invoked_subcommand is None:
25
+ click.echo(ctx.get_help())
26
+
27
+
28
+ @cli.command()
29
+ @click.argument("image_dir", type=click.Path(exists=True, file_okay=False, dir_okay=True))
30
+ @click.option("-o", "--output", default="output.mp4", show_default=True,
31
+ help="Output MP4 path.")
32
+ @click.option("--duration", type=float, default=None,
33
+ help="Total video duration in seconds. If omitted, "
34
+ "uses --per-image-duration per image.")
35
+ @click.option("--per-image-duration", type=float, default=3.0, show_default=True,
36
+ help="Seconds per image when --duration is not set.")
37
+ @click.option("--subtitle", type=click.Path(exists=True, dir_okay=False),
38
+ default=None,
39
+ help="External subtitle file (SRT or ASS).")
40
+ @click.option("--subtitle-format", type=click.Choice(["ass", "srt"]),
41
+ default="ass", show_default=True,
42
+ help="Subtitle format.")
43
+ @click.option("--text", "-t", multiple=True,
44
+ help="Subtitle text per image. Repeat for each image: "
45
+ "-t 'line1' -t 'line2'")
46
+ @click.option("--audio", type=click.Path(exists=True, dir_okay=False),
47
+ default=None, help="Audio file (WAV, MP3, etc.).")
48
+ @click.option("--width", type=int, default=1280, show_default=True,
49
+ help="Output video width in pixels.")
50
+ @click.option("--height", type=int, default=720, show_default=True,
51
+ help="Output video height in pixels.")
52
+ @click.option("--resolution", type=str, default=None,
53
+ help="Shortcut: '1920x1080' sets width and height at once.")
54
+ @click.option("--fps", type=int, default=24, show_default=True,
55
+ help="Frames per second.")
56
+ @click.option("--crf", type=int, default=23, show_default=True,
57
+ help="H.264 CRF quality (lower = better).")
58
+ @click.option("--video-bitrate", default="1500k", show_default=True,
59
+ help="Video bitrate.")
60
+ @click.option("--zoom", type=float, default=0.05, show_default=True,
61
+ help="Ken Burns zoom amount (0.05 = 5%%).")
62
+ @click.option("--ffmpeg", default="ffmpeg", show_default=True,
63
+ help="FFmpeg binary path.")
64
+ @click.option("--keep-temps", is_flag=True, default=False,
65
+ help="Keep temporary files.")
66
+ def render(
67
+ image_dir: str,
68
+ output: str,
69
+ duration: float | None,
70
+ per_image_duration: float,
71
+ subtitle: str | None,
72
+ subtitle_format: str,
73
+ text: tuple[str, ...],
74
+ audio: str | None,
75
+ width: int,
76
+ height: int,
77
+ resolution: str | None,
78
+ fps: int,
79
+ crf: int,
80
+ video_bitrate: str,
81
+ zoom: float,
82
+ ffmpeg: str,
83
+ keep_temps: bool,
84
+ ) -> None:
85
+ """Render images from IMAGE_DIR into an MP4 video.
86
+
87
+ IMAGE_DIR should contain panel images sorted by filename.
88
+ Supports PNG, JPG, JPEG, WEBP, BMP.
89
+ """
90
+ # Handle --resolution shortcut
91
+ if resolution:
92
+ try:
93
+ w, h = resolution.split("x")
94
+ width = int(w)
95
+ height = int(h)
96
+ except (ValueError, TypeError):
97
+ click.echo(f"Error: Invalid resolution format '{resolution}'. "
98
+ f"Use WxH (e.g. 1920x1080).", err=True)
99
+ sys.exit(1)
100
+
101
+ # Parse subtitle texts
102
+ subs: list[str] | None = list(text) if text else None
103
+
104
+ config = Config(
105
+ image_dir=Path(image_dir),
106
+ output=Path(output),
107
+ duration=duration,
108
+ per_image_duration=per_image_duration,
109
+ subtitle=Path(subtitle) if subtitle else None,
110
+ subtitle_format=subtitle_format,
111
+ subtitles=subs,
112
+ audio=Path(audio) if audio else None,
113
+ width=width,
114
+ height=height,
115
+ fps=fps,
116
+ crf=crf,
117
+ video_bitrate=video_bitrate,
118
+ ken_burns_zoom=zoom,
119
+ ffmpeg=ffmpeg,
120
+ keep_temps=keep_temps,
121
+ )
122
+
123
+ report = render_video(config)
124
+ if report is None:
125
+ sys.exit(1)
126
+ if report.get("status") != "ok":
127
+ sys.exit(1)
128
+
129
+
130
+ @cli.command()
131
+ @click.argument("parent_dir", type=click.Path(exists=True, file_okay=False, dir_okay=True))
132
+ @click.option("-o", "--output-dir", default="./output", show_default=True,
133
+ help="Output directory for batch renders.")
134
+ @click.option("--duration", type=float, default=None,
135
+ help="Total video duration per subfolder.")
136
+ @click.option("--per-image-duration", type=float, default=3.0, show_default=True,
137
+ help="Seconds per image when --duration is not set.")
138
+ @click.option("--subtitle-format", type=click.Choice(["ass", "srt"]),
139
+ default="ass", show_default=True)
140
+ @click.option("--audio", type=click.Path(exists=True, dir_okay=False),
141
+ default=None, help="Optional audio file for all batches.")
142
+ @click.option("--width", type=int, default=1280, show_default=True)
143
+ @click.option("--height", type=int, default=720, show_default=True)
144
+ @click.option("--resolution", type=str, default=None)
145
+ @click.option("--ffmpeg", default="ffmpeg", show_default=True)
146
+ @click.option("--keep-temps", is_flag=True, default=False)
147
+ def batch(
148
+ parent_dir: str,
149
+ output_dir: str,
150
+ duration: float | None,
151
+ per_image_duration: float,
152
+ subtitle_format: str,
153
+ audio: str | None,
154
+ width: int,
155
+ height: int,
156
+ resolution: str | None,
157
+ ffmpeg: str,
158
+ keep_temps: bool,
159
+ ) -> None:
160
+ """Batch render: process each subfolder in PARENT_DIR as a separate video.
161
+
162
+ Useful for episode directories where each subfolder contains panels.
163
+ Output files are named after each subfolder.
164
+ """
165
+ if resolution:
166
+ try:
167
+ w, h = resolution.split("x")
168
+ width = int(w)
169
+ height = int(h)
170
+ except (ValueError, TypeError):
171
+ click.echo(f"Error: Invalid resolution '{resolution}'.", err=True)
172
+ sys.exit(1)
173
+
174
+ parent = Path(parent_dir)
175
+ subdirs = sorted(d for d in parent.iterdir() if d.is_dir())
176
+
177
+ if not subdirs:
178
+ click.echo(f"No subdirectories found in {parent_dir}")
179
+ sys.exit(1)
180
+
181
+ out_dir = Path(output_dir)
182
+ out_dir.mkdir(parents=True, exist_ok=True)
183
+
184
+ success = 0
185
+ failed = 0
186
+
187
+ for subdir in subdirs:
188
+ click.echo(f"\n{'='*60}")
189
+ click.echo(f"Batch: {subdir.name}")
190
+ click.echo(f"{'='*60}")
191
+
192
+ # Look for audio_* files in the subfolder or parent
193
+ audio_path = None
194
+ if audio:
195
+ audio_path = Path(audio)
196
+ else:
197
+ # Auto-discover audio files
198
+ audio_files = sorted(
199
+ p for p in subdir.iterdir()
200
+ if p.suffix.lower() in {".wav", ".mp3", ".m4a", ".aac", ".flac"}
201
+ )
202
+ if audio_files:
203
+ audio_path = audio_files[0]
204
+
205
+ # Look for subtitle files
206
+ sub_files = sorted(
207
+ p for p in subdir.iterdir()
208
+ if p.suffix.lower() in {".srt", ".ass"}
209
+ )
210
+ sub_path = sub_files[0] if sub_files else None
211
+
212
+ config = Config(
213
+ image_dir=subdir,
214
+ output=out_dir / f"{subdir.name}.mp4",
215
+ duration=duration,
216
+ per_image_duration=per_image_duration,
217
+ subtitle=sub_path,
218
+ subtitle_format=subtitle_format,
219
+ audio=audio_path,
220
+ width=width,
221
+ height=height,
222
+ ffmpeg=ffmpeg,
223
+ keep_temps=keep_temps,
224
+ )
225
+
226
+ report = render_video(config)
227
+ if report and report.get("status") == "ok":
228
+ success += 1
229
+ else:
230
+ failed += 1
231
+
232
+ click.echo(f"\n{'='*60}")
233
+ click.echo(f"Batch complete: {success} succeeded, {failed} failed")
234
+ click.echo(f"{'='*60}")
235
+
236
+ if failed > 0:
237
+ sys.exit(1)
238
+
239
+
240
+ if __name__ == "__main__":
241
+ cli()
comicvid/pipeline.py ADDED
@@ -0,0 +1,262 @@
1
+ """Orchestration: scene building, concatenation, subtitle burn-in, verification."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import shutil
7
+ import subprocess
8
+ from pathlib import Path
9
+
10
+ from comicvid.types import Config
11
+ from comicvid.render import build_scene_video
12
+ from comicvid.subtitle import write_ass, write_srt
13
+
14
+
15
+ def _log(msg: str) -> None:
16
+ print(f"[comicvid] {msg}", flush=True)
17
+
18
+
19
+ def _run_cmd(cmd: list[str], desc: str = "") -> bool:
20
+ """Run a command, return True on success, print error on failure."""
21
+ _log(f"→ {desc or 'run'}")
22
+ result = subprocess.run(cmd, capture_output=True, text=True)
23
+ if result.returncode != 0:
24
+ _log(f" ✗ FAILED:")
25
+ _log(result.stderr[-2000:] if result.stderr else result.stdout[-2000:])
26
+ return False
27
+ tail = [l for l in result.stderr.split("\n") if l.strip()][-3:]
28
+ for line in tail:
29
+ _log(f" {line}")
30
+ return True
31
+
32
+
33
+ def resolve_image_list(image_dir: Path) -> list[Path]:
34
+ """Get sorted list of images from directory.
35
+
36
+ Supports: .png, .jpg, .jpeg, .webp, .bmp
37
+ """
38
+ extensions = {".png", ".jpg", ".jpeg", ".webp", ".bmp"}
39
+ images = sorted(
40
+ p for p in image_dir.iterdir()
41
+ if p.suffix.lower() in extensions
42
+ )
43
+ return images
44
+
45
+
46
+ def render_video(config: Config) -> dict | None:
47
+ """Render video from images in config.image_dir.
48
+
49
+ Pipeline:
50
+ 1. Resolve image list and durations
51
+ 2. Build each scene (Ken Burns + audio)
52
+ 3. Create subtitle file
53
+ 4. Concatenate scenes
54
+ 5. Burn subtitles
55
+ 6. Verify output
56
+
57
+ Args:
58
+ config: Render configuration.
59
+
60
+ Returns:
61
+ Report dict with metadata, or None on failure.
62
+ """
63
+ _log("=" * 60)
64
+ _log("comicvid — Render")
65
+ _log("=" * 60)
66
+
67
+ images = resolve_image_list(config.image_dir)
68
+ if not images:
69
+ _log("✗ No images found in " + str(config.image_dir))
70
+ return None
71
+
72
+ _log(f"Found {len(images)} images")
73
+
74
+ # ── Determine durations ──
75
+ if config.duration is not None:
76
+ # Spread total duration across images
77
+ per_image = config.duration / len(images)
78
+ durations = [per_image] * len(images)
79
+ else:
80
+ durations = [config.per_image_duration] * len(images)
81
+
82
+ # ── Create temp directory ──
83
+ temp_dir = config.temp_dir
84
+ scenes_dir = temp_dir / "scenes"
85
+ temp_dir.mkdir(parents=True, exist_ok=True)
86
+ scenes_dir.mkdir(exist_ok=True)
87
+ config.output.parent.mkdir(parents=True, exist_ok=True)
88
+
89
+ # ── Phase 1: Build scenes ──
90
+ _log(f"\n── Phase 1: Build {len(images)} scene(s) ──")
91
+ clip_paths: list[Path] = []
92
+ for i, (img_path, dur) in enumerate(zip(images, durations)):
93
+ clip = scenes_dir / f"scene_{i:04d}.mp4"
94
+ label = f"img_{i:04d}"
95
+ _log(f" Building {label} ({img_path.name}, {dur:.1f}s) ...")
96
+ if build_scene_video(clip, img_path, config.audio, dur, config, label):
97
+ clip_paths.append(clip)
98
+ size_kb = clip.stat().st_size / 1024 if clip.exists() else 0
99
+ _log(f" ✓ {label}: {size_kb:.0f} KB")
100
+ else:
101
+ _log(f" ✗ {label}: failed")
102
+ return None
103
+
104
+ # ── Phase 2: Create subtitles ──
105
+ _log(f"\n── Phase 2: Create Subtitles ──")
106
+ sub_texts: list[str] = []
107
+ if config.subtitles:
108
+ sub_texts = config.subtitles
109
+ elif config.subtitle and config.subtitle.exists():
110
+ # Read external subtitle file and convert to per-image mapping
111
+ sub_texts = _parse_external_subtitle(config.subtitle, len(images))
112
+ else:
113
+ sub_texts = [""] * len(images)
114
+
115
+ sub_path: Path | None = None
116
+ if any(t for t in sub_texts[:len(images)]):
117
+ if config.subtitle_format == "ass":
118
+ sub_path = temp_dir / "subtitles.ass"
119
+ write_ass(sub_path, durations, sub_texts[:len(images)],
120
+ config.width, config.height)
121
+ else:
122
+ sub_path = temp_dir / "subtitles.srt"
123
+ write_srt(sub_path, durations, sub_texts[:len(images)])
124
+ _log(f" {sub_path.name}: {sum(1 for t in sub_texts if t)} entries")
125
+
126
+ # ── Phase 3: Concatenate ──
127
+ _log(f"\n── Phase 3: Concatenate ──")
128
+ concat_file = temp_dir / "concat.txt"
129
+ with open(concat_file, "w") as f:
130
+ for clip in clip_paths:
131
+ f.write(f"file '{clip.absolute()}'\n")
132
+
133
+ concat_temp = temp_dir / "concat_output.mp4"
134
+ cmd_concat = [
135
+ config.ffmpeg, "-y",
136
+ "-f", "concat",
137
+ "-safe", "0",
138
+ "-i", str(concat_file),
139
+ "-c", "copy",
140
+ str(concat_temp),
141
+ ]
142
+ if not _run_cmd(cmd_concat, "Concatenate scenes"):
143
+ return None
144
+
145
+ # ── Phase 4: Burn subtitles ──
146
+ _log(f"\n── Phase 4: Burn Subtitles ──")
147
+ if sub_path and sub_path.exists():
148
+ if config.subtitle_format == "ass":
149
+ filter_expr = f"ass={sub_path}"
150
+ else:
151
+ filter_expr = f"subtitles={sub_path}"
152
+
153
+ cmd_sub = [
154
+ config.ffmpeg, "-y",
155
+ "-i", str(concat_temp),
156
+ "-vf", filter_expr,
157
+ "-c:v", "libx264",
158
+ "-preset", "medium",
159
+ "-crf", str(config.crf),
160
+ "-maxrate", config.video_bitrate,
161
+ "-bufsize", "3000k",
162
+ "-pix_fmt", "yuv420p",
163
+ "-c:a", "copy",
164
+ str(config.output),
165
+ ]
166
+ if not _run_cmd(cmd_sub, f"Burn subtitles ({config.subtitle_format.upper()})"):
167
+ return None
168
+ else:
169
+ shutil.copy2(concat_temp, config.output)
170
+ _log(" (no subtitles to burn)")
171
+
172
+ # ── Phase 5: Verify ──
173
+ _log(f"\n── Phase 5: Verification ──")
174
+ info = verify_video(config.output, config.ffmpeg)
175
+ _log(f" Output: {info['path']}")
176
+ _log(f" Size: {info['size_mb']:.2f} MB")
177
+ _log(f" Dur: {info.get('duration', 'N/A')}")
178
+ _log(f" Video: {info.get('video', 'N/A')}")
179
+ _log(f" Audio: {info.get('audio', 'N/A')}")
180
+
181
+ if info["passes"]:
182
+ _log(f"\n{'='*60}")
183
+ _log(f"✓ Render complete: {config.output}")
184
+ _log(f"{'='*60}")
185
+ info["status"] = "ok"
186
+ else:
187
+ _log(f"\n⚠ Output < 1 MB. Check manually.")
188
+ info["status"] = "small_output"
189
+
190
+ # ── Cleanup ──
191
+ if not config.keep_temps:
192
+ _log(" Cleaning up temp files...")
193
+ shutil.rmtree(temp_dir, ignore_errors=True)
194
+
195
+ return info
196
+
197
+
198
+ def verify_video(video_path: Path, ffmpeg: str = "ffmpeg") -> dict:
199
+ """Extract metadata from output video using ffmpeg."""
200
+ result = subprocess.run(
201
+ [ffmpeg, "-i", str(video_path), "-hide_banner"],
202
+ capture_output=True, text=True,
203
+ )
204
+ info: dict = {
205
+ "path": str(video_path),
206
+ "size_bytes": video_path.stat().st_size,
207
+ "size_mb": video_path.stat().st_size / (1024 * 1024),
208
+ }
209
+ for line in result.stderr.split("\n"):
210
+ if "Duration" in line:
211
+ info["duration"] = line.strip().split(",")[0].split("Duration:")[-1].strip()
212
+ if "Stream #0:0" in line and "Video" in line:
213
+ info["video"] = line.strip()
214
+ if "Stream #0:1" in line and "Audio" in line:
215
+ info["audio"] = line.strip()
216
+ if "bitrate" in line and "kb/s" in line:
217
+ parts = line.strip().split(",")
218
+ for p in parts:
219
+ if "kb/s" in p:
220
+ info["bitrate"] = p.strip()
221
+
222
+ info["passes"] = info.get("size_mb", 0) > 0
223
+ return info
224
+
225
+
226
+ def write_report(report: dict, path: Path) -> None:
227
+ """Write render report as JSON."""
228
+ path.parent.mkdir(parents=True, exist_ok=True)
229
+ path.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
230
+
231
+
232
+ def _parse_external_subtitle(sub_path: Path, num_images: int) -> list[str]:
233
+ """Parse an external SRT/ASS file into per-image subtitle mapping.
234
+
235
+ For simplicity, returns all non-empty lines as one subtitle per image.
236
+ More sophisticated parsing would use the SRT/ASS timing, but since
237
+ we divide time equally per image, we just map line-by-line.
238
+ """
239
+ content = sub_path.read_text(encoding="utf-8")
240
+ # Remove ASS headers/formatting
241
+ if sub_path.suffix.lower() == ".ass":
242
+ lines = []
243
+ in_events = False
244
+ for line in content.split("\n"):
245
+ stripped = line.strip()
246
+ if stripped == "[Events]":
247
+ in_events = True
248
+ continue
249
+ if in_events and stripped.startswith("Dialogue:"):
250
+ # Extract text after last comma
251
+ parts = stripped.split(",", 9)
252
+ if len(parts) >= 10:
253
+ lines.append(parts[9])
254
+ return (lines + [""] * num_images)[:num_images]
255
+ else:
256
+ # SRT: extract text between timestamps
257
+ lines = []
258
+ for block in content.strip().split("\n\n"):
259
+ parts = block.split("\n", 2)
260
+ if len(parts) >= 3:
261
+ lines.append(parts[2])
262
+ return (lines + [""] * num_images)[:num_images]
comicvid/render.py ADDED
@@ -0,0 +1,107 @@
1
+ """Single scene rendering with Ken Burns zoom effect."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import subprocess
6
+ from pathlib import Path
7
+
8
+ from comicvid.audio import reencode_audio
9
+ from comicvid.types import Config
10
+
11
+
12
+ def build_scene_video(
13
+ clip_path: Path,
14
+ img_path: Path,
15
+ audio_path: Path | None,
16
+ duration: float,
17
+ config: Config,
18
+ scene_label: str = "",
19
+ ) -> bool:
20
+ """Build a single scene video clip with Ken Burns zoom.
21
+
22
+ Applies:
23
+ - Ken Burns zoom (100% → 100%+zoom) via zoompan filter
24
+ - Centered crop to maintain aspect ratio
25
+ - Audio at config sample rate
26
+
27
+ Args:
28
+ clip_path: Output MP4 path for this scene.
29
+ img_path: Input image path.
30
+ audio_path: Optional audio file path.
31
+ duration: Clip duration in seconds.
32
+ config: Render configuration.
33
+ scene_label: Label for logging.
34
+
35
+ Returns:
36
+ True on success.
37
+ """
38
+ frames = int(duration * config.fps)
39
+ zoom_expr = f"1+{config.ken_burns_zoom}*on/{frames}"
40
+
41
+ has_audio = audio_path is not None and audio_path.exists()
42
+ aac_temp: Path | None = None
43
+
44
+ if has_audio:
45
+ aac_temp = clip_path.with_suffix(".aac")
46
+ if not reencode_audio(
47
+ audio_path, # type: ignore[arg-type]
48
+ aac_temp,
49
+ config.ffmpeg,
50
+ config.audio_sample_rate,
51
+ config.audio_bitrate,
52
+ ):
53
+ return False
54
+
55
+ cmd = [
56
+ config.ffmpeg, "-y",
57
+ "-loop", "1",
58
+ "-i", str(img_path),
59
+ "-i", str(aac_temp),
60
+ "-vf",
61
+ f"scale={config.resolution}:force_original_aspect_ratio=increase,"
62
+ f"crop={config.resolution},"
63
+ f"zoompan=z='{zoom_expr}':d={frames}:s={config.resolution_x}:fps={config.fps}",
64
+ "-c:v", "libx264",
65
+ "-preset", "medium",
66
+ "-crf", str(config.crf),
67
+ "-maxrate", config.video_bitrate,
68
+ "-bufsize", "3000k",
69
+ "-pix_fmt", "yuv420p",
70
+ "-c:a", "copy",
71
+ "-shortest",
72
+ "-t", str(duration),
73
+ str(clip_path),
74
+ ]
75
+ else:
76
+ cmd = [
77
+ config.ffmpeg, "-y",
78
+ "-loop", "1",
79
+ "-i", str(img_path),
80
+ "-vf",
81
+ f"scale={config.resolution}:force_original_aspect_ratio=increase,"
82
+ f"crop={config.resolution},"
83
+ f"zoompan=z='{zoom_expr}':d={frames}:s={config.resolution_x}:fps={config.fps}",
84
+ "-c:v", "libx264",
85
+ "-preset", "medium",
86
+ "-crf", str(config.crf),
87
+ "-maxrate", config.video_bitrate,
88
+ "-bufsize", "3000k",
89
+ "-pix_fmt", "yuv420p",
90
+ "-an",
91
+ "-t", str(duration),
92
+ str(clip_path),
93
+ ]
94
+
95
+ label = scene_label or clip_path.stem
96
+ result = subprocess.run(cmd, capture_output=True, text=True)
97
+ if result.returncode != 0:
98
+ print(f" [{label}] FAILED: {result.stderr[-800:]}")
99
+ return False
100
+
101
+ if has_audio and aac_temp is not None:
102
+ try:
103
+ aac_temp.unlink(missing_ok=True)
104
+ except OSError:
105
+ pass
106
+
107
+ return True
comicvid/subtitle.py ADDED
@@ -0,0 +1,203 @@
1
+ """SRT and ASS subtitle generation.
2
+
3
+ SRT: Simple, widely compatible plain-text format.
4
+ ASS: Advanced SubStation Alpha — styled (font size, stroke, position).
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from pathlib import Path
10
+
11
+
12
+ def _srt_ts(sec: float) -> str:
13
+ """Format seconds as SRT timestamp: HH:MM:SS,mmm"""
14
+ h = int(sec // 3600)
15
+ m = int((sec % 3600) // 60)
16
+ s = int(sec % 60)
17
+ ms = int((sec - int(sec)) * 1000)
18
+ return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"
19
+
20
+
21
+ def _ass_ts(sec: float) -> str:
22
+ """Format seconds as ASS timestamp: H:MM:SS.mm"""
23
+ h = int(sec // 3600)
24
+ m = int((sec % 3600) // 60)
25
+ s = sec % 60
26
+ return f"{h}:{m:02d}:{s:05.2f}"
27
+
28
+
29
+ def build_srt(
30
+ durations: list[float],
31
+ subtitles: list[str],
32
+ ) -> str:
33
+ """Build SRT subtitle content.
34
+
35
+ Args:
36
+ durations: Duration in seconds for each segment.
37
+ subtitles: Subtitle text per segment (empty string = no subtitle).
38
+
39
+ Returns:
40
+ Complete SRT file content.
41
+ """
42
+ lines: list[str] = []
43
+ current_time = 0.0
44
+ sub_idx = 0
45
+
46
+ for dur, text in zip(durations, subtitles):
47
+ if not text:
48
+ current_time += dur
49
+ continue
50
+ sub_idx += 1
51
+ lines.append(str(sub_idx))
52
+ lines.append(f"{_srt_ts(current_time)} --> {_srt_ts(current_time + dur)}")
53
+ lines.append(text)
54
+ lines.append("")
55
+ current_time += dur
56
+
57
+ return "\n".join(lines)
58
+
59
+
60
+ def build_ass(
61
+ durations: list[float],
62
+ subtitles: list[str],
63
+ video_width: int = 1280,
64
+ video_height: int = 720,
65
+ font_size: int = 28,
66
+ border_size: int = 2,
67
+ ) -> str:
68
+ """Build ASS subtitle content with styled formatting.
69
+
70
+ ASS provides:
71
+ - Font size (28px for readability)
72
+ - Border/outline (2px black stroke)
73
+ - Position (bottom-center)
74
+ - Shadow and colors
75
+
76
+ Args:
77
+ durations: Duration in seconds for each segment.
78
+ subtitles: Subtitle text per segment.
79
+ video_width, video_height: Output video dimensions.
80
+ font_size: Subtitle font size.
81
+ border_size: Black outline thickness.
82
+
83
+ Returns:
84
+ Complete ASS file content.
85
+ """
86
+ margin_v = int(video_height * 0.05)
87
+ margin_h = int(video_width * 0.02)
88
+
89
+ lines: list[str] = []
90
+ lines.append("[Script Info]")
91
+ lines.append("Title: comicvid Subtitles")
92
+ lines.append("ScriptType: v4.00+")
93
+ lines.append(f"PlayResX: {video_width}")
94
+ lines.append(f"PlayResY: {video_height}")
95
+ lines.append("ScaledBorderAndShadow: yes")
96
+ lines.append("")
97
+
98
+ lines.append("[V4+ Styles]")
99
+ lines.append(
100
+ "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, "
101
+ "OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, "
102
+ "ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, "
103
+ "Alignment, MarginL, MarginR, MarginV, Encoding"
104
+ )
105
+ primary = "&H00FFFFFF"
106
+ outline = "&H00000000"
107
+ font_name = _resolve_font_name()
108
+ lines.append(
109
+ f"Style: Default,{font_name},{font_size},"
110
+ f"{primary},{primary},"
111
+ f"{outline},{outline},"
112
+ f"0,0,0,0,"
113
+ f"100,100,0,0,"
114
+ f"1,{border_size},0,"
115
+ f"2,"
116
+ f"{margin_h},{margin_h},{margin_v},"
117
+ f"1"
118
+ )
119
+ lines.append("")
120
+
121
+ lines.append("[Events]")
122
+ lines.append(
123
+ "Format: Layer, Start, End, Style, Name, MarginL, MarginR, "
124
+ "MarginV, Effect, Text"
125
+ )
126
+
127
+ current_time = 0.0
128
+ for dur, text in zip(durations, subtitles):
129
+ if not text:
130
+ current_time += dur
131
+ continue
132
+ escaped = text.replace("\\", "\\\\").replace("{", "\\{").replace("}", "\\}")
133
+ lines.append(
134
+ f"Dialogue: 0,{_ass_ts(current_time)},{_ass_ts(current_time + dur)},"
135
+ f"Default,,0,0,0,,{escaped}"
136
+ )
137
+ current_time += dur
138
+
139
+ return "\n".join(lines)
140
+
141
+
142
+ def write_srt(path: Path, durations: list[float], subtitles: list[str]) -> Path:
143
+ """Write SRT file and return path."""
144
+ path.parent.mkdir(parents=True, exist_ok=True)
145
+ content = build_srt(durations, subtitles)
146
+ path.write_text(content, encoding="utf-8")
147
+ return path
148
+
149
+
150
+ def write_ass(
151
+ path: Path,
152
+ durations: list[float],
153
+ subtitles: list[str],
154
+ video_width: int = 1280,
155
+ video_height: int = 720,
156
+ ) -> Path:
157
+ """Write ASS file and return path."""
158
+ path.parent.mkdir(parents=True, exist_ok=True)
159
+ content = build_ass(durations, subtitles, video_width, video_height)
160
+ path.write_text(content, encoding="utf-8")
161
+ return path
162
+
163
+
164
+ def _resolve_font_name() -> str:
165
+ """Resolve a readable Chinese-capable font name for ASS.
166
+
167
+ Tries common system fonts; falls back to sans-serif.
168
+ """
169
+ import subprocess
170
+ import sys
171
+
172
+ candidates = [
173
+ "PingFang SC",
174
+ "Noto Sans CJK SC",
175
+ "Source Han Sans SC",
176
+ "STHeiti",
177
+ "Arial Unicode MS",
178
+ ]
179
+
180
+ for name in candidates:
181
+ try:
182
+ result = subprocess.run(
183
+ ["fc-list", f":lang=zh"],
184
+ capture_output=True, text=True, timeout=3,
185
+ )
186
+ if name.lower() in result.stdout.lower():
187
+ return name
188
+ except Exception:
189
+ pass
190
+
191
+ # Try common system fonts without Chinese filtering
192
+ for name in candidates:
193
+ try:
194
+ result = subprocess.run(
195
+ ["fc-list", name],
196
+ capture_output=True, text=True, timeout=3,
197
+ )
198
+ if name.lower() in result.stdout.lower():
199
+ return name
200
+ except Exception:
201
+ pass
202
+
203
+ return "sans-serif"
comicvid/types.py ADDED
@@ -0,0 +1,86 @@
1
+ """Configuration dataclass for comicvid rendering."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import dataclasses
6
+ from pathlib import Path
7
+
8
+
9
+ @dataclasses.dataclass
10
+ class Config:
11
+ """Render configuration for a single comicvid video."""
12
+
13
+ # Input paths
14
+ image_dir: Path
15
+ """Directory containing panel images (sorted by filename)."""
16
+
17
+ # Output
18
+ output: Path
19
+ """Output MP4 path."""
20
+
21
+ # Timing
22
+ duration: float | None = None
23
+ """Total video duration in seconds. If None, infer from image count."""
24
+
25
+ per_image_duration: float = 3.0
26
+ """Seconds per image when duration is not specified."""
27
+
28
+ # Subtitles
29
+ subtitle: Path | None = None
30
+ """Optional external subtitle file (SRT or ASS)."""
31
+
32
+ subtitle_format: str = "ass"
33
+ """Subtitle format: 'ass' (styled) or 'srt' (simple)."""
34
+
35
+ subtitles: list[str] | None = None
36
+ """Optional list of subtitle texts, one per image. Generated as ASS."""
37
+
38
+ # Audio
39
+ audio: Path | None = None
40
+ """Optional audio file (WAV, MP3, etc.). AAC-encoded before muxing."""
41
+
42
+ # Resolution
43
+ width: int = 1280
44
+ """Output video width in pixels."""
45
+
46
+ height: int = 720
47
+ """Output video height in pixels."""
48
+
49
+ # Video quality
50
+ fps: int = 24
51
+ """Frames per second."""
52
+
53
+ crf: int = 23
54
+ """H.264 CRF quality (lower = better, 18-28 typical)."""
55
+
56
+ video_bitrate: str = "1500k"
57
+ """Video bitrate."""
58
+
59
+ # Audio quality
60
+ audio_sample_rate: int = 44100
61
+ """Audio sample rate in Hz."""
62
+
63
+ audio_bitrate: str = "128k"
64
+ """Audio bitrate."""
65
+
66
+ # Ken Burns
67
+ ken_burns_zoom: float = 0.05
68
+ """Zoom amount (0.05 = 100% → 105%)."""
69
+
70
+ # Rendering
71
+ ffmpeg: str = "ffmpeg"
72
+ """FFmpeg binary path."""
73
+
74
+ temp_dir: Path = Path("/tmp") / "comicvid"
75
+ """Temporary working directory."""
76
+
77
+ keep_temps: bool = False
78
+ """If True, do not clean up temporary files."""
79
+
80
+ @property
81
+ def resolution(self) -> str:
82
+ return f"{self.width}:{self.height}"
83
+
84
+ @property
85
+ def resolution_x(self) -> str:
86
+ return f"{self.width}x{self.height}"
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: comicvid
3
+ Version: 0.1.0
4
+ Summary: Static images to animated video — Ken Burns zoom + ASS subtitles + audio sync
5
+ Author: comicvid contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/chfr19820610-cell/comicvid
8
+ Project-URL: Repository, https://github.com/chfr19820610-cell/comicvid.git
9
+ Keywords: video,slideshow,ken-burns,subtitles,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Multimedia :: Video :: Conversion
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: click>=8.0
26
+ Dynamic: license-file
27
+
28
+ # comicvid
29
+
30
+ **Static images to animated video — Ken Burns zoom + ASS subtitles + audio sync.**
31
+
32
+ Turn a folder of images into a polished MP4 video with a single command. Pure FFmpeg + Python — zero API costs.
33
+
34
+ ## Features
35
+
36
+ - **Ken Burns zoom** — subtle 100% → 105% camera movement on each image
37
+ - **ASS subtitles** — styled (28px font, black stroke, bottom-center) with Chinese font support
38
+ - **Audio sync** — AAC 44100 Hz mono, automatically synchronized to video
39
+ - **Landscape & portrait** — 1280×720 or 1080×1920 (any resolution)
40
+ - **Batch mode** — process multiple subfolders at once
41
+ - **Pure CLI** — no GUI, no config files, no API keys
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install comicvid
47
+ ```
48
+
49
+ Requires **Python 3.10+** and **FFmpeg** installed on your system.
50
+
51
+ ## Usage
52
+
53
+ ### Basic render
54
+
55
+ ```bash
56
+ comicvid render ./panels/ --output episode.mp4 --duration 30
57
+ ```
58
+
59
+ ### With subtitles and audio
60
+
61
+ ```bash
62
+ comicvid render ./panels/ \
63
+ --output episode.mp4 \
64
+ --duration 30 \
65
+ --subtitle captions.srt \
66
+ --audio narration.wav \
67
+ --width 1280 --height 720
68
+ ```
69
+
70
+ ### Per-image text subtitles
71
+
72
+ ```bash
73
+ comicvid render ./panels/ \
74
+ --output episode.mp4 \
75
+ -t "Hello, world!" \
76
+ -t "Second panel" \
77
+ -t "Third panel" \
78
+ --audio music.wav
79
+ ```
80
+
81
+ ### Vertical video (TikTok/Reels)
82
+
83
+ ```bash
84
+ comicvid render ./panels/ \
85
+ --output vertical.mp4 \
86
+ --duration 60 \
87
+ --resolution 1080x1920
88
+ ```
89
+
90
+ ### Batch mode (episode directories)
91
+
92
+ ```bash
93
+ comicvid batch ./episodes/ --output-dir ./output/
94
+ ```
95
+
96
+ ### All options
97
+
98
+ ```
99
+ Usage: comicvid render [OPTIONS] IMAGE_DIR
100
+
101
+ Render images from IMAGE_DIR into an MP4 video.
102
+
103
+ Options:
104
+ -o, --output TEXT Output MP4 path. [default: output.mp4]
105
+ --duration FLOAT Total video duration in seconds.
106
+ --per-image-duration FLOAT Seconds per image. [default: 3.0]
107
+ --subtitle FILE External subtitle file (SRT or ASS).
108
+ --subtitle-format [ass|srt] Subtitle format. [default: ass]
109
+ -t, --text TEXT Subtitle text per image.
110
+ --audio FILE Audio file (WAV, MP3, etc.).
111
+ --width INTEGER Output video width. [default: 1280]
112
+ --height INTEGER Output video height. [default: 720]
113
+ --resolution TEXT Shortcut: '1920x1080'.
114
+ --fps INTEGER Frames per second. [default: 24]
115
+ --crf INTEGER H.264 CRF quality. [default: 23]
116
+ --video-bitrate TEXT Video bitrate. [default: 1500k]
117
+ --zoom FLOAT Ken Burns zoom amount. [default: 0.05]
118
+ --ffmpeg TEXT FFmpeg binary path. [default: ffmpeg]
119
+ --keep-temps Keep temporary files.
120
+ --help Show this message and exit.
121
+ ```
122
+
123
+ ## Input format
124
+
125
+ `IMAGE_DIR` should contain panel images sorted by filename. Supported formats:
126
+ - PNG, JPG, JPEG, WEBP, BMP
127
+
128
+ Images are processed in alphabetical order.
129
+
130
+ ## How it works
131
+
132
+ 1. **Scene building** — each image is looped for its duration with a Ken Burns `zoompan` filter (100% → 105%)
133
+ 2. **Audio encoding** — `ffmpeg` re-encodes audio to AAC at 44100 Hz mono
134
+ 3. **Subtitles** — ASS format with styled Chinese-capable fonts, burned into video
135
+ 4. **Concatenation** — FFmpeg concat demuxer assembles scenes
136
+ 5. **Output** — Final MP4 with H.264 video + AAC audio
137
+
138
+ ## License
139
+
140
+ Apache 2.0
@@ -0,0 +1,13 @@
1
+ comicvid/__init__.py,sha256=9VHQ_Si5jrrCHfyvoAZqsJOKTEI72jlNhKclfZPCSDA,114
2
+ comicvid/audio.py,sha256=6wZOU2HR8NKOjvV7vZF2YzCOfWG02NFTHN8CeWOabrM,1904
3
+ comicvid/cli.py,sha256=nBW4StcDvzwlI3jtoCzfwd88gv3x-Fgvc70UzVv2IeE,8258
4
+ comicvid/pipeline.py,sha256=qPzCHLGIIK6tVAZl91aOjuLqGbegABDF3yV04AfBlEo,9008
5
+ comicvid/render.py,sha256=TzP0dL5R9_fufU-JhaIBbEI4HLEl7i43AECO9rs1DVM,3162
6
+ comicvid/subtitle.py,sha256=64Flhkzlp5qnItRdIeG2kJ4bb0uTMPWouMenJNBf8A0,5600
7
+ comicvid/types.py,sha256=DBZg-Oh8bGMTvRKXkBHPj_oaDQjja6kJhZkkEAKYjmI,2080
8
+ comicvid-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ comicvid-0.1.0.dist-info/METADATA,sha256=2olkIZEOGCvKlmRCrNCv6TL3fTNmJwVaNEW3kHPETiw,4497
10
+ comicvid-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
11
+ comicvid-0.1.0.dist-info/entry_points.txt,sha256=HAuPcX4MvNTp-1kbVS2gFU60OxGZcqPSK9dRrf_gD10,46
12
+ comicvid-0.1.0.dist-info/top_level.txt,sha256=F1Vc9iw4wGT3q6VZ76W-NU7vnTyvv8wOWcB-7M-a9xU,9
13
+ comicvid-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ comicvid = comicvid.cli:cli
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ comicvid