Skip to content

feat(recording): Recording dynamic video - #24483

Merged
antobinary merged 9 commits into
bigbluebutton:v3.0.x-releasefrom
kepstin:recording-dynamic-video
Jan 22, 2026
Merged

antobinary merged 9 commits into
bigbluebutton:v3.0.x-releasefrom
kepstin:recording-dynamic-video

Conversation

@kepstin

@kepstin kepstin commented Jan 16, 2026 •

Copy link
Copy Markdown
Contributor

The current video recording format supports multiple layouts depending on the media shared in the recording, but the layout has to be selected before processing the recording and a single layout is used for the entire recording length.

This causes problems with, for example, meetings that use deskshare and webcams, but do not use presentation. Either the webcams are fullscreen when deskshare isn't being used but the deskshare covers up the webcams, or the webcams are beside the deskshare but remain small and at the side of the recording.

The new system uses similar layouts (with backwards compatibility for the old layout formats) but instead of selecting the layout once before generating the video, it selects the layout separately for each individual cut of the video. This allows, for example, webcams to be fullscreen when deskshare isn't used, but when deskshare starts the webcams will become smaller and move to the side.

Support for handling changes to the layout in the live meeting is added, using "conditions" that allow a specific video arrangement to be matched. Support has been added for "screenshare as content" (allowing the screenshare to be hidden - and presentation to be visible - without needing to stop screenshare) and "presentation is open" (whether the main content area containing presentation or screenshare is being shown).

As part of this work, to allow the presentation video to change size as the layout changes between cuts, the handling for video sources was refactored to be generic, allowing a new video source to be made for presentation video which generates presentation video on demand for each cut. This also speeds up recording processing and reduces disk space
requirements by removing the separate step to generate the presentation video before rendering the recording. This requires bbb-presentation-video to be updated to 5.1.0-beta.1 or later.

Fixes #23337

The current video recording format supports multiple layouts depending
on the media shared in the recording, but the layout has to be selected
before processing the recording and a single layout is used for the
entire recording length.

This causes problems with, for example, meetings that use deskshare and
webcams, but do not use presentation. Either the webcams are fullscreen
when deskshare isn't being used but the deskshare covers up the webcams,
or the webcams are beside the deskshare but remain small and at the side
of the recording.

The new system uses the same layouts but instead of selecting the
layout once before generating the video, it selects the layout
separately for each individual cut of the video. This allows, for
example, webcams to be fullscreen when deskshare isn't used, but when
deskshare starts the webcams will become smaller and move to the side.

As part of this work, to allow the presentation video to change size
as the layout changes between cuts, the handling for video sources was
refactored to be generic, allowing a new video source to be made for
presentation video which generates presentation video on demand for each
cut. This also speeds up recording processing and reduces disk space
requirements by removing the separate step to generate the presentation
video before rendering the recording.
With the new system for selecting the layout separately for each cut
depending on which type of content is present, it is also possible to
make the layout selection depend on other things relating to the current
state of the meeting.

The EDL and layout data structures are updated to support "conditions".
When the EDL is generated, various conditions can be included which
identify things about the state of the session at that time. Then, when
selecting a layout, the layout is only used if the conditions specified
in the layout match the conditions in the session.

Two conditions are added initially:

* `presentation_used`: Indicates whether any actions have been done on
  the presentation/whiteboard area.
* `screenshare_as_content`: Indicates the current state of the
  presentation/screenshare swap feature.

The video recording format's code is simplified since it no longer needs
to detect whether the presentation area was used itself; it can rely on
the conditions to handle this instead. The default configuration file
has been updated with layouts which handle the two new conditions.
To make it easier to handle layout events, which usually deal with the
"content" area rather than specifically presentation or screenshare,
refactor the generator methods to create the EDL with layout-related
conditions in a separate method.
@coderabbitai

coderabbitai Bot commented Jan 16, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds a video source abstraction (VideoSource, PresentationVideoSource, VideoSourceReader), EDL merging, per‑cut layout selection, and refactors rendering to use video sources (filtering corrupt sources). It introduces new EDL generators (deskshare, presentation, layout), merges EDLs, supports per‑cut layouts during composition, and adds parallel workers configuration. Additionally, a minor correctness fix replaces File.exists? with File.exist? in error handling during ffmpeg failures.

Sequence Diagram(s)

sequenceDiagram
    participant Renderer as Video.render()
    participant Merger as EDL.merge()
    participant Selector as select_layout_for_cut()
    participant Source as VideoSource/PresentationVideoSource
    participant Reader as VideoSourceReader
    participant FFmpeg as ffmpeg

    Renderer->>Merger: merge webcam, deskshare, presentation, layout EDLs
    Merger-->>Renderer: merged EDL with conditions

    Renderer->>Renderer: iterate cuts
    loop per cut
        Renderer->>Selector: choose layout using cut conditions & media presence
        Selector-->>Renderer: chosen layout

        Renderer->>Source: open(width,height,seek,duration,framerate,name)
        alt source corrupt or unseekable
            Source-->>Reader: return blank/white reader
        else valid source
            Source->>FFmpeg: spawn preprocessing process / ffmpeg pipeline
            FFmpeg-->>Source: stream data via pipe
            Source-->>Reader: VideoSourceReader (pid, read, ffmpeg_input/filter, log)
        end

        Renderer->>FFmpeg: composite cut using Reader inputs & selected layout
    end
    Renderer-->>FFmpeg: finalize output
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 81.25% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description comprehensively explains the changes, including the motivation (dynamic layout selection per cut), implementation details (conditions, video sources), and backwards compatibility considerations.
Title check ✅ Passed The title 'Recording dynamic video' is partially related to the changeset, referring to a real aspect of the change (dynamic video handling and per-cut layout selection), but oversimplifies the main innovations: per-cut layout selection via conditions, video source refactoring, and on-demand presentation video generation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@record-and-playback/core/lib/recordandplayback/generators/events.rb`:
- Around line 463-468: The comment in create_deskshare_edl is misleading because
the :screenshare_as_content condition is applied in create_layout_edl, not here;
either update the docstring in create_deskshare_edl to state that the
screenshare condition is set by create_layout_edl (and reference
SetScreenshareAsContentEvent in events.xml), or implement the condition here by
reading SetScreenshareAsContentEvent from events.xml and setting
:screenshare_as_content on the deskshare EDL; locate the relevant logic around
create_deskshare_edl and create_layout_edl and choose one consistent approach to
avoid the mismatch.

In `@record-and-playback/presentation/scripts/publish/presentation.rb`:
- Around line 50-54: The nil-aspect fallback in scale_to_deskshare_video
currently sets both deskshare_video_height and deskshare_video_width from
['deskshare_output_height'] and returns [deskshare_video_height,
deskshare_video_width], forcing a square dimension; update the initialization to
read both `@presentation_props`['deskshare_output_width'].to_f and
`@presentation_props`['deskshare_output_height'].to_f into deskshare_video_width
and deskshare_video_height respectively, and when width or height is nil return
the pair [deskshare_video_width, deskshare_video_height] so the configured
width/height are preserved; refer to the function name scale_to_deskshare_video
and the `@presentation_props` keys deskshare_output_width and
deskshare_output_height to locate the change.

In `@record-and-playback/video/scripts/process/video.rb`:
- Around line 112-170: The code fails when legacy layouts have areas as a Hash
because later code expects an Array of area Hashes; update the normalization
step (around variables layout, preset['layouts'], and specific_layout
processing) to detect when area collections are a Hash and convert them into an
Array of hashes like { 'name' => key, 'videos' => value } (or preserve the
existing value shape) before calling symbolize_keys! and converting names to
symbols; ensure the same normalization is applied for the legacy conversions
that use select/reject (e.g., when building layout from webcam_layout,
presentation_layout, deskshare_webcam_layout) so specific_layout[:areas] and
layout[:areas] are always Arrays of Hashes with a name field prior to
symbolization.
🧹 Nitpick comments (1)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)

375-379: Consider using format for consistency with Ruby style conventions.

The current format string works correctly. If you want to address the static analysis hints, you could refactor to:

♻️ Optional style improvement
 def self.ms_to_s(timestamp)
   s = timestamp / 1000
   ms = timestamp % 1000
-  "%d.%03d" % [s, ms]
+  format('%<s>d.%<ms>03d', s: s, ms: ms)
 end
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60ef3c1 and a461dcb.

📒 Files selected for processing (11)
  • record-and-playback/core/lib/recordandplayback/edl.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb
  • record-and-playback/core/lib/recordandplayback/generators/events.rb
  • record-and-playback/core/scripts/bigbluebutton.yml
  • record-and-playback/docs/edl/video_source.md
  • record-and-playback/presentation/scripts/publish/presentation.rb
  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/video/scripts/video.yml
🧰 Additional context used
🧠 Learnings (8)
📚 Learning: 2025-09-11T20:24:01.217Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.217Z
Learning: In BigBlueButton's video recording processing pipeline, format hashes loaded from YAML configuration are converted to use symbol keys via format.symbolize_keys! in the process/video.rb script before being passed to templates, so templates should access format data using symbol keys like format[:extension] and format[:mimetype] rather than string keys.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.217Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.217Z
Learning: In BigBlueButton's video recording processing pipeline, YAML configuration data (including format hashes) has its keys converted to symbols using deep_symbolize_keys! in the process/video.rb script, so templates should access format data using symbol keys like format[:extension] and format[:mimetype] rather than string keys.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/video/scripts/video.yml
  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on the <metadata> element (e.g., <metadata bbb-recording-video-preset="720p" meetingName="Demo Meeting"/>). When using Nokogiri to parse events.xml in Ruby, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups like metadata.at_xpath('element-name').

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on <meta> elements under the <metadata> section, not as child elements. When using Nokogiri to parse events.xml, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-10-15T17:57:46.195Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/ja.json:723-727
Timestamp: 2025-10-15T17:57:46.195Z
Learning: In the bigbluebutton repository, locale files (e.g., public/locales/*.json) are managed through Transifex and should not be edited directly in pull requests. Translation corrections and updates should be made in Transifex, which then syncs to the repository.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on the <metadata> element (e.g., <metadata bbb-recording-video-preset="720p" meetingName="Demo"/>). When using Nokogiri to parse events.xml, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:21:06.847Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.847Z
Learning: In BigBlueButton's events.xml file, metadata is stored as attributes on the metadata element (e.g., `<metadata meetingName="Demo Meeting" isBreakout="false"/>`), not as child elements. The metadata element is accessed via `events.at_xpath('/recording/metadata')` and attributes are accessed using bracket notation like `metadata['meetingName']`.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
🧬 Code graph analysis (6)
record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (2)
  • initialize (10-91)
  • initialize (11-14)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (3)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (4)
  • initialize (15-48)
  • aspect_ratio (53-55)
  • corrupt? (60-63)
  • open (74-182)
record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)
  • initialize (18-28)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • ms_to_s (375-379)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (3)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (5)
  • initialize (10-91)
  • initialize (11-14)
  • corrupt? (26-28)
  • aspect_ratio (19-21)
  • open (38-90)
record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)
  • initialize (18-28)
record-and-playback/core/lib/recordandplayback/edl/video.rb (2)
  • ms_to_s (375-379)
  • aspect_scale (381-390)
record-and-playback/core/lib/recordandplayback/generators/events.rb (1)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (73-193)
record-and-playback/core/lib/recordandplayback/edl/video.rb (2)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (3)
  • corrupt? (26-28)
  • aspect_ratio (19-21)
  • open (38-90)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (3)
  • corrupt? (60-63)
  • aspect_ratio (53-55)
  • open (74-182)
record-and-playback/video/scripts/process/video.rb (2)
record-and-playback/core/lib/recordandplayback/generators/events.rb (4)
  • create_webcam_edl (168-390)
  • create_deskshare_edl (473-546)
  • create_presentation_edl (560-631)
  • create_layout_edl (648-706)
record-and-playback/core/lib/recordandplayback/edl/video.rb (2)
  • dump (44-63)
  • merge (73-193)
🪛 Brakeman (7.1.1)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb

[medium] 67-67: Possible command injection
Type: Command Injection
Confidence: Medium
More info: https://brakemanscanner.org/docs/warning_types/command_injection/

(Command Injection)

record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb

[medium] 147-147: Possible command injection
Type: Command Injection
Confidence: Medium
More info: https://brakemanscanner.org/docs/warning_types/command_injection/

(Command Injection)

🪛 LanguageTool
record-and-playback/docs/edl/video_source.md

[style] ~23-~23: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ould remove corrupt videos from the EDL prior to rendering. ### open(width, height, see...

(EN_WORDINESS_PREMIUM_PRIOR_TO)


[style] ~27-~27: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...rs which should be applied to the video prior to it being used. The video source is req...

(EN_WORDINESS_PREMIUM_PRIOR_TO)

🪛 RuboCop (1.82.1)
record-and-playback/core/lib/recordandplayback/edl/video.rb

[convention] 378-378: Prefer single-quoted strings when you don't need string interpolation or special symbols.

(Style/StringLiterals)


[convention] 378-378: Prefer annotated tokens (like %<foo>s) over unannotated tokens (like %s).

(Style/FormatStringToken)


[convention] 378-378: Prefer annotated tokens (like %<foo>s) over unannotated tokens (like %s).

(Style/FormatStringToken)


[convention] 378-378: Favor format over String#%.

(Style/FormatString)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-etherpad)
🔇 Additional comments (35)
record-and-playback/core/lib/recordandplayback/edl.rb (1)

49-52: Good switch to File.exist?.

Keeps behavior while avoiding the deprecated alias.

record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)

6-28: Clean, minimal reader with a clear contract.

The guard preventing a nil-only instance keeps callers honest.

record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (8)

10-48: Initialization and remediation flow looks solid.

Metadata capture, corruption detection, and remux fallback are well ordered.


50-63: Simple metadata accessors are clear.


65-174: Verify the seek offset isn't applied twice.

seek is incremented by seek_offset, and in_time then adds seek_offset again. For non‑zero start times this can shift the cut start. If that’s unintended, align in_time with the adjusted seek (or explicitly use video_start_offset if that’s the intended correction).

Possible fix if the double-offset is unintended
-          seek += seek_offset
-          in_time = seek + seek_offset
+          seek += seek_offset
+          in_time = seek

186-193: Seekability predicate is straightforward.


195-240: Good defensive validation before trusting metadata.


242-278: Memoized bug detection reads well.


280-290: Lightweight decode probe is fine.


292-316: Remux fallback and rollback are clean.

record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (2)

11-28: Presentation source interface is tidy.

Constructor and accessors are minimal and clear.


38-89: Pipe setup and reader handoff are clean.

record-and-playback/core/scripts/bigbluebutton.yml (1)

46-49: Config knob is well documented.

record-and-playback/presentation/scripts/publish/presentation.rb (1)

1155-1166: VideoSource integration looks solid.

Line 1155-1166: corruption guard + aspect-ratio scaling align nicely with the new abstraction.

record-and-playback/docs/edl/video_source.md (1)

1-33: Clear, actionable interface documentation.

Line 1-33: the required methods and invariants are well stated.

record-and-playback/video/scripts/video.yml (3)

51-77: Nice clarification of conditional layout semantics.

Line 51-77: the new conditions explanation makes layout behavior easier to reason about.


83-134: 1080p conditional layouts look consistent.

Line 83-134: the new branching layouts cover the key presentation/webcam/deskshare cases cleanly.


176-241: 720p layout variants align with the 1080p logic.

Line 176-241: the scenarios and ordering mirror the 1080p preset in a clear way.

record-and-playback/core/lib/recordandplayback/generators/events.rb (4)

477-545: Deskshare EDL construction aligns with the new format.

Line 477-545: offsetting, original_duration propagation, and terminating entry handling look consistent.


560-631: Presentation usage tracking is clean and minimal.

Line 560-631: the conditional flip on first meaningful interaction is a good, low-noise signal.


633-705: Layout EDL conditions are clearly modeled.

Line 633-705: default state + delta updates are straightforward and easy to follow.


738-755: Conditions now propagate correctly through video EDL offsets.

Line 738-755: including conditions in offset/empty entries keeps merged EDLs consistent.

record-and-playback/video/scripts/process/video.rb (2)

182-190: Presentation + layout EDL merge looks good.

Line 182-190: integrating the new EDLs into the merged timeline is straightforward.


235-241: Render call update is clean.

Line 235-241: passing workers and conditional layouts fits the new render signature.

record-and-playback/core/lib/recordandplayback/edl/video.rb (11)

1-1: LGTM!

The frozen_string_literal pragma is a good addition for performance, and the new require statements properly import the VideoSource abstractions needed for this refactor.

Also applies to: 24-27


56-61: LGTM!

The conditions logging is properly guarded with nil-safe navigation and follows the existing logging style in the dump method.


65-72: LGTM!

Good documentation clarifying that conflicting conditions at the same timestamp result in undefined behavior. This is an appropriate design decision that pushes responsibility to the EDL generators.


140-154: LGTM!

The conditions handling is well implemented:

  • Using dup on line 153 correctly prevents mutation of previous entries
  • The refactored structure cleanly separates entry creation from video/condition updates

266-289: LGTM!

The video source handling logic is well-structured:

  • Pre-supplied sources from EDL are respected (line 266-269)
  • Caching by filename prevents redundant VideoSource creation
  • Corrupt video detection properly adds filenames to corrupt_videos set for later removal

The design correctly caches even corrupt VideoSource objects, ensuring consistent corruption detection across all references to the same file.


404-441: LGTM!

The layout selection logic is well-designed:

  • Media presence detection using Set operations (superset/subset) is clear and efficient
  • The condition matching with all? ensures all specified conditions must match
  • Debug logging via blocks avoids string interpolation cost when debug is disabled

451-459: Good validation of layout constraints.

The dimension and framerate validation (lines 451-455) is critical for ensuring the FFmpeg filter chain remains consistent across cuts. The required properties check (lines 457-459) provides a clear error for misconfigured layouts.


526-528: LGTM!

The nil-safe navigation for aspect_ratio is necessary here since PresentationVideoSource.aspect_ratio returns nil, allowing aspect_scale to handle the nil case gracefully.


586-594: LGTM!

Good handling of the VideoSourceReader contract where at least one of ffmpeg_input or ffmpeg_filter must be provided. The null filter correctly passes through the input when no custom filter is needed.


668-674: LGTM!

The exit status handling correctly accounts for multiple valid termination scenarios:

  • Normal success
  • FFmpeg exit code 255 (user-requested termination)
  • SIGTERM (term signal 15) for processes like bbb-presentation-video

381-383: LGTM!

Good defensive handling for nil aspect ratios. When the source video aspect ratio is unknown (e.g., PresentationVideoSource), falling back to the target dimensions is the correct behavior.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +112 to +170
# For backwards compatibility with older video.yml files, convert named layouts to constraint-based layouts
preset['layouts'] ||= []
# Layout with only webcams
if preset.include?('webcam_layout') || preset.include?('nopresentation_layout')
layout = preset['webcam_layout'] || preset['nopresentation_layout']
layout['name'] = 'webcam_layout'
if layout['areas'].include?('webcam')
layout['required'] = ['webcam']
layout['areas'] = layout['areas'].select { |name, _videos| name == 'webcam' }
preset['layouts'] << layout
end
end

if specific_layout.nil?
logger.debug('No constraint-based layouts matched')

# Try some named layouts for backwards compatibility
specific_layout_name = \
if have_webcams && !(have_presentation || have_deskshare)
# Layout with only webcams, no presentation or deskshare area
# Equivalent to required: [webcam], supported: [webcam]
if preset.include?('webcam_layout')
'webcam_layout'
else
'nopresentation_layout'
end
elsif have_webcams && have_presentation
# Layout with webcams, presentation, optional deskshare
# Equivalent to required: [webcam, presentation], supported: [webcam, presentation, deskshare]
'presentation_webcam_layout'
elsif have_webcams && have_deskshare
# Layout with webcams and deskshare, no presentation
# Equivalent to required: [webcam, deskshare], supported: [webcam, deskshare]
'deskshare_webcam_layout'
elsif !have_webcams
# Layout with only presentation area and/or deskshare (no webcams)
# Equivalent to required: [], supported: [presentation, deskshare]
if preset.include?('presentation_layout')
'presentation_layout'
else
'nowebcam_layout'
end
end
unless specific_layout_name.nil?
specific_layout = preset[specific_layout_name]
if specific_layout
logger.info("Using named layout #{specific_layout_name}")
layout_name = specific_layout_name
else
logger.debug("Named layout #{specific_layout_name} is not available")
end
# Layout with webcams & presentation, optional deskshare
if preset.include?('presentation_webcam_layout')
layout = preset['presentation_webcam_layout']
layout['name'] = 'presentation_webcam_layout'
if layout['areas'].include?('presentation') && layout['areas'].include?('webcam')
layout['required'] = %w[webcam presentation]
preset['layouts'] << layout
end
end

layout.merge!(specific_layout) unless specific_layout.nil?

# Sanity check on the loaded layout
unless layout.include?('width') && layout.include?('height') && layout.include?('framerate') && layout.include?('areas')
logger.error("Preset #{preset_name} layout #{layout_name} is missing required properties in configuration")
exit(1)
# Layout with webcams and deskshare, no presentation
if preset.include?('deskshare_webcam_layout')
layout = preset['deskshare_webcam_layout']
layout['name'] = 'deskshare_webcam_layout'
if layout['areas'].include?('deskshare') && layout['areas'].include?('webcam')
layout['required'] = %w[webcam deskshare]
layout['areas'] = layout['areas'].select { |name, _videos| layout['required'].include?(name) }
preset['layouts'] << layout
end
end

logger.debug("Selected layout: #{layout_name}")
logger.debug(" size: #{layout['width']}x#{layout['height']}, framerate: #{layout['framerate']}")
logger.debug(' Video areas:')
layout['areas'].each do |area|
logger.debug(" #{area['name']}: position: #{area['x']}x#{area['y']}, size: #{area['width']}x#{area['height']}")
# Layout with only presentation area and/or deskshare (no webcams)
if preset.include?('presentation_layout') || preset.include?('nowebcam_layout')
layout = preset['presentation_layout'] || preset['nowebcam_layout']
layout['name'] = 'presentation_layout'
if layout['areas'].include?('presentation') || layout['areas'].include?('deskshare')
layout['required'] = []
layout['areas'] = layout['areas'].reject { |name, _videos| name == 'webcam' }
preset['layouts'] << layout
end
end

# Ensure the presentation video is not generated unless there is a presentation area in the selected layout
have_presentation = false unless layout['areas'].any? { |area| area['name'] == 'presentation' }
# Convert the layout to have symbol keys and area names, as required by the EDL render method
layout = preset.fetch('layout', {})

layout.symbolize_keys!
layout[:areas].each do |area|
area.symbolize_keys!
area[:name] = area[:name].to_sym
end
preset['layouts'].each do |specific_layout|
specific_layout.symbolize_keys!
specific_layout[:required]&.map!(&:to_sym)
specific_layout[:areas].each do |area|
area.symbolize_keys!
area[:name] = area[:name].to_sym
end
specific_layout[:conditions]&.symbolize_keys!
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find the video.yml configuration files to see the legacy layout format
find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "webcam_layout\|presentation_layout" 2>/dev/null | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

# Look for the actual video.rb file to examine the full context
fd -t f "video.rb" --path "*/process/*"

Repository: bigbluebutton/bigbluebutton

Length of output: 304


🏁 Script executed:

# Search for legacy layout definitions in config files
rg -n "webcam_layout|presentation_webcam_layout|deskshare_webcam_layout|presentation_layout|nopresentation_layout" -A 5 --max-count=20

Repository: bigbluebutton/bigbluebutton

Length of output: 3366


🏁 Script executed:

# Check the broader context of the video.rb file around the flagged section
fd -t f "video.rb" --path "*/process/*" --exec wc -l {} \;

Repository: bigbluebutton/bigbluebutton

Length of output: 304


🏁 Script executed:

# Read the video.rb file to see the full context and understand the conversion logic
cat -n record-and-playback/video/scripts/process/video.rb | sed -n '110,175p'

Repository: bigbluebutton/bigbluebutton

Length of output: 3129


🏁 Script executed:

# Find example video.yml or configuration files
find . -name "video.yml" -o -name "*video*.yml" | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 116


🏁 Script executed:

# Look for area definitions in config files to understand the legacy format
rg -n "areas" --type yaml -B 2 -A 2 | head -100

Repository: bigbluebutton/bigbluebutton

Length of output: 8544


🏁 Script executed:

# Check git history to understand when this code was added and what the original format was
git log --oneline --all -- record-and-playback/video/scripts/process/video.rb | head -5

Repository: bigbluebutton/bigbluebutton

Length of output: 349


🏁 Script executed:

# Check the actual legacy layout format by looking for any "webcam_layout", "presentation_layout" etc. keys in config or code
rg -n "webcam_layout|presentation_layout|nopresentation_layout" -B 5 -A 10 --max-count=30

Repository: bigbluebutton/bigbluebutton

Length of output: 4668


🏁 Script executed:

# Look at the git diff or commit for this specific code to see what format was expected
git show a461dcb9dd:record-and-playback/video/scripts/process/video.rb | grep -A 50 "webcam_layout" | head -80

Repository: bigbluebutton/bigbluebutton

Length of output: 3202


🏁 Script executed:

# Trace how the areas are actually stored in the loaded presets to understand the legacy format
rg -n "areas.*Hash|areas.*Array" record-and-playback/video/scripts/process/video.rb

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

# Check what the YAML loading process does - see if legacy layouts use hash or array for areas
head -200 record-and-playback/video/scripts/process/video.rb | tail -100

Repository: bigbluebutton/bigbluebutton

Length of output: 3988


🏁 Script executed:

# Check if there are any old video.yml files or documentation showing the legacy layout format
find . -name "*.md" -o -name "*.rst" | xargs grep -l "webcam_layout\|presentation_layout" 2>/dev/null

Repository: bigbluebutton/bigbluebutton

Length of output: 55


🏁 Script executed:

# Look for any test files that might show the legacy format
find . -path "*/test*" -name "*.rb" -o -name "*.yml" | xargs grep -l "webcam_layout\|presentation_layout" 2>/dev/null | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

# Check the git history to see what the old format looked like
git log --all --oneline --grep="video.yml\|layout" record-and-playback/video/scripts/process/video.rb | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 290


🏁 Script executed:

# Search for any documentation or comments about the legacy layout format
rg -n "legacy.*layout|old.*layout|backwards.*compat" record-and-playback/video/scripts/process/video.rb -B 2 -A 2

Repository: bigbluebutton/bigbluebutton

Length of output: 569


🏁 Script executed:

# Look at the EDL class to understand what format it expects for areas
find . -name "*.rb" -path "*/edl*" -o -name "*edl*.rb" | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 563


🏁 Script executed:

# Check the EDL Video class to see how it uses areas
head -150 record-and-playback/core/lib/recordandplayback/edl/video.rb

Repository: bigbluebutton/bigbluebutton

Length of output: 6252


🏁 Script executed:

# Look for how areas are iterated/used in the EDL code
rg -n "areas" record-and-playback/core/lib/recordandplayback/edl/video.rb -B 2 -A 2

Repository: bigbluebutton/bigbluebutton

Length of output: 7381


🏁 Script executed:

# Check if there's any explicit check for Array vs Hash in the areas handling
rg -n "\.each|is_a?\(Array\)|is_a?\(Hash\)" record-and-playback/core/lib/recordandplayback/edl/video.rb | head -30

Repository: bigbluebutton/bigbluebutton

Length of output: 1506


🏁 Script executed:

# Let's look at the git history of the legacy conversion code to see what the original format was
git show 678589dbfb -- record-and-playback/video/scripts/process/video.rb | head -200

Repository: bigbluebutton/bigbluebutton

Length of output: 8650


🏁 Script executed:

# Now let's trace through what the legacy layout conversion actually produces
# Let's look at the render method that's called with the layouts to understand expected format
rg -n "render.*layout\|template.*layout" record-and-playback/video/scripts/process/video.rb -B 3 -A 3

Repository: bigbluebutton/bigbluebutton

Length of output: 53


🏁 Script executed:

# Check the templates to see how they access the format and layout data
find . -name "*.erb" -path "*/video/*" | head -10

Repository: bigbluebutton/bigbluebutton

Length of output: 128


🏁 Script executed:

# Look at how the layout is actually used after the symbolization
rg -n "layout\[:areas\]" record-and-playback -A 3 | head -50

Repository: bigbluebutton/bigbluebutton

Length of output: 2465


🏁 Script executed:

# Verify what the legacy layout areas format actually is by looking at a full trace
cat -n record-and-playback/video/scripts/process/video.rb | sed -n '115,170p'

Repository: bigbluebutton/bigbluebutton

Length of output: 2709


🏁 Script executed:

# Let me trace through the exact data transformation
# First, understand the legacy format by checking old video.yml
git show 678589dbfb:record-and-playback/video/scripts/video.yml | head -150

Repository: bigbluebutton/bigbluebutton

Length of output: 157


🏁 Script executed:

# Check if there's documentation about legacy layout format
rg -n "legacy\|old.*format\|backwards" record-and-playback/video/scripts/video.yml -B 3 -A 5

Repository: bigbluebutton/bigbluebutton

Length of output: 157


🏁 Script executed:

# Let's trace what happens with a Hash when select is called
python3 << 'EOF'
# Simulate Ruby Hash.select behavior
test_hash = {'presentation': {'x': 0}, 'webcam': {'x': 1600}}

# Hash.select with block returns a new Hash
result = {k: v for k, v in test_hash.items() if k == 'webcam'}
print(f"Hash.select result: {result}")
print(f"Type: {type(result)}")

# When .each is called on a Hash, it yields [key, value] pairs
# In Ruby: hash.each { |area| ... } would give area as [key, value] pair
for area in result.items():
    print(f"Area from .each: {area}, type: {type(area)}")
    # Trying to call area.symbolize_keys! on a tuple/list would fail
    try:
        area.keys()  # Arrays/tuples don't have .keys() method
    except AttributeError as e:
        print(f"Error: {e}")
EOF

Repository: bigbluebutton/bigbluebutton

Length of output: 157


🏁 Script executed:

# Look for any actual old video.yml files or test data that show legacy format
find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "presentation_layout\|webcam_layout" 2>/dev/null

Repository: bigbluebutton/bigbluebutton

Length of output: 157


🏁 Script executed:

# Check the exact error that would occur
python3 << 'EOF'
# In Ruby, when Hash#select is called with a block, it returns a Hash
# But when iterating with .each on that Hash, it yields [key, value] pairs

# Simulate what happens:
legacy_areas = {
    'presentation': {'x': 0, 'y': 0, 'width': 1600},
    'webcam': {'x': 1600, 'y': 0, 'width': 320}
}

# After .select { |name, _| name == 'webcam' }
filtered = {k: v for k, v in legacy_areas.items() if k == 'webcam'}
print(f"After select: {filtered}")

# Now iterate with .each (in Ruby this yields [k, v] pairs)
for area in filtered.items():
    print(f"Iterating area: {area}")
    # In Ruby: area.symbolize_keys! would fail because area is a [key, value] pair
    print(f"Calling .each on this would pass: {area} to the block")
    print(f"Type is tuple/list, not Hash - symbolize_keys! would FAIL")
EOF

Repository: bigbluebutton/bigbluebutton

Length of output: 157


Normalize legacy areas before symbolization to avoid crashes.

Lines 115-152 convert legacy named layouts where areas is stored as a Hash (keyed by area name). When Hash#select filters these areas, it returns a Hash. The subsequent .each do |area| iteration at line 165 yields [key, value] pairs, not Hash objects, causing .symbolize_keys! to fail. Normalize Hash-based areas into an array with a name field before symbolization.

💡 Suggested normalization
 preset['layouts'].each do |specific_layout|
+  if specific_layout['areas'].is_a?(Hash)
+    specific_layout['areas'] = specific_layout['areas'].map do |name, attrs|
+      attrs.merge('name' => name)
+    end
+  end
   specific_layout.symbolize_keys!
   specific_layout[:required]&.map!(&:to_sym)
   specific_layout[:areas].each do |area|
     area.symbolize_keys!
     area[:name] = area[:name].to_sym
   end
   specific_layout[:conditions]&.symbolize_keys!
 end
🤖 Prompt for AI Agents
In `@record-and-playback/video/scripts/process/video.rb` around lines 112 - 170,
The code fails when legacy layouts have areas as a Hash because later code
expects an Array of area Hashes; update the normalization step (around variables
layout, preset['layouts'], and specific_layout processing) to detect when area
collections are a Hash and convert them into an Array of hashes like { 'name' =>
key, 'videos' => value } (or preserve the existing value shape) before calling
symbolize_keys! and converting names to symbols; ensure the same normalization
is applied for the legacy conversions that use select/reject (e.g., when
building layout from webcam_layout, presentation_layout,
deskshare_webcam_layout) so specific_layout[:areas] and layout[:areas] are
always Arrays of Hashes with a name field prior to symbolization.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@record-and-playback/presentation/scripts/publish/presentation.rb`:
- Around line 53-54: The early-return when width.nil? || height.nil? returns the
swapped pair [deskshare_video_height, deskshare_video_width]; change it to
return [deskshare_video_width, deskshare_video_height] so the order (width,
height) matches the normal return [video_width, video_height] and any callers
expecting [width, height] get consistent dimensions.
🧹 Nitpick comments (3)
record-and-playback/core/lib/recordandplayback/edl/video.rb (3)

183-185: Consider warning on conflicting condition values during merge.

Right now conflicts are “undefined.” A warning would make data issues easier to diagnose.

♻️ Possible improvement
-          merged_entry[:conditions].merge!(next_entry.fetch(:conditions, {}))
+          next_conditions = next_entry.fetch(:conditions, {})
+          conflicts = next_conditions.select { |k, v| merged_entry[:conditions].key?(k) && merged_entry[:conditions][k] != v }
+          unless conflicts.empty?
+            BigBlueButton.logger.warn("EDL condition conflict at #{next_entry[:timestamp]}: #{conflicts.inspect}")
+          end
+          merged_entry[:conditions].merge!(next_conditions)

271-286: Log the corrupt filename for easier triage.

Right now the warning doesn’t identify which file was removed.

💡 Suggested tweak
-              if video_source.corrupt?
-                BigBlueButton.logger.warn('Will remove corrupt video file from output')
+              if video_source.corrupt?
+                BigBlueButton.logger.warn("Will remove corrupt video file from output: #{video[:filename]}")
                 corrupt_videos << video[:filename]
               end

405-410: Consider lowering “media present” to debug.

This can be very chatty for long recordings.

💡 Suggested tweak
-        BigBlueButton.logger.info("Media present in cut: #{media.to_a.inspect}")
+        BigBlueButton.logger.debug("Media present in cut: #{media.to_a.inspect}")
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60ef3c1 and a461dcb.

📒 Files selected for processing (11)
  • record-and-playback/core/lib/recordandplayback/edl.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb
  • record-and-playback/core/lib/recordandplayback/generators/events.rb
  • record-and-playback/core/scripts/bigbluebutton.yml
  • record-and-playback/docs/edl/video_source.md
  • record-and-playback/presentation/scripts/publish/presentation.rb
  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/video/scripts/video.yml
🧰 Additional context used
🧠 Learnings (8)
📚 Learning: 2025-09-11T20:24:01.217Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.217Z
Learning: In BigBlueButton's video recording processing pipeline, YAML configuration data (including format hashes) has its keys converted to symbols using deep_symbolize_keys! in the process/video.rb script, so templates should access format data using symbol keys like format[:extension] and format[:mimetype] rather than string keys.

Applied to files:

  • record-and-playback/core/scripts/bigbluebutton.yml
  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-09-11T20:24:01.217Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.217Z
Learning: In BigBlueButton's video recording processing pipeline, format hashes loaded from YAML configuration are converted to use symbol keys via format.symbolize_keys! in the process/video.rb script before being passed to templates, so templates should access format data using symbol keys like format[:extension] and format[:mimetype] rather than string keys.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on the <metadata> element (e.g., <metadata bbb-recording-video-preset="720p" meetingName="Demo Meeting"/>). When using Nokogiri to parse events.xml in Ruby, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups like metadata.at_xpath('element-name').

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on the <metadata> element (e.g., <metadata bbb-recording-video-preset="720p" meetingName="Demo"/>). When using Nokogiri to parse events.xml, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:21:06.847Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.847Z
Learning: In BigBlueButton's events.xml file, metadata is stored as attributes on the metadata element (e.g., `<metadata meetingName="Demo Meeting" isBreakout="false"/>`), not as child elements. The metadata element is accessed via `events.at_xpath('/recording/metadata')` and attributes are accessed using bracket notation like `metadata['meetingName']`.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:23:35.575Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.575Z
Learning: In BigBlueButton's events.xml files, metadata is stored as attributes on <meta> elements under the <metadata> section, not as child elements. When using Nokogiri to parse events.xml, metadata attributes should be accessed using bracket notation like metadata['attribute-name'], not XPath element lookups.

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-10-15T17:57:46.195Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/ja.json:723-727
Timestamp: 2025-10-15T17:57:46.195Z
Learning: In the bigbluebutton repository, locale files (e.g., public/locales/*.json) are managed through Transifex and should not be edited directly in pull requests. Translation corrections and updates should be made in Transifex, which then syncs to the repository.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • record-and-playback/core/lib/recordandplayback/edl/video.rb
🧬 Code graph analysis (5)
record-and-playback/video/scripts/process/video.rb (2)
record-and-playback/core/lib/recordandplayback/generators/events.rb (3)
  • create_webcam_edl (168-390)
  • create_deskshare_edl (473-546)
  • create_presentation_edl (560-631)
record-and-playback/core/lib/recordandplayback/edl/video.rb (2)
  • merge (73-193)
  • render (251-371)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (3)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (3)
  • initialize (15-48)
  • corrupt? (60-63)
  • open (74-182)
record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)
  • initialize (18-28)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • ms_to_s (375-379)
record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (2)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (2)
  • initialize (10-91)
  • initialize (11-14)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (1)
  • initialize (15-48)
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (2)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (5)
  • initialize (10-91)
  • initialize (11-14)
  • corrupt? (26-28)
  • aspect_ratio (19-21)
  • open (38-90)
record-and-playback/core/lib/recordandplayback/edl/video.rb (2)
  • ms_to_s (375-379)
  • aspect_scale (381-390)
record-and-playback/core/lib/recordandplayback/generators/events.rb (1)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (73-193)
🪛 Brakeman (7.1.1)
record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb

[medium] 67-67: Possible command injection
Type: Command Injection
Confidence: Medium
More info: https://brakemanscanner.org/docs/warning_types/command_injection/

(Command Injection)

record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb

[medium] 147-147: Possible command injection
Type: Command Injection
Confidence: Medium
More info: https://brakemanscanner.org/docs/warning_types/command_injection/

(Command Injection)

🪛 LanguageTool
record-and-playback/docs/edl/video_source.md

[style] ~23-~23: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ould remove corrupt videos from the EDL prior to rendering. ### open(width, height, see...

(EN_WORDINESS_PREMIUM_PRIOR_TO)


[style] ~27-~27: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...rs which should be applied to the video prior to it being used. The video source is req...

(EN_WORDINESS_PREMIUM_PRIOR_TO)

🪛 RuboCop (1.82.1)
record-and-playback/core/lib/recordandplayback/edl/video.rb

[convention] 378-378: Prefer single-quoted strings when you don't need string interpolation or special symbols.

(Style/StringLiterals)


[convention] 378-378: Prefer annotated tokens (like %<foo>s) over unannotated tokens (like %s).

(Style/FormatStringToken)


[convention] 378-378: Prefer annotated tokens (like %<foo>s) over unannotated tokens (like %s).

(Style/FormatStringToken)


[convention] 378-378: Favor format over String#%.

(Style/FormatString)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: install-and-run-bbb-tests (5)
  • GitHub Check: install-and-run-bbb-tests (1)
  • GitHub Check: install-and-run-bbb-tests (3)
  • GitHub Check: install-and-run-bbb-tests (7)
  • GitHub Check: install-and-run-bbb-tests (8)
  • GitHub Check: install-and-run-bbb-tests (2)
  • GitHub Check: install-and-run-bbb-tests (6)
🔇 Additional comments (24)
record-and-playback/core/scripts/bigbluebutton.yml (1)

46-49: LGTM! Well-documented configuration option.

The new video_compositing_parallel_workers setting is clearly documented with an explanation of resource implications. The conservative default of 2 is reasonable given the multiplier effect on actual CPU usage.

record-and-playback/core/lib/recordandplayback/edl.rb (1)

51-51: Good fix for Ruby 3.x compatibility.

File.exists? was deprecated in Ruby 2.1 and removed in Ruby 3.2. Using File.exist? is the correct approach.

record-and-playback/presentation/scripts/publish/presentation.rb (1)

1155-1166: Good integration of VideoSource for deskshare handling.

The refactoring correctly uses the new VideoSource class with appropriate corruption checking and safe navigation for the potentially-nil aspect_ratio. This aligns well with the interface defined in the documentation.

record-and-playback/docs/edl/video_source.md (1)

1-33: Clear and comprehensive interface documentation.

The documentation effectively explains the Video Source interface, its implementations, and critical constraints (particularly the requirement for stable resolution to avoid filter chain re-initialization). This will help maintainers understand the contract these classes must fulfill.

record-and-playback/video/scripts/video.yml (3)

56-81: Well-documented conditional layout system.

The expanded documentation clearly explains the new conditions mechanism and available condition types (presentation_is_open, presentation_used, screenshare_as_content). The ordering semantics (first match wins) are also documented.


83-134: 1080p conditional layouts correctly implement the dynamic layout selection.

The layout conditions appropriately handle the key scenarios:

  • Minimized content area → full-screen webcams
  • Hiding deskshare when screenshare_as_content is false
  • Showing full-screen webcams when presentation hasn't been used

The use of hidden: true allows layouts to match on content presence without rendering it.


188-246: 720p conditional layouts mirror the 1080p logic with appropriate dimension adjustments.

The 720p preset includes an additional layout (lines 236-240) for webcam + deskshare that slightly enlarges the deskshare area (1040px vs 960px), which is a reasonable optimization for the smaller resolution.

record-and-playback/core/lib/recordandplayback/edl/video/video_source_reader.rb (1)

6-28: LGTM! Clean value-object design.

The VideoSourceReader class is well-structured as a data container for ffmpeg pipeline configuration. The validation ensuring at least one of ffmpeg_input or ffmpeg_filter is provided is appropriate for the class's contract.

record-and-playback/core/lib/recordandplayback/edl/video/presentation_video_source.rb (1)

38-90: LGTM! Command injection warning is a false positive.

The Brakeman warning at line 67 can be safely dismissed because:

  1. All parameters (width, height, seek, duration, framerate) are numeric values converted via .to_s
  2. @raw_dir comes from internal recording processing paths, not user input
  3. The spawn call uses array form (not shell interpolation), preventing shell injection

The implementation correctly:

  • Uses IO.pipe with optional buffer size increase for performance
  • Properly closes the write end after spawning the child process
  • Returns a well-formed VideoSourceReader with all necessary handles
record-and-playback/core/lib/recordandplayback/edl/video/video_source.rb (3)

98-101: Verify the double seek_offset addition is intentional.

At line 99, seek is modified to include seek_offset. Then at line 100, in_time is calculated as seek + seek_offset, effectively adding seek_offset twice:

seek += seek_offset           # seek = original_seek + seek_offset
in_time = seek + seek_offset  # in_time = original_seek + 2*seek_offset

This may be intentional for the trim filter's PTS offset calculation, but the variable reuse makes the intent unclear. Please verify this is the correct behavior.


146-154: Command injection warning is a false positive.

The Brakeman warning at line 147 can be safely dismissed:

  1. @filename originates from internal recording file paths passed through the processing pipeline
  2. The spawn call uses array form (not shell string), preventing shell injection

198-240: LGTM! Defensive video info parsing.

The read_video_info method employs good defensive coding with multiple early returns to detect various corruption scenarios. The broad StandardError rescue is appropriate here since any parsing failure should result in treating the video as corrupt.

record-and-playback/core/lib/recordandplayback/generators/events.rb (4)

463-546: LGTM! Well-structured deskshare EDL generation.

The create_deskshare_edl method correctly:

  • Uses the offset proc pattern for consistent timestamp handling
  • Handles both legacy Deskshare and modern bbb-webrtc-sfu events
  • Stores original durations separately and applies them after the main loop to handle out-of-order events
  • Includes a terminating entry for proper segment duration calculation

548-631: LGTM! Presentation EDL with condition tracking.

The create_presentation_edl method cleanly tracks when the presentation area becomes "used" based on meaningful user interactions (drawings, slide changes, non-default presentations). The early break at line 622 is a good optimization since presentation_used can only transition from false to true.


633-706: LGTM! Layout conditions EDL.

Good default values for presentation_is_open and screenshare_as_content (both true) ensure backwards compatibility with recordings that don't have the newer layout events.


738-756: LGTM! Updated EDL entry helpers.

The changes correctly:

  • Use video.merge(timestamp: ...) to preserve all video properties while updating timestamp
  • Copy conditions from the source entry using fetch(:conditions, {}) with empty hash fallback
  • Return consistent structures with both areas and conditions keys
record-and-playback/video/scripts/process/video.rb (4)

112-152: LGTM! Good backwards compatibility handling.

The conversion of legacy named layouts (webcam_layout, nopresentation_layout, etc.) to the new constraint-based format is well-implemented. Each conversion:

  • Validates that required areas exist before adding the layout
  • Properly filters areas to match the layout's purpose
  • Assigns descriptive names for debugging

154-170: LGTM! Consistent symbol key normalization.

The symbolization of layout keys, area names, and conditions ensures consistent data access throughout the EDL rendering pipeline. Based on learnings, this aligns with the convention that configuration data should use symbol keys.


182-194: LGTM! New EDL sources integrated correctly.

The presentation and layout EDLs are now generated separately and merged with webcam and deskshare EDLs. This enables the per-cut layout selection feature described in the PR objectives.


235-241: Verify video_compositing_parallel_workers config location.

The parallel workers setting is fetched from props (bigbluebutton.yml) rather than video_props (video.yml). This may be intentional for system-level resource configuration, but confirm this is the desired location for this setting.

record-and-playback/core/lib/recordandplayback/edl/video.rb (4)

24-26: Good: explicit requires for new video source modules.

Keeps load order deterministic and avoids autoload surprises.


56-61: Condition logging looks useful.

Nice addition for debugging conditional layouts.


381-383: Nice nil-guard for aspect ratio.

Prevents failures when a source lacks dimensions.


568-595: LGTM: VideoSourceReader integration is clean.

The input/pipe handling and null-filter fallback look solid.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
record-and-playback/presentation/scripts/publish/presentation.rb (1)

50-61: Handle zero values to prevent division by zero.

The nil check on line 54 guards against nil width/height, but if width or height is 0, line 56 will produce Infinity, leading to invalid dimensions. Based on learnings, unusual dimension values (including zeros) have been observed in recording data.

🐛 Suggested fix to extend the guard
-  return [deskshare_video_width, deskshare_video_height] if width.nil? || height.nil?
+  return [deskshare_video_width.floor, deskshare_video_height.floor] if width.nil? || height.nil? || width.zero? || height.zero?

This also addresses a minor type inconsistency: the early return yields floats while the normal return yields integers (via .floor).

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b369f9d and 1962ce4.

📒 Files selected for processing (1)
  • record-and-playback/presentation/scripts/publish/presentation.rb
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-16T15:20:26.267Z
Learnt from: kepstin
Repo: bigbluebutton/bigbluebutton PR: 21905
File: bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx:515-525
Timestamp: 2024-12-16T15:20:26.267Z
Learning: In recording processing, NaN or Inf values have been observed in pan/zoom related fields due to unusual window sizes. Ensure that calculations involving `scaledViewBoxWidth`, `scaledViewBoxHeight`, and related fields properly handle zero or invalid values to prevent errors.

Applied to files:

  • record-and-playback/presentation/scripts/publish/presentation.rb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: install-and-run-bbb-tests (8)
  • GitHub Check: install-and-run-bbb-tests (2)
  • GitHub Check: install-and-run-bbb-tests (7)
  • GitHub Check: install-and-run-bbb-tests (3)
  • GitHub Check: install-and-run-bbb-tests (1)
  • GitHub Check: install-and-run-bbb-tests (5)
  • GitHub Check: install-and-run-bbb-tests (4)
  • GitHub Check: install-and-run-bbb-tests (6)
  • GitHub Check: install-and-run-plugin-tests
🔇 Additional comments (1)
record-and-playback/presentation/scripts/publish/presentation.rb (1)

1156-1167: LGTM!

The refactoring to use VideoSource is well done:

  • Proper corrupt file detection with corrupt? before processing
  • Safe navigation operators correctly handle nil aspect_ratio
  • The dimension calculation via aspect ratio numerator/denominator correctly produces scaled dimensions that fit within the configured output while maintaining the original aspect ratio

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@germanocaumo germanocaumo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did several recording tests and everything is working correctly.
Went throught the code changes and looks good to me.
Really nice, well done

@antobinary antobinary changed the title Recording dynamic video feat(recording): Recording dynamic video Jan 22, 2026
@antobinary
antobinary merged commit 23f9546 into bigbluebutton:v3.0.x-release Jan 22, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adaptative "video" format recording rendering : follow presentation area in recording

4 participants