timecodes ¶
Classes:
-
Keyframes
–Class representing keyframes, or scenechanges.
-
LWIndex
– -
Timecodes
–A list of frame durations, together representing a (possibly variable) frame rate.
FrameDur dataclass
¶
A fraction representing the duration of a specific frame.
Methods:
-
to_fraction
–Convert the FrameDur to a Fraction that represents the frame duration.
Attributes:
-
denominator
(int
) –The frame duration's denominator.
-
frame
(int
) –The frame number.
-
numerator
(int
) –The frame duration's numerator.
Keyframes ¶
Class representing keyframes, or scenechanges.
They follow the convention of signaling the start of the new scene.
Methods:
Attributes:
Source code
371 372 373 374 375 376 |
|
from_clip classmethod
¶
from_clip(
clip: VideoNode,
mode: SceneChangeMode | int = WWXD,
height: int | Literal[False] = 360,
**kwargs: Any
) -> KeyframesBoundT
Source code
401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
from_file classmethod
¶
from_file(file: FilePathType, **kwargs: Any) -> KeyframesBoundT
Source code
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
|
from_param classmethod
¶
from_param(clip: VideoNode, param: KeyframesBoundT | str) -> KeyframesBoundT
Source code
528 529 530 531 532 533 534 535 536 |
|
to_clip ¶
to_clip(
clip: VideoNode,
*,
mode: SceneChangeMode | int = WWXD,
height: int | Literal[False] = 360,
prop_key: str = next(iter(prop_keys)),
scene_idx_prop: bool = False
) -> VideoNode
Source code
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
|
to_file ¶
to_file(
out: FilePathType,
format: int = V1,
func: FuncExceptT | None = None,
header: bool = True,
force: bool = False,
) -> None
Source code
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
|
unique classmethod
¶
unique(clip: VideoNode, key: str, **kwargs: Any) -> KeyframesBoundT
Source code
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
|
LWIndex dataclass
¶
LWIndex(stream_info: StreamInfo, frame_data: list[Frame], keyframes: Keyframes)
Classes:
-
Frame
– -
Regex
– -
StreamInfo
–
Methods:
Attributes:
-
frame_data
(list[Frame]
) – -
keyframes
(Keyframes
) – -
stream_info
(StreamInfo
) –
Frame ¶
Regex ¶
Attributes:
frame_first class-attribute
instance-attribute
¶
frame_first = compile(
"Index=(?P<Index>-?[0-9]+),POS=(?P<POS>-?[0-9]+),PTS=(?P<PTS>-?[0-9]+),DTS=(?P<DTS>-?[0-9]+),EDI=(?P<EDI>-?[0-9]+)"
)
StreamInfo ¶
Bases: NamedTuple
Attributes:
from_file classmethod
¶
from_file(
file: FilePathType,
ref_or_length: int | VideoNode | None = None,
*,
func: FuncExceptT | None = None
) -> LWIndex
Source code
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
Timecodes ¶
A list of frame durations, together representing a (possibly variable) frame rate.
Methods:
-
accumulate_norm_timecodes
– -
assume_vfr
–Force the given clip to be assumed to be vfr by other applications.
-
from_clip
–Get the timecodes from a given clip.
-
from_file
– -
normalize_range_timecodes
–Convert from normalized ranges to a list of frame duration.
-
separate_norm_timecodes
– -
to_file
–Write timecodes to a file.
-
to_fractions
–Convert to a list of frame lengths, representing the individual framerates.
-
to_normalized_ranges
–Convert to a list of normalized frame ranges and their assigned framerate.
Attributes:
-
V1
–V1 timecode format, containing a list of frame ranges with associated frame rates. For example:
-
V2
–V2 timecode format, containing a timestamp for each frame, including possibly a final timestamp after the last frame
V1 class-attribute
instance-attribute
¶
V1 = 1
V1 timecode format, containing a list of frame ranges with associated frame rates. For example:
# timecodes format v1
Assume 23.976023976024
544,548,29.97002997003
721,725,29.97002997003
770,772,17.982017982018
V2 class-attribute
instance-attribute
¶
V2 = 2
V2 timecode format, containing a timestamp for each frame, including possibly a final timestamp after the last frame to specify the final frame's duration. For example:
# timecode format v2
0.000000
41.708333
83.416667
125.125000
166.833333
accumulate_norm_timecodes classmethod
¶
accumulate_norm_timecodes(
timecodes: Timecodes | dict[tuple[int, int], Fraction],
) -> tuple[Fraction, dict[Fraction, list[tuple[int, int]]]]
Source code
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
assume_vfr ¶
assume_vfr(clip: VideoNodeT, func: FuncExceptT | None = None) -> VideoNodeT
Force the given clip to be assumed to be vfr by other applications.
Parameters:
-
clip
¶VideoNodeT
) –Clip to process.
-
func
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Returns:
-
VideoNodeT
–Clip that should always be assumed to be vfr by other applications.
Source code
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
from_clip classmethod
¶
Get the timecodes from a given clip.
Parameters:
-
clip
¶VideoNode
) –Clip to gather metrics from.
-
kwargs
¶Any
, default:{}
) –Keyword arguments to pass on to
clip_async_render
.
Source code
172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
from_file classmethod
¶
from_file(
file: FilePathType, ref: VideoNode, /, *, func: FuncExceptT | None = None
) -> Self
from_file(
file: FilePathType,
ref_or_length: int | VideoNode,
den: int | None = None,
/,
func: FuncExceptT | None = None,
) -> Self
Source code
217 218 219 220 221 222 223 224 225 226 227 228 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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
normalize_range_timecodes classmethod
¶
normalize_range_timecodes(
timecodes: dict[tuple[int | None, int | None], Fraction],
length: int,
assume: Fraction | None = None,
) -> list[Fraction]
Convert from normalized ranges to a list of frame duration.
Source code
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
separate_norm_timecodes classmethod
¶
separate_norm_timecodes(
timecodes: Timecodes | dict[tuple[int, int], Fraction],
) -> tuple[Fraction, dict[tuple[int, int], Fraction]]
Source code
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
to_file ¶
Write timecodes to a file.
This file should always be muxed into the video container when working with Variable Frame Rate video.
Parameters:
-
out
¶FilePathType
) –Path to write the file to.
-
format
¶int
, default:V2
) –Format to write the file to.
Source code
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
to_fractions ¶
Convert to a list of frame lengths, representing the individual framerates.
Source code
90 91 92 93 |
|
to_normalized_ranges ¶
Convert to a list of normalized frame ranges and their assigned framerate.
Source code
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|