Sequence Replacement
Utilities for replacing detected source frame sequences with reviewed MP4 files.
The public CLI commands are documented in the Usage Guide:
renderkit replace-sequence-with-mp4renderkit batch-replace
Use this API reference when integrating the same audit and verification behavior into pipeline tools.
renderkit.core.sequence_replacement
Safe replacement of frame sequences with verified MP4 files.
SequenceReplacementResult
dataclass
Result of a sequence replacement operation.
Source code in src/renderkit/core/sequence_replacement.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
to_audit_record()
Return a JSON-serializable audit record.
Source code in src/renderkit/core/sequence_replacement.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
find_exr_sequences(root)
Find EXR sequence patterns below a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Directory to scan recursively. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Detected sequence patterns sorted by path. |
Source code in src/renderkit/core/sequence_replacement.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
find_replacement_mp4(sequence_pattern, mp4_dir, root=None)
Return the expected MP4 replacement path for a sequence pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence_pattern
|
str
|
Detected sequence pattern. |
required |
mp4_dir
|
Path
|
Directory containing replacement MP4s. |
required |
root
|
Optional[Path]
|
Optional scan root used to match batch-convert's nested output names. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Expected MP4 path. |
Source code in src/renderkit/core/sequence_replacement.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
replace_sequence_with_mp4(input_pattern, output_mp4, *, delete_source=False, verify=False, dry_run=False, audit_report=None, verifier=verify_mp4_readable)
Replace one detected frame sequence with an MP4 and write an audit record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_pattern
|
str
|
Sequence pattern such as |
required |
output_mp4
|
Path
|
MP4 file to copy into the source sequence directory. |
required |
delete_source
|
bool
|
Whether to delete the source frame files after replacement. |
False
|
verify
|
bool
|
Whether to verify the MP4 with FFprobe before proceeding. |
False
|
dry_run
|
bool
|
Whether to only report planned actions. |
False
|
audit_report
|
Optional[Path]
|
Optional JSONL audit path. |
None
|
verifier
|
Mp4Verifier
|
Verification callback used by tests. |
verify_mp4_readable
|
Returns:
| Type | Description |
|---|---|
SequenceReplacementResult
|
Result describing the replacement. |
Raises:
| Type | Description |
|---|---|
SequenceReplacementError
|
If verification, copy, or deletion cannot proceed safely. |
Source code in src/renderkit/core/sequence_replacement.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
verify_mp4_readable(mp4_path)
Verify that an MP4 exists and can be read by FFprobe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mp4_path
|
Path
|
MP4 file to verify. |
required |
Raises:
| Type | Description |
|---|---|
SequenceReplacementError
|
If the MP4 does not exist or FFprobe cannot read it. |
Source code in src/renderkit/core/sequence_replacement.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |