Export API¶
Exporters turn synchronized experiment inputs and derived results into formats for viewing or use in other analysis tools. They read the experiment without changing it.
Synchronized Combined Video¶
body_eye_sync.export.video_grid
¶
Render a synchronized grid video from an experiment's recordings.
VideoGridCancelled
¶
Bases: VideoGridError
Construction was cancelled through its progress callback.
VideoGridError
¶
VideoGridResult
dataclass
¶
A synchronized grid video and its interval on the experiment clock.
Source code in src/body_eye_sync/export/video_grid.py
construct_video_grid(experiment, output_path, *, layout=LayoutKind.grid, video_ids=None, cell_size=(640, 360), show_labels=True, input_ids=None, include_merged_audio=False, overwrite=False, progress=None)
¶
Write selected experiment videos as one synchronized 25 fps video.
The output interval is the union of all selected media on the experiment
clock. input_ids defaults to every experiment input. Every selected
input that carries audio contributes a separately selectable, full-duration
audio track named after its input id; selected audio-only inputs contribute
a track but no picture. include_merged_audio appends a track mixing all
of those synchronized source tracks. Before and after a recording, and
wherever it lost content, its slot shows whatever is behind it -- black, or
the video it overlaps -- and its audio track is silent.
layout arranges the pictures: the grid holds every selected video, while
"2+1" shows two videos over a third and "4+1" shows one central video
with a video lapping over each of its corners. Those two leave any slot they
are not given a video for empty.
video_ids says which video fills each slot of that layout, in
drawing order, with None for a slot left empty; it defaults to the
selected videos in experiment order.
progress receives fractions between zero and one. Returning False
cancels construction and leaves no partial output behind.
Source code in src/body_eye_sync/export/video_grid.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 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 642 643 644 645 646 647 | |
Video Layouts¶
body_eye_sync.export.layout
¶
Where each video sits in the frame of a combined video.
LayoutFrame
dataclass
¶
A combined video frame, and the rectangle of each of its slots.
The slots are in drawing order: a later one is drawn over an earlier one.
Source code in src/body_eye_sync/export/layout.py
LayoutKind
¶
Placement
dataclass
¶
layout_frame(kind, slots, cell_size=DEFAULT_CELL_SIZE)
¶
The output frame and slot rectangles of one layout.
cell_size is the size of one grid cell, and sets the scale of the whole
frame.
Source code in src/body_eye_sync/export/layout.py
slot_count(kind, videos)
¶
How many videos this layout shows, given how many are available.
The grid grows to hold every video; the other layouts have a fixed number of slots, which may be left empty.
Source code in src/body_eye_sync/export/layout.py
ELAN Annotations¶
body_eye_sync.export.elan
¶
Write the experiment's speech turns and words as an ELAN annotation file.
Each speaker gets a turn tier and a dependent more fine-grained word tier named
<speaker> [words].
export_elan(experiment, video, *, overwrite=False, author='body-eye-sync')
¶
Write the experiment's speech turns and words beside the synchronized video.