unrender 0.2.1__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.
Files changed (101) hide show
  1. unrender-0.2.1/LICENSE +201 -0
  2. unrender-0.2.1/NOTICE +18 -0
  3. unrender-0.2.1/PKG-INFO +478 -0
  4. unrender-0.2.1/README.md +415 -0
  5. unrender-0.2.1/pyproject.toml +140 -0
  6. unrender-0.2.1/setup.cfg +4 -0
  7. unrender-0.2.1/src/unrender/__init__.py +15 -0
  8. unrender-0.2.1/src/unrender/__main__.py +4 -0
  9. unrender-0.2.1/src/unrender/adapters/__init__.py +33 -0
  10. unrender-0.2.1/src/unrender/adapters/artifacts.py +32 -0
  11. unrender-0.2.1/src/unrender/adapters/paths.py +105 -0
  12. unrender-0.2.1/src/unrender/adapters/rows.py +96 -0
  13. unrender-0.2.1/src/unrender/adapters/stems.py +143 -0
  14. unrender-0.2.1/src/unrender/cli/__init__.py +5 -0
  15. unrender-0.2.1/src/unrender/cli/commands/__init__.py +39 -0
  16. unrender-0.2.1/src/unrender/cli/commands/audio.py +283 -0
  17. unrender-0.2.1/src/unrender/cli/commands/context.py +342 -0
  18. unrender-0.2.1/src/unrender/cli/commands/export.py +13 -0
  19. unrender-0.2.1/src/unrender/cli/commands/face.py +54 -0
  20. unrender-0.2.1/src/unrender/cli/commands/health.py +64 -0
  21. unrender-0.2.1/src/unrender/cli/commands/labels.py +33 -0
  22. unrender-0.2.1/src/unrender/cli/commands/timeline.py +57 -0
  23. unrender-0.2.1/src/unrender/cli/commands/voice.py +116 -0
  24. unrender-0.2.1/src/unrender/cli/helpers.py +53 -0
  25. unrender-0.2.1/src/unrender/cli/main.py +39 -0
  26. unrender-0.2.1/src/unrender/cli/parser.py +411 -0
  27. unrender-0.2.1/src/unrender/cloning/__init__.py +5 -0
  28. unrender-0.2.1/src/unrender/cloning/voice.py +476 -0
  29. unrender-0.2.1/src/unrender/dialogue/__init__.py +27 -0
  30. unrender-0.2.1/src/unrender/dialogue/clusters.py +344 -0
  31. unrender-0.2.1/src/unrender/dialogue/dub_script.py +326 -0
  32. unrender-0.2.1/src/unrender/dialogue/lines.py +684 -0
  33. unrender-0.2.1/src/unrender/dialogue/plan_writers.py +108 -0
  34. unrender-0.2.1/src/unrender/dialogue/transcription.py +266 -0
  35. unrender-0.2.1/src/unrender/exports/__init__.py +5 -0
  36. unrender-0.2.1/src/unrender/exports/artifacts.py +84 -0
  37. unrender-0.2.1/src/unrender/identity/__init__.py +27 -0
  38. unrender-0.2.1/src/unrender/identity/face.py +551 -0
  39. unrender-0.2.1/src/unrender/identity/resolution.py +203 -0
  40. unrender-0.2.1/src/unrender/identity/voice.py +410 -0
  41. unrender-0.2.1/src/unrender/io/__init__.py +1 -0
  42. unrender-0.2.1/src/unrender/io/csv.py +14 -0
  43. unrender-0.2.1/src/unrender/io/json.py +14 -0
  44. unrender-0.2.1/src/unrender/manifests/__init__.py +37 -0
  45. unrender-0.2.1/src/unrender/manifests/fingerprints.py +94 -0
  46. unrender-0.2.1/src/unrender/manifests/loaders.py +259 -0
  47. unrender-0.2.1/src/unrender/manifests/models.py +58 -0
  48. unrender-0.2.1/src/unrender/manifests/store.py +50 -0
  49. unrender-0.2.1/src/unrender/media/__init__.py +1 -0
  50. unrender-0.2.1/src/unrender/media/audio.py +143 -0
  51. unrender-0.2.1/src/unrender/media/ffmpeg.py +229 -0
  52. unrender-0.2.1/src/unrender/media/names.py +8 -0
  53. unrender-0.2.1/src/unrender/media/timecode.py +44 -0
  54. unrender-0.2.1/src/unrender/project/__init__.py +17 -0
  55. unrender-0.2.1/src/unrender/project/config.py +149 -0
  56. unrender-0.2.1/src/unrender/project/paths.py +177 -0
  57. unrender-0.2.1/src/unrender/py.typed +0 -0
  58. unrender-0.2.1/src/unrender/separation/__init__.py +20 -0
  59. unrender-0.2.1/src/unrender/separation/audioshake.py +367 -0
  60. unrender-0.2.1/src/unrender/separation/audioshake_client.py +306 -0
  61. unrender-0.2.1/src/unrender/separation/bandit.py +448 -0
  62. unrender-0.2.1/src/unrender/separation/models.py +25 -0
  63. unrender-0.2.1/src/unrender/shots/__init__.py +15 -0
  64. unrender-0.2.1/src/unrender/shots/dx.py +128 -0
  65. unrender-0.2.1/src/unrender/shots/stems.py +217 -0
  66. unrender-0.2.1/src/unrender/speakers/__init__.py +33 -0
  67. unrender-0.2.1/src/unrender/speakers/labeling.py +225 -0
  68. unrender-0.2.1/src/unrender/speakers/registry.py +219 -0
  69. unrender-0.2.1/src/unrender/timeline/__init__.py +20 -0
  70. unrender-0.2.1/src/unrender/timeline/builder.py +485 -0
  71. unrender-0.2.1/src/unrender/timeline/media.py +130 -0
  72. unrender-0.2.1/src/unrender/timeline/sources.py +276 -0
  73. unrender-0.2.1/src/unrender.egg-info/PKG-INFO +478 -0
  74. unrender-0.2.1/src/unrender.egg-info/SOURCES.txt +99 -0
  75. unrender-0.2.1/src/unrender.egg-info/dependency_links.txt +1 -0
  76. unrender-0.2.1/src/unrender.egg-info/entry_points.txt +2 -0
  77. unrender-0.2.1/src/unrender.egg-info/requires.txt +36 -0
  78. unrender-0.2.1/src/unrender.egg-info/top_level.txt +1 -0
  79. unrender-0.2.1/tests/test_adapters.py +140 -0
  80. unrender-0.2.1/tests/test_audioshake.py +191 -0
  81. unrender-0.2.1/tests/test_bandit.py +160 -0
  82. unrender-0.2.1/tests/test_cli.py +315 -0
  83. unrender-0.2.1/tests/test_clusters.py +286 -0
  84. unrender-0.2.1/tests/test_dialogue_lines.py +508 -0
  85. unrender-0.2.1/tests/test_dub_script.py +55 -0
  86. unrender-0.2.1/tests/test_face_clustering.py +126 -0
  87. unrender-0.2.1/tests/test_ffmpeg.py +175 -0
  88. unrender-0.2.1/tests/test_fingerprints.py +93 -0
  89. unrender-0.2.1/tests/test_identity.py +43 -0
  90. unrender-0.2.1/tests/test_labels_and_artifacts.py +246 -0
  91. unrender-0.2.1/tests/test_manifests.py +33 -0
  92. unrender-0.2.1/tests/test_matching_and_export.py +217 -0
  93. unrender-0.2.1/tests/test_project_config.py +308 -0
  94. unrender-0.2.1/tests/test_restartability.py +33 -0
  95. unrender-0.2.1/tests/test_shot_audio.py +134 -0
  96. unrender-0.2.1/tests/test_timecode.py +49 -0
  97. unrender-0.2.1/tests/test_timeline.py +562 -0
  98. unrender-0.2.1/tests/test_timeline_sources.py +244 -0
  99. unrender-0.2.1/tests/test_unrender_package.py +8 -0
  100. unrender-0.2.1/tests/test_voice.py +48 -0
  101. unrender-0.2.1/tests/test_voice_clone.py +247 -0
unrender-0.2.1/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 Derivative
95
+ 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 2026 Muhammad Hadi Yusufali
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.
unrender-0.2.1/NOTICE ADDED
@@ -0,0 +1,18 @@
1
+ Unrender
2
+ Copyright 2026 Muhammad Hadi Yusufali
3
+
4
+ This product includes software developed by Muhammad Hadi Yusufali.
5
+
6
+ Licensed under the Apache License, Version 2.0. See the LICENSE file for the
7
+ full license text.
8
+
9
+ Optional, separately installed components are governed by their own licenses,
10
+ including but not limited to:
11
+
12
+ - Music-Source-Separation-Training (BandIt/MSST) backend
13
+ - pyannote.audio voice embedding models
14
+ - WhisperX transcription models
15
+ - InsightFace face models
16
+
17
+ These dependencies are not bundled with Unrender. Review each project's license
18
+ and model terms before use, particularly for commercial applications.
@@ -0,0 +1,478 @@
1
+ Metadata-Version: 2.4
2
+ Name: unrender
3
+ Version: 0.2.1
4
+ Summary: Reconstruct editor-friendly timelines from flattened final renders.
5
+ Author: Muhammad Hadi Yusufali
6
+ Maintainer: Muhammad Hadi Yusufali
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/mhadifilms/unrender
9
+ Project-URL: Repository, https://github.com/mhadifilms/unrender
10
+ Project-URL: Issues, https://github.com/mhadifilms/unrender/issues
11
+ Project-URL: Changelog, https://github.com/mhadifilms/unrender/blob/main/CHANGELOG.md
12
+ Keywords: audio,video,source-separation,diarization,speaker-identification,post-production,film,dubbing,media
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
26
+ Classifier: Topic :: Multimedia :: Video
27
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ License-File: NOTICE
33
+ Requires-Dist: numpy>=1.24
34
+ Requires-Dist: opencv-python>=4.8
35
+ Requires-Dist: Pillow>=10
36
+ Requires-Dist: requests>=2.31
37
+ Requires-Dist: scikit-learn>=1.3
38
+ Requires-Dist: scipy>=1.10
39
+ Provides-Extra: face
40
+ Requires-Dist: insightface; extra == "face"
41
+ Requires-Dist: onnxruntime; extra == "face"
42
+ Provides-Extra: voice
43
+ Requires-Dist: pyannote.audio; extra == "voice"
44
+ Requires-Dist: torchaudio; extra == "voice"
45
+ Provides-Extra: transcription
46
+ Requires-Dist: whisperx; extra == "transcription"
47
+ Provides-Extra: scripts
48
+ Requires-Dist: openpyxl; extra == "scripts"
49
+ Requires-Dist: python-docx; extra == "scripts"
50
+ Provides-Extra: clone
51
+ Requires-Dist: mlx-audio>=0.4.4; extra == "clone"
52
+ Provides-Extra: timeline
53
+ Requires-Dist: opentimelineio>=0.17; extra == "timeline"
54
+ Provides-Extra: dev
55
+ Requires-Dist: black>=24.0; extra == "dev"
56
+ Requires-Dist: build>=1.0; extra == "dev"
57
+ Requires-Dist: mypy>=1.8; extra == "dev"
58
+ Requires-Dist: opentimelineio>=0.17; extra == "dev"
59
+ Requires-Dist: pre-commit>=3.5; extra == "dev"
60
+ Requires-Dist: pytest>=7.4; extra == "dev"
61
+ Requires-Dist: ruff>=0.4; extra == "dev"
62
+ Dynamic: license-file
63
+
64
+ # Unrender
65
+
66
+ [![CI](https://github.com/mhadifilms/unrender/actions/workflows/ci.yml/badge.svg)](https://github.com/mhadifilms/unrender/actions/workflows/ci.yml)
67
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
68
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
69
+
70
+ Unrender reconstructs an editor-friendly set of media artifacts from a flattened
71
+ final render. It separates the final mix into useful layers, identifies speakers,
72
+ cuts dialogue into reusable units, maps those units back onto shots, and writes
73
+ JSON/CSV plans plus stem files that an editor or downstream tool can consume.
74
+
75
+ The target shape is:
76
+
77
+ - video organized by shot
78
+ - dialogue as dialogue-line and shot-level stems
79
+ - music as its own source layer
80
+ - effects as their own source layer
81
+ - speaker identity tracked through one shared speaker database
82
+
83
+ ## Install
84
+
85
+ Unrender requires Python 3.10+ and a working `ffmpeg` on your `PATH`.
86
+
87
+ Install the latest version directly from GitHub:
88
+
89
+ ```bash
90
+ python3 -m pip install "git+https://github.com/mhadifilms/unrender.git"
91
+ ```
92
+
93
+ For development from a local checkout:
94
+
95
+ ```bash
96
+ python3 -m venv .venv
97
+ ./.venv/bin/python -m pip install -e ".[dev]"
98
+ ```
99
+
100
+ Install only the media extras you need:
101
+
102
+ ```bash
103
+ ./.venv/bin/python -m pip install -e ".[face,voice,transcription,scripts]"
104
+ ```
105
+
106
+ Optional extras:
107
+
108
+ - `face`: real face detection and embeddings
109
+ - `voice`: real voice embeddings
110
+ - `transcription`: WhisperX dialogue transcription
111
+ - `scripts`: XLSX/DOCX dub script parsing
112
+ - `clone`: MLX/Qwen3-TTS voice clone synthesis on Apple Silicon
113
+ - `timeline`: OpenTimelineIO timeline reconstruction (`unrender timeline build`)
114
+
115
+ The optional BandIt/MSST source separation backend is installed separately
116
+ (its dependency is not on PyPI, so it cannot be a package extra).
117
+
118
+ AudioShake separation requires an API key:
119
+
120
+ ```bash
121
+ export AUDIOSHAKE_API_KEY=...
122
+ ```
123
+
124
+ The BandIt backend installs upstream Music-Source-Separation-Training and does
125
+ not require a local checkout:
126
+
127
+ ```bash
128
+ ./.venv/bin/python -m pip install "music-source-separation-training[bandit] @ git+https://github.com/ZFTurbo/Music-Source-Separation-Training.git@ccc011abf7f89dd7922bb2888d48493b575c0289"
129
+ unrender audio separate -p show-a --source-backend bandit
130
+ ```
131
+
132
+ By default, `unrender` uses the BandIt/MSST package config and downloads the
133
+ BandIt Plus checkpoint into the user cache, verifying its checksum before use.
134
+ Use `--bandit-config` or `--bandit-checkpoint` to override those paths. On Apple
135
+ Silicon, the runtime casts unsupported float64 model state to float32 before
136
+ moving the model to MPS, so no patched MSST checkout is required.
137
+
138
+ ## Inputs
139
+
140
+ Most runs start from these inputs:
141
+
142
+ - `speakers.json`: canonical speaker names and aliases
143
+ - `proxy_master.mov`: reviewable master/proxy for face matching
144
+ - `full_audio.wav`: full mix or full audio stem
145
+ - `shots.csv`: shot IDs, video paths, and start/end seconds
146
+
147
+ If you already have an isolated dialogue stem, use `dx_stem` or `--dx-stem`
148
+ instead of `full_audio`.
149
+
150
+ Example `speakers.json`:
151
+
152
+ ```json
153
+ {
154
+ "speakers": {
155
+ "JORDAN": { "aliases": [] },
156
+ "ALEX": { "aliases": ["ALEKS"] }
157
+ }
158
+ }
159
+ ```
160
+
161
+ Manual labels are constrained to the configured speaker set. Aliases resolve to
162
+ canonical names.
163
+
164
+ Example `shots.csv`:
165
+
166
+ ```csv
167
+ shot_id,video_path,start_sec,end_sec
168
+ 001,/path/to/shot_001_proxy.mov,102.25,106.75
169
+ 002,/path/to/shot_002_proxy.mov,215.10,218.30
170
+ ```
171
+
172
+ For tighter face matching, add a target face box:
173
+
174
+ ```csv
175
+ shot_id,video_path,start_sec,end_sec,target_face_box
176
+ 001,/path/to/shot_001_proxy.mov,102.25,106.75,"[320, 140, 180, 220]"
177
+ ```
178
+
179
+ Supported target box columns are `target_face_box`, `face_box`, `bbox`, or split
180
+ columns `target_x,target_y,target_w,target_h`.
181
+
182
+ ## Project Config
183
+
184
+ Use `-p` / `--project` to avoid repeating paths. Project configs live under
185
+ `config/` by default, and the `.json` suffix is optional.
186
+
187
+ ```bash
188
+ unrender doctor -p demo-spanish
189
+ unrender audio separate -p demo-spanish
190
+ unrender shots match -p demo-*
191
+ ```
192
+
193
+ Example `config/demo-spanish.json`:
194
+
195
+ ```json
196
+ {
197
+ "speakers": {
198
+ "JORDAN": { "aliases": [] },
199
+ "ALEX": { "aliases": [] }
200
+ },
201
+ "paths": {
202
+ "run_dir": "runs/demo-spanish",
203
+ "proxy_master": "/path/to/proxy_master.mov",
204
+ "full_audio": "/path/to/full_audio.wav",
205
+ "dx_stem": "/path/to/dialogue_stem.wav",
206
+ "dub_script": "/path/to/dub_script.csv",
207
+ "shots": "config/demo-spanish-shots.csv",
208
+ "separated_stems": "/path/to/stems/*.wav"
209
+ },
210
+ "stem_map": {
211
+ "JORDAN": "/path/to/stems/JORDAN_stem.wav",
212
+ "ALEX": "/path/to/stems/ALEX_stem.wav"
213
+ },
214
+ "audio": {
215
+ "audioshake_variant": "n_speaker",
216
+ "silence_threshold_db": -100,
217
+ "max_gap_sec": 0.5,
218
+ "handle_sec": 0.18,
219
+ "clip_resolver": "cluster",
220
+ "min_margin": 0.05,
221
+ "override_sec": 1.5,
222
+ "override_margin": 0.15,
223
+ "cut_shot_stems": false
224
+ },
225
+ "face": {
226
+ "interval": 2.0,
227
+ "min_confidence": 0.5,
228
+ "min_face_px": 36
229
+ },
230
+ "shots": {
231
+ "samples_per_shot": 8,
232
+ "sim_threshold": 0.45,
233
+ "min_confidence": 0.5,
234
+ "min_votes": 2,
235
+ "min_margin": 0.05
236
+ },
237
+ "voice": {
238
+ "cluster_threshold": 0.35,
239
+ "min_cluster_size": 2
240
+ },
241
+ "timeline": {
242
+ "dialogue": "auto",
243
+ "shot_dx": false,
244
+ "no_markers": false
245
+ }
246
+ }
247
+ ```
248
+
249
+ Every CLI tuning flag can also be set in the matching config section
250
+ (`audio`, `face`, `shots`, `voice`, `voice_clone`, `timeline`); explicit CLI
251
+ flags always win.
252
+
253
+ If `speakers` is omitted and `paths.dub_script` is set, Unrender derives the
254
+ speaker list from the script. CSV, TSV, JSON, XLSX, and DOCX dub scripts are
255
+ supported when the relevant extras are installed.
256
+
257
+ Explicit CLI flags override project config values.
258
+
259
+ ## Main Workflow
260
+
261
+ With a project config:
262
+
263
+ ```bash
264
+ unrender doctor -p demo-spanish
265
+ unrender face build -p demo-spanish
266
+ unrender audio separate -p demo-spanish
267
+ unrender audio transcribe-lines -p demo-spanish
268
+ unrender audio build-clips -p demo-spanish
269
+ unrender voice build -p demo-spanish
270
+ unrender labels interactive -p demo-spanish
271
+ unrender shots match -p demo-spanish
272
+ unrender audio resolve-clips -p demo-spanish
273
+ unrender audio map-dialogue -p demo-spanish
274
+ unrender voice clone -p demo-spanish
275
+ unrender timeline build -p demo-spanish
276
+ unrender export artifacts -p demo-spanish
277
+ unrender status -p demo-spanish
278
+ ```
279
+
280
+ Without a project config:
281
+
282
+ ```bash
283
+ RUN=/tmp/unrender-show
284
+
285
+ unrender face build --video proxy_master.mov --run-dir "$RUN"
286
+ unrender audio separate --full-audio full_audio.wav --run-dir "$RUN"
287
+ unrender audio transcribe-lines --dx-stem dialogue.wav --shots shots.csv --run-dir "$RUN"
288
+ unrender audio build-clips --run-dir "$RUN"
289
+ unrender voice build --run-dir "$RUN"
290
+ unrender labels interactive --run-dir "$RUN" --config speakers.json
291
+ unrender shots match --shots shots.csv --speaker-db "$RUN/speaker_db.json" --run-dir "$RUN"
292
+ unrender audio resolve-clips --speaker-db "$RUN/speaker_db.json" --run-dir "$RUN"
293
+ unrender audio map-dialogue --shots shots.csv --run-dir "$RUN"
294
+ unrender timeline build --shots shots.csv --run-dir "$RUN"
295
+ unrender export artifacts --run-dir "$RUN"
296
+ unrender status --run-dir "$RUN"
297
+ ```
298
+
299
+ The primary deliverable is per-speaker full stems split into labeled,
300
+ speaker-named dialogue-line clips — that is what the timeline carries.
301
+
302
+ ## Optional Per-Shot Outputs
303
+
304
+ Two optional final steps produce per-shot artifacts on top of the primary
305
+ dialogue-line flow:
306
+
307
+ ```bash
308
+ # One DX clip per shot, cut from the full dialogue stem. The DX source is
309
+ # resolved automatically: an explicit --dx-stem, the source-separation
310
+ # output, or (when neither exists) a stem merged from the separated
311
+ # per-speaker stems. Add to the timeline as one track with --shot-dx.
312
+ unrender audio shot-dx -p demo-spanish
313
+ unrender timeline build -p demo-spanish --shot-dx
314
+
315
+ # Per-shot speaker stems: one file per dialogue line overlapping each shot,
316
+ # cut exactly to the shot timecode (2+ files when 2+ lines fall in a shot).
317
+ # Include them in the timeline explicitly with --dialogue shots.
318
+ unrender audio map-dialogue -p demo-spanish --cut-shot-stems
319
+ ```
320
+
321
+ ## Commands
322
+
323
+ ```text
324
+ unrender audio separate Separate full audio/DX into source and speaker stems
325
+ unrender audio transcribe-lines Build dialogue_lines.json from WhisperX or a dub script
326
+ unrender audio build-clips Cut per-line voice clips from full-length speaker stems
327
+ unrender audio resolve-clips Resolve dialogue clips to labeled voices. The default
328
+ cluster resolver groups every line's voice globally and
329
+ jointly assigns clusters to speakers (long, confident
330
+ clips can override); --resolver clip matches each clip
331
+ independently with a similarity threshold and margin
332
+ unrender audio map-dialogue Map resolved dialogue lines onto shots; optionally cut
333
+ shot-timecode-accurate per-line stems (--cut-shot-stems)
334
+ unrender audio shot-dx Cut a per-shot DX stem from the full dialogue stem
335
+ (given, separated, or merged from speaker stems)
336
+
337
+ unrender face build Build face_db.json and face review grids
338
+ unrender voice build Build voice_db.json and voice review samples
339
+ unrender voice match Match arbitrary clips to labeled voices
340
+ unrender voice clone Build voice clone references and optional samples
341
+
342
+ unrender labels template Write labels.csv for manual review
343
+ unrender labels apply Apply labels.csv to speaker_db.json
344
+ unrender labels interactive Prompt through unlabeled face/voice clusters
345
+
346
+ unrender shots match Identify on-screen speakers per shot
347
+ unrender timeline build Reconstruct an OpenTimelineIO timeline (.otio)
348
+ unrender export artifacts Copy final JSON artifacts under exports/
349
+ unrender status Show expected run artifacts
350
+ unrender doctor Validate inputs and local prerequisites
351
+ ```
352
+
353
+ Run `unrender <group> <command> --help` for command-specific flags.
354
+
355
+ ## Run Directory
356
+
357
+ A run directory is the working output area for one project:
358
+
359
+ ```text
360
+ runs/show/
361
+ face_db.json
362
+ voice_db.json
363
+ speaker_db.json
364
+ dialogue_lines.json
365
+ dialogue_lines.csv
366
+ labels.csv
367
+ shot_speaker_matches.json
368
+ shot_speaker_matches.csv
369
+ voice_speaker_matches.json
370
+ clip_stem_plan.json
371
+ dialogue_stem_plan.json
372
+ shot_dialogue_map.json
373
+ shot_stem_plan.json
374
+ timeline.otio
375
+ audio/
376
+ source_stems/
377
+ unmapped_speakers/
378
+ voice_clips/
379
+ dialogue_mapped/
380
+ _unmapped/
381
+ mapped/
382
+ voice_clone_data/
383
+ review/
384
+ face/
385
+ voice/
386
+ voice_clones/
387
+ exports/
388
+ ```
389
+
390
+ Build steps are restartable. Existing artifacts are reused by default; pass
391
+ `--force` when you intentionally want to rebuild a step.
392
+
393
+ ## Timeline Reconstruction
394
+
395
+ The final step reassembles the reconstructed media into an editor timeline using
396
+ [OpenTimelineIO](https://opentimeline.io):
397
+
398
+ ```bash
399
+ ./.venv/bin/python -m pip install -e ".[timeline]"
400
+ unrender timeline build -p demo-spanish
401
+ ```
402
+
403
+ The resulting `timeline.otio` contains:
404
+
405
+ - a video track per shot, placed at each shot's `start_sec`/`end_sec`, marked
406
+ with the matched on-screen speaker(s)
407
+ - one dialogue track per speaker, ordered by speaking time, with line-level
408
+ stems (or per-shot stems) placed at their global time; overlapping lines fan
409
+ out onto additional lanes
410
+ - music (`MX`) and effects (`FX`) tracks from the full-length source stems
411
+ - editorial markers on each dialogue clip showing the speaker and spoken line,
412
+ color-coded: green (matched), orange (off-screen / unresolved), red (missing
413
+ stem)
414
+ - a program start timecode and provenance metadata (Unrender version, run
415
+ directory, fps, dialogue source) on the timeline
416
+
417
+ Clip durations are probed from the real media with `ffprobe` (falling back to
418
+ the stdlib `wave` module for `.wav` stems, then to artifact timing if `ffprobe`
419
+ is unavailable), so each clip carries an accurate `available_range`. Clips
420
+ reference the stem and proxy files on disk; OTIO stores the cut, not the media.
421
+ Lines without a matched stem are kept as placeholders so the editorial
422
+ structure stays intact.
423
+
424
+ Useful flags:
425
+
426
+ - `--dialogue {auto,lines,shots}` — choose the dialogue source granularity
427
+ - `--fps` — edit rate (default 24, or `audio.fps` from the project config)
428
+ - `--start-timecode HH:MM:SS:FF` — set the timeline origin (e.g. `01:00:00:00`)
429
+ - `--dialogue-bed` — add the full-length dialogue source stem as a track
430
+ - `--no-source-stems` / `--no-markers` — drop music/effects tracks or markers
431
+ - `--dry-run` — report the plan without writing
432
+ - `--bundle` — also write a self-contained `.otiod` media bundle
433
+
434
+ `.otio` is written by the built-in adapter. To export other formats (EDL,
435
+ Final Cut Pro XML, AAF), install the adapters and pass a matching `--out`
436
+ suffix:
437
+
438
+ ```bash
439
+ pip install OpenTimelineIO-Plugins
440
+ unrender timeline build -p demo-spanish --out runs/demo-spanish/cut.edl
441
+ ```
442
+
443
+ ## Development
444
+
445
+ Run checks:
446
+
447
+ ```bash
448
+ ./.venv/bin/ruff check .
449
+ ./.venv/bin/black --check .
450
+ ./.venv/bin/pytest -q
451
+ ```
452
+
453
+ Format:
454
+
455
+ ```bash
456
+ ./.venv/bin/black src tests
457
+ ```
458
+
459
+ Type-check:
460
+
461
+ ```bash
462
+ ./.venv/bin/mypy
463
+ ```
464
+
465
+ ## Contributing
466
+
467
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and
468
+ the checks that must pass, and [SECURITY.md](SECURITY.md) for how to report
469
+ vulnerabilities privately.
470
+
471
+ ## License
472
+
473
+ Unrender is licensed under the [Apache License 2.0](LICENSE).
474
+
475
+ Optional, separately installed backends (BandIt/MSST, pyannote.audio, WhisperX,
476
+ InsightFace, and others) are governed by their own licenses and model
477
+ terms. They are not bundled with Unrender; review each project's terms before
478
+ use, especially for commercial work. See [NOTICE](NOTICE) for details.