comicvid 0.1.0__tar.gz
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-0.1.0/LICENSE +201 -0
- comicvid-0.1.0/PKG-INFO +140 -0
- comicvid-0.1.0/README.md +113 -0
- comicvid-0.1.0/pyproject.toml +54 -0
- comicvid-0.1.0/setup.cfg +4 -0
- comicvid-0.1.0/src/comicvid/__init__.py +3 -0
- comicvid-0.1.0/src/comicvid/audio.py +69 -0
- comicvid-0.1.0/src/comicvid/cli.py +241 -0
- comicvid-0.1.0/src/comicvid/pipeline.py +262 -0
- comicvid-0.1.0/src/comicvid/render.py +107 -0
- comicvid-0.1.0/src/comicvid/subtitle.py +203 -0
- comicvid-0.1.0/src/comicvid/types.py +86 -0
- comicvid-0.1.0/src/comicvid.egg-info/PKG-INFO +140 -0
- comicvid-0.1.0/src/comicvid.egg-info/SOURCES.txt +22 -0
- comicvid-0.1.0/src/comicvid.egg-info/dependency_links.txt +1 -0
- comicvid-0.1.0/src/comicvid.egg-info/entry_points.txt +2 -0
- comicvid-0.1.0/src/comicvid.egg-info/requires.txt +1 -0
- comicvid-0.1.0/src/comicvid.egg-info/top_level.txt +1 -0
- comicvid-0.1.0/tests/test_audio.py +80 -0
- comicvid-0.1.0/tests/test_cli.py +152 -0
- comicvid-0.1.0/tests/test_pipeline.py +64 -0
- comicvid-0.1.0/tests/test_pipeline_e2e.py +202 -0
- comicvid-0.1.0/tests/test_render.py +33 -0
- comicvid-0.1.0/tests/test_subtitle.py +107 -0
comicvid-0.1.0/LICENSE
ADDED
|
@@ -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.
|
comicvid-0.1.0/PKG-INFO
ADDED
|
@@ -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
|
comicvid-0.1.0/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# comicvid
|
|
2
|
+
|
|
3
|
+
**Static images to animated video — Ken Burns zoom + ASS subtitles + audio sync.**
|
|
4
|
+
|
|
5
|
+
Turn a folder of images into a polished MP4 video with a single command. Pure FFmpeg + Python — zero API costs.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Ken Burns zoom** — subtle 100% → 105% camera movement on each image
|
|
10
|
+
- **ASS subtitles** — styled (28px font, black stroke, bottom-center) with Chinese font support
|
|
11
|
+
- **Audio sync** — AAC 44100 Hz mono, automatically synchronized to video
|
|
12
|
+
- **Landscape & portrait** — 1280×720 or 1080×1920 (any resolution)
|
|
13
|
+
- **Batch mode** — process multiple subfolders at once
|
|
14
|
+
- **Pure CLI** — no GUI, no config files, no API keys
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install comicvid
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires **Python 3.10+** and **FFmpeg** installed on your system.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic render
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
comicvid render ./panels/ --output episode.mp4 --duration 30
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### With subtitles and audio
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
comicvid render ./panels/ \
|
|
36
|
+
--output episode.mp4 \
|
|
37
|
+
--duration 30 \
|
|
38
|
+
--subtitle captions.srt \
|
|
39
|
+
--audio narration.wav \
|
|
40
|
+
--width 1280 --height 720
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Per-image text subtitles
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
comicvid render ./panels/ \
|
|
47
|
+
--output episode.mp4 \
|
|
48
|
+
-t "Hello, world!" \
|
|
49
|
+
-t "Second panel" \
|
|
50
|
+
-t "Third panel" \
|
|
51
|
+
--audio music.wav
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Vertical video (TikTok/Reels)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
comicvid render ./panels/ \
|
|
58
|
+
--output vertical.mp4 \
|
|
59
|
+
--duration 60 \
|
|
60
|
+
--resolution 1080x1920
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Batch mode (episode directories)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
comicvid batch ./episodes/ --output-dir ./output/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### All options
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Usage: comicvid render [OPTIONS] IMAGE_DIR
|
|
73
|
+
|
|
74
|
+
Render images from IMAGE_DIR into an MP4 video.
|
|
75
|
+
|
|
76
|
+
Options:
|
|
77
|
+
-o, --output TEXT Output MP4 path. [default: output.mp4]
|
|
78
|
+
--duration FLOAT Total video duration in seconds.
|
|
79
|
+
--per-image-duration FLOAT Seconds per image. [default: 3.0]
|
|
80
|
+
--subtitle FILE External subtitle file (SRT or ASS).
|
|
81
|
+
--subtitle-format [ass|srt] Subtitle format. [default: ass]
|
|
82
|
+
-t, --text TEXT Subtitle text per image.
|
|
83
|
+
--audio FILE Audio file (WAV, MP3, etc.).
|
|
84
|
+
--width INTEGER Output video width. [default: 1280]
|
|
85
|
+
--height INTEGER Output video height. [default: 720]
|
|
86
|
+
--resolution TEXT Shortcut: '1920x1080'.
|
|
87
|
+
--fps INTEGER Frames per second. [default: 24]
|
|
88
|
+
--crf INTEGER H.264 CRF quality. [default: 23]
|
|
89
|
+
--video-bitrate TEXT Video bitrate. [default: 1500k]
|
|
90
|
+
--zoom FLOAT Ken Burns zoom amount. [default: 0.05]
|
|
91
|
+
--ffmpeg TEXT FFmpeg binary path. [default: ffmpeg]
|
|
92
|
+
--keep-temps Keep temporary files.
|
|
93
|
+
--help Show this message and exit.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Input format
|
|
97
|
+
|
|
98
|
+
`IMAGE_DIR` should contain panel images sorted by filename. Supported formats:
|
|
99
|
+
- PNG, JPG, JPEG, WEBP, BMP
|
|
100
|
+
|
|
101
|
+
Images are processed in alphabetical order.
|
|
102
|
+
|
|
103
|
+
## How it works
|
|
104
|
+
|
|
105
|
+
1. **Scene building** — each image is looped for its duration with a Ken Burns `zoompan` filter (100% → 105%)
|
|
106
|
+
2. **Audio encoding** — `ffmpeg` re-encodes audio to AAC at 44100 Hz mono
|
|
107
|
+
3. **Subtitles** — ASS format with styled Chinese-capable fonts, burned into video
|
|
108
|
+
4. **Concatenation** — FFmpeg concat demuxer assembles scenes
|
|
109
|
+
5. **Output** — Final MP4 with H.264 video + AAC audio
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Apache 2.0
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "comicvid"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Static images to animated video — Ken Burns zoom + ASS subtitles + audio sync"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "Apache-2.0"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "comicvid contributors"},
|
|
13
|
+
]
|
|
14
|
+
keywords = ["video", "slideshow", "ken-burns", "subtitles", "cli"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: End Users/Desktop",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Multimedia :: Video :: Conversion",
|
|
27
|
+
"Topic :: Utilities",
|
|
28
|
+
]
|
|
29
|
+
requires-python = ">=3.10"
|
|
30
|
+
dependencies = [
|
|
31
|
+
"click>=8.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/chfr19820610-cell/comicvid"
|
|
36
|
+
Repository = "https://github.com/chfr19820610-cell/comicvid.git"
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
comicvid = "comicvid.cli:cli"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
include = ["comicvid*"]
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
python_files = ["test_*.py"]
|
|
48
|
+
|
|
49
|
+
[tool.coverage.run]
|
|
50
|
+
source = ["comicvid"]
|
|
51
|
+
omit = ["*/tests/*"]
|
|
52
|
+
|
|
53
|
+
[tool.coverage.report]
|
|
54
|
+
fail_under = 80
|
comicvid-0.1.0/setup.cfg
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
|