Skip to content

recording: Add support for multiple presets to 'video' recording format - #23887

Merged
antobinary merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
kepstin:recording-video-presets
Nov 19, 2025
Merged

antobinary merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
kepstin:recording-video-presets

Conversation

@kepstin

@kepstin kepstin commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

In order to make the video recording format more flexible, I'm adding support for creating multiple "presets" in the configuration file, to allow different content layouts or video resolutions to be generated.

The layout can be changed on a per-meeting basis by setting the meeting create parameter meta_bbb-recording-video-preset=presetname (this feature can be disabled if not desired).

In addition to supporting multiple presets, the method for defining content-dependent layouts has changed to allow more flexibility. You can specify multiple different possible video layouts for a preset, and an appropriate layout will automatically be selected from the list depending on what type of content was shared during the live session. See the comments in video.yml for details.

The "video" recording format now supports a configuration override file at /etc/bigbluebutton/recording/video.yml - this override file can be used to alter top-level settings and add new presets or replace existing presets. The processing scripts are corrected to read settings from /etc/bigbluebutton/recording/recording.yml as well #22980

The configuration file parsing was written in such a way that it is still able to understand the configuration format used by previous BigBlueButton versions. If someone has customized their video.yml, they can continue to use the same video.yml after upgrading and it will continue to work.

The selection of video layout is still static (a single layout is selected to be used for the entire recording), but the update to how the layouts are handled was designed with adaptive video layout #23337 in mind (it should be possible to implement that without requiring any additional changes to the config file structure).

@coderabbitai

coderabbitai Bot commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

Failed to post review comments

Walkthrough

This pull request introduces markdown-to-HTML rendering for group chat messages with configurable image support, adds a new UserVoiceState event for broadcasting voice conference state changes, propagates speaker locale through the voice system, implements dial-in user mute-on-start enforcement configuration, adds version-aware plugin manifest handling, enhances SVG dimension probing for presentations, updates database schemas to persist HTML message variants and connection metadata, and performs a comprehensive migration from javax.* to jakarta.* for validation and servlet APIs across the Java codebase.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Handler as Message Handler
    participant GroupChat as GroupChatApp
    participant Markdown as MarkdownUtil
    participant DB as ChatMessageDAO
    participant Gateway as OutGateway

    Client->>Handler: SendGroupChatMessage
    Handler->>GroupChat: toGroupChatMessage<br/>(message, allowedHtmlElements)
    GroupChat->>Markdown: markdownToSafeHtml<br/>(message, allowedHtmlElements)
    Markdown-->>GroupChat: messageAsHtml
    GroupChat-->>Handler: GroupChatMessage<br/>(message, messageAsHtml)
    
    Handler->>DB: insertGroupChatMessage<br/>(message, messageAsHtml)
    DB-->>Handler: ✓
    
    Handler->>Gateway: buildGroupChatMsgToUser<br/>(messageAsHtml)
    Gateway->>Client: GroupChatMsgToUser<br/>(message, messageAsHtml)
    
    rect rgb(200, 220, 240)
        Note over Client: Display with<br/>safe HTML rendering
    end
Loading
sequenceDiagram
    participant User
    participant VoiceHandler as Voice Handler
    participant VoiceApp
    participant DB as UserState/VoiceUsers
    participant MsgBuilder
    participant Gateway as OutGateway
    participant Client

    User->>VoiceHandler: Join/Leave/Mute Voice Conf
    VoiceHandler->>VoiceApp: handleUserJoinedVoiceConfEvtMsg<br/>(speechLocale)
    VoiceApp->>DB: Update VoiceUserState<br/>(speechLocale)
    
    VoiceApp->>MsgBuilder: buildUserVoiceStateEvtMsg
    MsgBuilder-->>VoiceApp: UserVoiceStateEvtMsg<br/>(talking, muted, leftVoiceConf)
    
    VoiceApp->>Gateway: send(UserVoiceStateEvtMsg)
    Gateway->>Client: Broadcast voice state<br/>update
    
    rect rgb(220, 240, 200)
        Note over Client: Update voice UI<br/>(status, icons, etc.)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • Chat HTML rendering integration (GroupChat.scala, MarkdownUtil.scala, ChatMessageDAO.scala) — New markdown-to-HTML pipeline with image handling configuration; verify safe HTML sanitization and XSS prevention across all call sites
  • Voice state event propagation (VoiceApp.scala, message handlers) — New UserVoiceState events broadcast in multiple code paths; ensure consistent state and no duplicated emissions
  • Database schema changes (ChatMessageDAO.scala, UserConnectionStatusDAO.scala) — New nullable fields and altered parameter signatures; verify backward compatibility and migration safety
  • SendGroupChatMessageMsgHdlr.scala — Complex new permission checking logic for plugin messages with ejection paths; requires careful validation of authorization flows
  • MarkdownUtil.scala — New security-critical HTML rendering utility with link/image handling; review for injection vulnerabilities and URL validation
  • Jakarta migration (extensive, ~50 files) — While mostly mechanical, verify no build or runtime issues from namespace changes; check Spring boot compatibility
  • SVG dimension probing (MsgBuilder.scala, SvgImageCreatorImp.scala) — New XML parsing with external entity protections; validate parsing robustness and performance impact
  • Plugin manifest changes (Plugins.scala) — New version parameter handling and server command permissions; ensure backward compatibility with existing plugin manifests

Suggested reviewers

  • antobinary
  • gustavotrott

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add support for multiple presets to 'video' recording format' clearly describes the main feature being added—preset support for video recordings. It is specific, concise, and directly relevant to the primary changeset focus.
Description check ✅ Passed The description comprehensively explains the feature being added (multiple presets, per-meeting configuration, flexible layout selection, override file support, backward compatibility) and directly relates to the changeset modifications throughout the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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: 4

Caution

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

⚠️ Outside diff range comments (7)
record-and-playback/video/playback/video/index.html.erb (3)

5-5: Escape meetingName to prevent XSS in title and header

meetingName originates from metadata (untrusted). Escape before rendering.

-    <title><%= meetingName %></title>
+    <title><%= CGI.escapeHTML(meetingName.to_s) %></title>
...
-      <h1><%= meetingName %></h1>
+      <h1><%= CGI.escapeHTML(meetingName.to_s) %></h1>

Also applies to: 17-17


31-31: Fix srclang value

srclang must be a BCP-47 language code (e.g., "en"), not a filename.

-              <track kind="captions" label="<%= CGI.escapeHTML(caption['localeName']) %>" src="caption_<%= CGI.escapeHTML(caption['locale']) %>.vtt" srclang="<%= CGI.escapeHTML(caption['locale']) %>.vtt">
+              <track kind="captions" label="<%= CGI.escapeHTML(caption['localeName']) %>" src="caption_<%= CGI.escapeHTML(caption['locale']) %>.vtt" srclang="<%= CGI.escapeHTML(caption['locale']) %>">

40-40: Accessibility attribute typo

Change area-label to aria-label for screen readers.

-        <div id="chat" aria-live="polite" role="region" area-label="Chat Messages"></div>
+        <div id="chat" aria-live="polite" role="region" aria-label="Chat Messages"></div>
record-and-playback/video/scripts/publish/video.rb (2)

21-24: Require missing deps

This file uses Nokogiri and JSON but never requires them; runtime will fail on first use.

 require File.expand_path('../../lib/recordandplayback', __dir__)
 require 'optimist'
 require 'yaml'
+require 'nokogiri'
+require 'json'

29-29: Typo: Optimist.die, not Optimist.dir

This currently raises NoMethodError and blocks publishing.

-Optimist.dir :meeting_id, 'must be provided' unless opts[:meeting_id]
+Optimist.die :meeting_id, 'must be provided' unless opts[:meeting_id]
record-and-playback/video/scripts/process/video.rb (2)

21-29: Require missing stdlib

Set and JSON are used later; without requires this will crash at runtime.

 require File.expand_path('../../lib/recordandplayback', __dir__)
 require File.expand_path('../../lib/recordandplayback/edl', __dir__)
 require 'active_support/core_ext/hash'
 require 'optimist'
 require 'yaml'
 require 'nokogiri'
 require 'erb'
 require 'cgi'
+require 'set'
+require 'json'

414-419: Preserve metadata children, not attributes

Copying attributes drops most metadata. Iterate child elements to retain all keys.

-    xml.meta do
-      metadata.attributes.each do |k, v|
-        xml.method_missing(k, v)
-      end
-    end
+    xml.meta do
+      metadata.elements.each do |child|
+        xml.method_missing(child.name, child.text)
+      end
+    end
🧹 Nitpick comments (6)
record-and-playback/video/scripts/publish/video.rb (1)

73-81: Metadata presence check is good; add tiny guard

If metadata.xml is malformed, Nokogiri::XML can return a document with errors. Optional: log xml.errors for easier diagnostics.

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

87-94: Minor log grammar

“Webcams were use” → “Webcams were used”.

-  logger.info('Webcams were use in this session')
+  logger.info('Webcams were used in this session')
record-and-playback/video/scripts/video.yml (4)

24-27: Guard against VP9 + MP4 copy mismatch.

If bbb_presentation_video_codec is set to vp9, the MP4 “-c:v copy” formats will fail; MP4 doesn’t carry VP9. Either (a) keep codec=h264 when using MP4/copy, or (b) enable a WebM/VP9 format and disable MP4. Please confirm the processing scripts reject/override incompatible combinations.

Minimal doc hardening:

 # The codec that will be used by the intermediate file generated by the bbb-presentation-video
 # tool, containing the presentation/whiteboard area. The options are "vp9" or "h264".
+# NOTE: If set to "vp9", ensure a WebM/VP9 output format is enabled and MP4/copy is disabled,
+# or change MP4 parameters to transcode to H.264 instead of using "-c:v copy".
 bbb_presentation_video_codec: "h264"

If you want, I can provide a patch that uncomments the WebM/VP9 blocks and comments out the MP4 blocks.

Also applies to: 86-98, 148-156


73-73: Remove trailing whitespace (yamllint).

Keeps CI green and diffs clean.

-      
+
-    
+
-          - [ '-c:v', 'copy', # Use working format codec defined in 
+          - [ '-c:v', 'copy', # Use working format codec defined in

Also applies to: 147-147, 152-152


21-23: Consider restricting meta-driven preset selection.

allow_meta_preset: true lets meeting creators pick heavier presets (e.g., 1080p), impacting CPU/IO. Recommend defaulting to false in large deployments or whitelisting allowed meta presets downstream.


92-93: Revisit file extension: use “mp4” instead of “m4v”.

Some tooling and CDN heuristics expect .mp4; you already advertise video/mp4. If nothing depends on .m4v, switch to .mp4.

-        extension: m4v
+        extension: mp4

Also applies to: 150-151

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8d1480 and a3fb26a.

📒 Files selected for processing (4)
  • record-and-playback/video/playback/video/index.html.erb (1 hunks)
  • record-and-playback/video/scripts/process/video.rb (5 hunks)
  • record-and-playback/video/scripts/publish/video.rb (3 hunks)
  • record-and-playback/video/scripts/video.yml (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
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 (463-529)
  • edl_match_recording_marks_video (583-588)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (55-177)
🪛 ast-grep (0.38.6)
record-and-playback/video/scripts/process/video.rb

[warning] 156-156: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: sl.fetch('areas', preset.fetch('areas', []))
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures [REFERENCES]
https://cwe.mitre.org/data/definitions/522.html

(hardcoded-secret-rsa-passphrase-ruby)

🪛 YAMLlint (1.37.1)
record-and-playback/video/scripts/video.yml

[error] 73-73: trailing spaces

(trailing-spaces)


[error] 147-147: trailing spaces

(trailing-spaces)


[error] 152-152: trailing spaces

(trailing-spaces)

⏰ 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). (5)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-etherpad)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-apps-akka)
🔇 Additional comments (8)
record-and-playback/video/scripts/publish/video.rb (2)

40-56: Override merge approach looks good

Preserving base presets while allowing override presets to extend/replace is correct and backward-compatible. Nice.


118-121: Correct use of string keys when copying outputs

Matches how YAML loads format hashes. LGTM.

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

44-60: Override merge approach looks good

Merging presets separately before merging other keys enables additive overrides. Backward-compatible. 👍


146-151: Set usage is correct once stdlib is required

After requiring 'set', this media detection is solid.


154-170: Constraint-based layout selection is sensible

The required/supported logic aligns with the presets design. Nice.


215-219: Good defensive check on layout

Exiting early if core layout fields are missing prevents confusing downstream errors.


322-330: Codec default mismatch with config summary: verify

Code defaults to 'vp9', while video.yml (per PR summary) sets 'h264'. Ensure intended default is documented; otherwise you may get unexpected transcodes on missing config.


338-343: Correctly symbolizing format before encode

Matches EDL.encode expectations. LGTM.

@kepstin

kepstin commented Sep 11, 2025

Copy link
Copy Markdown
Contributor Author

The code duplication check is probably being triggered by the duplicate code needed to handle loading and merging the config files, as well as selecting the correct preset, separately in the process/video.rb and publish/video.rb scripts. There is no easy way to make this code common between the two scripts.

@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

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/video/scripts/process/video.rb (1)

21-29: Require 'set' to use Set

Ruby’s Set lives in the standard library and must be required. Without this, NameError: uninitialized constant Set will occur at runtime.

Apply this diff:

 require 'optimist'
 require 'yaml'
 require 'nokogiri'
 require 'erb'
 require 'cgi'
+require 'set'
♻️ Duplicate comments (2)
record-and-playback/video/scripts/process/video.rb (2)

117-123: Correctly reading preset from metadata attributes — LGTM

Accessing events.xml metadata as attributes via metadata['bbb-recording-video-preset'] is correct for Nokogiri here.


395-397: meetingName attribute access — LGTM

metadata['meetingName'] correctly reads the attribute from events.xml.

🧹 Nitpick comments (2)
record-and-playback/video/scripts/process/video.rb (1)

45-51: Optional: allow YAML anchors/aliases in overrides

If admins use YAML anchors/aliases in /etc overrides, safe_load may reject them. Consider enabling aliases to improve configurability.

Apply this diff (both loads):

-  YAML.safe_load(video_props_file)
+  YAML.safe_load(video_props_file, aliases: true)
-    YAML.safe_load(video_props_override_file)
+    YAML.safe_load(video_props_override_file, aliases: true)
record-and-playback/video/scripts/video.yml (1)

147-147: Remove trailing spaces

Minor YAML lint issue.

Apply this diff:

-      
+
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 565286f and ce640c7.

📒 Files selected for processing (4)
  • record-and-playback/video/playback/video/index.html.erb (4 hunks)
  • record-and-playback/video/scripts/process/video.rb (6 hunks)
  • record-and-playback/video/scripts/publish/video.rb (4 hunks)
  • record-and-playback/video/scripts/video.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • record-and-playback/video/playback/video/index.html.erb
  • record-and-playback/video/scripts/publish/video.rb
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
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:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
Learning: In BigBlueButton's events.xml file, metadata is stored as attributes on the metadata element, not as child elements. Therefore, accessing metadata values should use bracket notation like metadata['meetingName'] rather than XPath methods like at_xpath('meetingName').

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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
🧬 Code graph analysis (1)
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 (463-529)
  • edl_match_recording_marks_video (583-588)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (55-177)
🪛 ast-grep (0.38.6)
record-and-playback/video/scripts/process/video.rb

[warning] 156-156: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: sl.fetch('areas', preset.fetch('areas', []))
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures [REFERENCES]
https://cwe.mitre.org/data/definitions/522.html

(hardcoded-secret-rsa-passphrase-ruby)

🪛 YAMLlint (1.37.1)
record-and-playback/video/scripts/video.yml

[error] 147-147: trailing spaces

(trailing-spaces)

⏰ 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). (5)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (1)
record-and-playback/video/scripts/process/video.rb (1)

338-343: Formats symbolization before encode — LGTM

Symbolizing each format hash in place ensures templates can use symbol keys consistently later.

@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

♻️ Duplicate comments (2)
record-and-playback/video/scripts/process/video.rb (2)

155-158: LGTM: correct fallback to base layout areas

Using layout.fetch('areas', []) fixes the earlier incorrect suggestion to use preset. This ensures constraint-based layout matching works.


395-397: Use attribute access (correct) + add nil-safe fallback for meetingName

Attribute access is correct for events.xml metadata (per prior discussion). Add safe nav + fallback to meeting_id to avoid nil crash.

-    meetingName: metadata['meetingName'],
+    meetingName: metadata&.[]('meetingName') || meeting_id,
🧹 Nitpick comments (4)
record-and-playback/video/scripts/process/video.rb (4)

44-59: Enable YAML anchors in configs (safer override merging)

safe_load currently rejects YAML anchors/aliases, which are common in BBB configs. Allow aliases for both base and override loads.

-  YAML.safe_load(video_props_file)
+  YAML.safe_load(video_props_file, aliases: true)
@@
-    YAML.safe_load(video_props_override_file)
+    YAML.safe_load(video_props_override_file, aliases: true)

125-129: Tighten log phrasing for fallback

When meta preset is disabled or absent, “Preset doesn't exist” is misleading.

-  logger.info("Preset doesn't exist, falling back to default preset #{preset_name.inspect}")
+  logger.info("Using default preset #{preset_name.inspect}")

322-322: Prefer preset-level codec setting; fallback to global

Code reads only from top-level props, but PR intent mentions preset-level override. Read from preset first, then video_props.

-  bbb_presentation_video_codec = video_props.fetch('bbb_presentation_video_codec', 'vp9')
+  bbb_presentation_video_codec = preset.fetch('bbb_presentation_video_codec',
+                                              video_props.fetch('bbb_presentation_video_codec', 'vp9'))
@@
-      '-c', bbb_presentation_video_codec,
+      '-c', bbb_presentation_video_codec,

Also applies to: 328-330


338-343: LGTM: uses preset formats and symbolized format keys

Looks good. Ensure require 'json' is present to avoid runtime error at JSON.parse later.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce640c7 and 773f93b.

📒 Files selected for processing (1)
  • record-and-playback/video/scripts/process/video.rb (6 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
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:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
Learning: In BigBlueButton's events.xml file, metadata is stored as attributes on the metadata element, not as child elements. Therefore, accessing metadata values should use bracket notation like metadata['meetingName'] rather than XPath methods like at_xpath('meetingName').

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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
🧬 Code graph analysis (1)
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 (463-529)
  • edl_match_recording_marks_video (583-588)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (55-177)
🪛 ast-grep (0.38.6)
record-and-playback/video/scripts/process/video.rb

[warning] 156-156: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: sl.fetch('areas', layout.fetch('areas', []))
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures [REFERENCES]
https://cwe.mitre.org/data/definitions/522.html

(hardcoded-secret-rsa-passphrase-ruby)

⏰ 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). (6)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-learning-dashboard)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-graphql-server)
🔇 Additional comments (2)
record-and-playback/video/scripts/process/video.rb (2)

90-90: LGTM: clearer log message

No issues here.


263-268: LGTM: EDL entries use symbol keys consistently

Matches EDL conventions and later processing.

Also applies to: 272-276

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
18.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@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/video/scripts/process/video.rb (1)

21-29: Require stdlib deps explicitly to avoid NameError across environments

Set, Logger, FileUtils, and JSON are used but not required; some Ruby setups won’t autoload them.

 require File.expand_path('../../lib/recordandplayback', __dir__)
 require File.expand_path('../../lib/recordandplayback/edl', __dir__)
 require 'active_support/core_ext/hash'
 require 'optimist'
 require 'yaml'
 require 'nokogiri'
 require 'erb'
 require 'cgi'
+require 'set'
+require 'logger'
+require 'fileutils'
+require 'json'
🧹 Nitpick comments (4)
record-and-playback/video/scripts/process/video.rb (4)

117-129: Meta-preset: keep attribute access, add nil-safe guard and clearer logging

Attribute access is correct for events.xml. Guard for missing and only log when a name exists; log unknown preset before falling back.

-preset = nil
-if video_props.fetch('allow_meta_preset', true)
-  # Use preset specified via metadata parameter, if available
-  preset_name = metadata['bbb-recording-video-preset']
-  logger.info("Using preset #{preset_name.inspect}")
-  preset = video_props.dig('presets', preset_name) unless preset_name.nil?
-end
+preset = nil
+if video_props.fetch('allow_meta_preset', true)
+  # Use preset specified via metadata parameter, if available
+  preset_name = metadata&.[]('bbb-recording-video-preset')
+  if preset_name
+    preset = video_props.dig('presets', preset_name)
+    if preset
+      logger.info("Using preset from metadata: #{preset_name.inspect}")
+    else
+      logger.warn("Unknown preset from metadata: #{preset_name.inspect} — will fall back")
+    end
+  end
+end
 # Fall back to using the default preset
 if preset.nil?
   preset_name = video_props['default_preset']
-  logger.info("Preset doesn't exist, falling back to default preset #{preset_name.inspect}")
+  logger.info("Falling back to default preset #{preset_name.inspect}")
   preset = video_props.dig('presets', preset_name) unless preset_name.nil?
 end

228-235: Warn when dropping presentation due to layout lacking area

Currently this silently disables presentation even if media exists. Emit a warning to aid misconfig diagnosis.

-# 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' }
+# Ensure the presentation video is not generated unless there is a presentation area in the selected layout
+if have_presentation && !layout['areas'].any? { |area| area['name'] == 'presentation' }
+  logger.warn('Presentation media present but selected layout lacks a presentation area; skipping presentation rendering')
+  have_presentation = false
+end

325-333: Let presets override presentation codec, fall back to global and default

Aligns with per-preset control while keeping backward compatibility.

-bbb_presentation_video_codec = video_props.fetch('bbb_presentation_video_codec', 'vp9')
+bbb_presentation_video_codec =
+  preset.fetch('bbb_presentation_video_codec',
+               video_props.fetch('bbb_presentation_video_codec', 'vp9'))

341-346: Validate formats array before encoding; symbolization aligns with templates

Add a small guard to fail fast on empty/invalid formats. Symbolizing each format entry is good and matches template expectations.

-logger.info "Encoding output files to #{preset['formats'].length} formats"
-preset['formats'].each_with_index do |format, i|
+formats = preset['formats']
+unless formats.is_a?(Array) && !formats.empty?
+  logger.error('Preset formats missing or empty')
+  exit(1)
+end
+logger.info "Encoding output files to #{formats.length} formats"
+formats.each_with_index do |format, i|
   format.symbolize_keys!
   logger.info "  #{format[:mimetype]}"
   BigBlueButton::EDL.encode(audio, video, format, "#{process_dir}/video-#{i}", video_props['audio_offset'])
 end
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 773f93b and c29ce91.

📒 Files selected for processing (1)
  • record-and-playback/video/scripts/process/video.rb (6 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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.
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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:23:35.550Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:117-123
Timestamp: 2025-09-11T20:23:35.550Z
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
📚 Learning: 2025-09-11T20:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
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:21:06.806Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/scripts/process/video.rb:395-397
Timestamp: 2025-09-11T20:21:06.806Z
Learning: In BigBlueButton's events.xml file, metadata is stored as attributes on the metadata element, not as child elements. Therefore, accessing metadata values should use bracket notation like metadata['meetingName'] rather than XPath methods like at_xpath('meetingName').

Applied to files:

  • record-and-playback/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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/video/scripts/process/video.rb
📚 Learning: 2025-09-11T20:24:01.166Z
Learnt from: kepstin
PR: bigbluebutton/bigbluebutton#23887
File: record-and-playback/video/playback/video/index.html.erb:27-29
Timestamp: 2025-09-11T20:24:01.166Z
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
🧬 Code graph analysis (1)
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 (463-529)
  • edl_match_recording_marks_video (583-588)
record-and-playback/core/lib/recordandplayback/edl/video.rb (1)
  • merge (55-177)
🪛 ast-grep (0.38.6)
record-and-playback/video/scripts/process/video.rb

[warning] 156-156: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: sl.fetch('areas', layout.fetch('areas', []))
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures [REFERENCES]
https://cwe.mitre.org/data/definitions/522.html

(hardcoded-secret-rsa-passphrase-ruby)

⏰ 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). (5)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-playback-record)
  • GitHub Check: build-package (bbb-etherpad)
  • GitHub Check: build-package (bbb-export-annotations)
  • GitHub Check: build-package (bbb-graphql-server)
🔇 Additional comments (3)
record-and-playback/video/scripts/process/video.rb (3)

48-59: Override merge logic looks solid

Cleanly supports /etc override and merges presets first to allow additive/replace semantics; tolerates missing override file.


154-170: Constraint-based layout selection reads well

Required/supported media checks with Set are correct; fallback to named layouts comes later.


395-401: meetingName attribute access is correct

Correctly pulls meetingName from metadata attributes for the index template.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

⏳ Tests are running...

@kepstin

kepstin commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

At Anton's request, I'm going to be rebasing this PR to BBB 3.0

@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.

Reviewed and tested a bit, everything seems good 👍

In order to make the video recording format more flexible, I'm adding
support for creating multiple "presets" in the configuration file, to
allow different content layouts or video resolutions to be generated.

The layout can be changed on a per-meeting basis by setting the meeting
create parameter `meta_bbb-recording-video-preset=presetname` (this
feature can be disabled if not desired).

In addition to supporting multiple presets, the method for defining
content-dependent layouts has changed to allow more flexibility. You
can specify multiple different possible video layouts for a preset, and
an appropriate layout will automatically be selected from the list
depending on what type of content was shared during the live session.
See the comments in video.yml for details.

The "video" recording format now supports a configuration override file
at /etc/bigbluebutton/recording/video.yml - this override file can be
used to alter top-level settings and add new presets or replace existing
presets.

The configuration file parsing was written in such a way that it is
still able to understand the configuration format used by previous
BigBlueButton versions. If someone has customized their video.yml, they
can continue to use the same video.yml after upgrading and it will
continue to work.
Skip generating the presentation video if the selected layout does
not include a presentation area.
@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@kepstin
kepstin changed the base branch from v3.1.x-release to v3.0.x-release November 13, 2025 19:27
@kepstin

kepstin commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

I've rebased the PR to the v3.0.x-release branch. The diff is identical.

@sonarqubecloud

Copy link
Copy Markdown

@antobinary
antobinary merged commit 7d6f2eb into bigbluebutton:v3.0.x-release Nov 19, 2025
@antobinary antobinary changed the title Add support for multiple presets to 'video' recording format recording: Add support for multiple presets to 'video' recording format Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants