Commit Graph

342 Commits

Author SHA1 Message Date
Calvin Walton
1dd40b8380 recording: Fix handling deskshare with delayed video
When a deskshare stream with combined audio + video starts up, it can
happen that the audio starts before the video - so the first video frame
will be some amount of time after the file start.

If there's a recording processing cut in this gap, the procesing can
crash because it can generate an output video with no video frames.

There are two parts to the fix:
  * Trim input videos with the trim filter, configured to ensure at
    least 1 output frame is generated, even if it would be after the
    end timestamp.
  * Use the tpad filter to pad the *start* of a video stream to make
    sure there's something in the gap.
2023-02-10 11:27:18 -05:00
Calvin Walton
46970162fb Recording: move tpad ffmpeg filter before fps
In cases of extremely short (single frame) input videos, the fps filter
can sometimes generate 0-frame output videos, resulting in the tpad
filter having no input (this breaks it, causing a busy loop).

Move the tpad filter to before the fps filter to solve this problem.
This isn't perfect, since the tpad filter doesn't work well on variable-
framerate video (it generates extremely high framerate video with a lot
of frames that will be discarded), but this only happens between the
tpad and fps filters, and only at the end of an input video (usually
right before a cut) so this seems acceptable.

Since the tpad and fps filter are in the same process, these duplicate
frames don't actually require copying any data (the frame is
reference-counted), and still process reasonably quickly.

Fixes #16407
2023-01-06 10:56:50 -05:00
Calvin Walton
5cb32ec088 Recording: Move tpad filter to after fps filter
The tpad filter is problematic on the variable-framerate webcam files,
and the result can end up being hangs (or, at least, very slow
processing) in the compositing.

Move the tpad filter to the compositing process where it can run after
the fps filter has converted the video to constant framerate. It still
needs to run before the start trimming, so switch to using the trim
filter rather than the fps filter's start_pts feature.
2022-12-06 15:59:54 -05:00
Calvin Walton
58c4ffd068 Recording: Pre-process video files using separate ffmpeg
Even with the filter changes made, there's still some cases where
filter chain hangs can result from filter reconfigurations. To solve the
issue completely, I have split out pre-processing video files to
separate ffmpeg processes, so that the filter chain for compositing will
not ever be reconfigured.

Each input video now has a separate ffmpeg process run for it which
does the scaling, padding, and video extending steps. To avoid issues
with disk space usage and extra cpu usage or quality loss, the output
from these separate processes is sent to the compositing ffmpeg process
as uncompressed video in a pipe. To simplify the setup, named pipes
(special files) are used rather than setting up pipes in the ruby code
programmatically.

The extra ffmpeg processes are configured to log to files, and when
complete their log output is copied to the recording processing log.
Processes are joined to ensure zombie processes are not created, and
the return codes of all the processes are checked so errors can be
detected.

Due to the overhead of transferring video through pipes, this might
be a bit slower than the 2.4 recording processing - but on the other
hand, some of the video decoding and scaling happens in parallel, so it
might balance out.
2022-12-05 11:49:16 -05:00
Calvin Walton
aa1aef6727 Recording: Don't use stateful filters in ffmpeg video processing
Because the input videos for BigBlueButton recording processing switch
resolution and aspect ratio, the filter chain gets re-initialized, and
any state in the filters is lost. This causes problems with the
following filters:

`color`: Timestamps restart from 0, rather than continuing at the point
where they left off.
`fps=start_time=12.345`: After reset, the fps filter thinks it's at the
start of the file again, so the next frame it sees gets duplicated
output for timestamps from the `start_time` until it catches back up.
`setpts=PTS-STARTPTS`: The 'STARTPTS' is re-read as the first pts the
filter sees after reinitialization, so timestamp of the next frame is
reset to 0. (In practise, this didn't cause any problems because the
duplicate frames created by the fps filter had the original start time.)

The end result of all of these issues is that a lot of duplicate frames
were created with invalid timestamps, which eventually get discarded
by ffmpeg. But a lot of time is wasted, causing recordings to sometimes
take hours to process when they should be ready in minutes.

The fixes are as follows:

* The `color` filters are used to generate the background and
  substitutes for missing videos. Move them out to separate filter
  chains by using the 'lavfi' input format, which lets you use a filter
  as if it was an input file.
* Rather than use the `fps` filter's `start_time` feature, use the
  `trim` filter to remove early frames.
* The actual start pts is already known by the script, so replace
  `setpts=PTS-STARTPTS` with `setpts=PTS-12.345/TB`, substituting in the
  absolute time.
2022-11-22 13:35:48 -05:00
Ramón Souza
2b0971e2c8 Merge tag 'v2.5.6' into merge-256-26 2022-09-26 09:17:59 -03:00
Calvin Walton
fb43eba355 recording: Fix incorrect seek offsets in video
When converting from using the 'movie' source filter to using separate
ffmpeg command line inputs, it wasn't taken into account that the
'movie' filter passes through timestamps from the source file, while the
ffmpeg input adjusts timestamps so that '0' is the selected seek point.

The easiest fix is to add an option to the ffmpeg command to disable the
timestamp adjustments.

Fixes #15644 (This needs to go into BigBlueButton 2.5 and 2.6)
2022-09-16 12:14:19 -04:00
germanocaumo
d609628047 refactor(recording): remove not used event 2022-08-23 18:39:46 +00:00
Ramón Souza
ded8493f05 Merge remote-tracking branch 'upstream/v2.5.x-release' into 2526-aug3 2022-08-03 09:53:41 -03:00
Anton Georgiev
cb1543e1fa
Merge pull request #15149 from kepstin/video-resize
fix: Support deskshare videos that resize
2022-07-25 13:36:00 -04:00
Ramon Souza
db5ac1428a Merge tag 'v2.5.3' into merge25-26-jul14 2022-07-15 11:08:02 -03:00
Daniel Petri Rocha
ef45c9675f Add cropbox parameter to thumbnails and recording processing step 2022-07-06 18:16:08 +02:00
germanocaumo
c2db91b5f9 Merge branch 'v2.6.x-release' of https://github.com/bigbluebutton/bigbluebutton into tldraw-recording 2022-06-30 14:31:08 +00:00
germanocaumo
853d0dfd9b fix(whiteboard): tldraw recording processing/publishing
Changed the names of tldraw record events to differentiate from before.
Publish tldraw.json file with all shape information during the meeting to be used in playback.
Adapted cursor.xml and panzoom.xml to store tldraw data.
Publish slides svgs to be used by playback's tldraw component (otherwise we have different image sizes in pngs and thus messing the coordinates).
Retro-compatible with old recordings.
2022-06-23 17:04:09 +00:00
GuiLeme
beb0b507e0 [issue-15051] - Refactored all traces from Red5 2022-06-13 08:19:08 -03:00
Calvin Walton
067b4e0c6b Support deskshare videos that resize
Based on work done by Tiago Jacobs and Guilherme Pereira Leme to
investigate the behaviour of ffmpeg on videos with changing input size.

Rather than having the EDL code set fixed sizes for the scale and pad
filters, instead use ffmpeg's built in features to calculate the scale
and pad automatically, dynamically updating if the input video size
changes.

In the version of ffmpeg in Ubuntu 20.04, the 'movie' input filter is
buggy and doesn't correctly handle the video size changing. Instead of
using the movie filter, use separate inputs to the ffmpeg command (the
design used here is based on the code in audio.rb). The filter chain is
now stored into a file (using -filter_complex_script) to reduce problems
with the command line getting too long.

We are using a version of ffmpeg that's new enough to have the tpad
filter now too, so use it to extend the video if needed instead of an
extra concat.
2022-06-08 15:37:47 -04:00
Gustavo Trott
14815184e6
Merge pull request #14911 from GuiLeme/issue-9789 2022-05-10 13:24:11 -03:00
Calvin Walton
2d4976cf72 record-and-playback: Don't seek past end of video input
In some cases with incomplete/partially corrupt files, the input video
file can be shorter than the displayed time. If there is a badly timed
cut, this can result in a seek being generated to a point where ffmpeg
is unable to start at.

Add a detection for this situation, and replace with a blank video.
2022-05-02 14:30:32 -04:00
Guilherme Leme
5763595d66 [issue-9789] - Changes in review. 2022-05-02 09:42:00 -03:00
Guilherme Leme
6741232b3f [issue-9789] - Included the option to show the moderator's view. 2022-04-29 16:06:14 -03:00
Guilherme Leme
fe9585a004 [issue-9789] - Refactored webcamsOnlyForModerator to enhance computer processing. 2022-04-29 13:04:43 -03:00
Guilherme Leme
de344dbb81 [issue-9789] - Refactor userInfo List and its logics. 2022-04-29 11:56:26 -03:00
Guilherme Leme
7a513e0f06 [issue-9789] - process EDL differently (recording component) in order to include the webcmasOnlyForModerator property. 2022-04-28 14:58:47 -03:00
Guilherme Leme
55f8d9266e [issue-14243] - Fix to accept the chatEmphasizedText in recording and akka components. 2022-02-22 12:00:36 -03:00
Guilherme Leme
f6e144d71c [issue-14243] - Changes in Akka, to save the events in redis, and changes in rap to process these changes. 2022-02-17 17:23:28 -03:00
Ramón Souza
16cd3c4ebb Merge remote-tracking branch 'upstream/v2.4.x-release' into dev-24-0125 2022-01-25 16:56:52 +00:00
Pedro Beschorner Marin
810deb907b refactor(etherpad): access control et al.
Move all Etherpad's access control from Meteor to a separated [Node application](https://github.com/bigbluebutton/bbb-pads).
This new app uses [Etherpad's API](https://etherpad.org/doc/v1.8.4/#index_overview)
to create groups and manage session tokens for users to access them. Each group
represents one distinct pad at the html5 client.

- Removed locked users' access to pads: replaced readOnly pad's access with a new pad's content sharing routine
- Pad's access is now controlled by [Etherpad's API](https://etherpad.org/doc/v1.8.4/#index_overview)
- Closed captions edited content now reflects at it's live feedback
- Improved closed caption's dictation mode live feedback
- Moved all Etherpad's API control from Meteor to a separated [app](https://github.com/bigbluebutton/bbb-pads)
- Included access control both in akka-apps and bbb-pads
2022-01-21 16:56:01 -03:00
Anton Georgiev
e463993d01
Merge pull request #9837 from hiroshisuga/fix-thumbnails
fix(recording): Generate thumbnails from uploaded file
2022-01-20 13:39:38 -05:00
Daniel Petri Rocha
3cd16ff7a3 XPATH query optimization: replace // 2021-11-16 00:56:16 +01:00
Daniel Petri Rocha
9be8e9b897 Remove temp dir from deskshare and webcam processing 2021-11-16 00:54:58 +01:00
Joao Siebel
7a118ed3b8 Remove unused properties from chat message event record. close #11696 2021-10-25 14:46:59 -03:00
Calvin Walton
3c1a9cd7c4 RAP: Use "asetpts=N" in ffmpeg audio processing
There's an issue sometimes where when processing the audio from a
desktop sharing file, the STARTPTS value is invalid somehow, and this
results in bad timestamps in the output stream. Depending on the
selected codec/container combination, this might result in errors such
as spam of the message:

Application provided invalid, non monotonically increasing dts to muxer in stream

or simply a hang during processing.

Since we're already using aresample in async mode to correct timestamp
gaps, we can use "asetpts=N" here to simply set the audio frame pts
values to the sample number directly, giving proper monotonic timestamps
with no gaps.
2021-10-21 11:23:09 -04:00
Calvin Walton
1654f26084 recording: Anonymize names in chat
Move the handling of chat events into the shared library so it can be
used by multiple recording formats.

The anonymization of names is based on the external user id, if
available, so users have a consistent name through the meeting. Note
that no effort is made to edit chat messages - if someone is mentioned
by name in a chat message, that will still be visible.

Default settings for anonymization can be controlled in
bigbluebutton.yml, and per-meeting overrides can be done using meta
parameters on the create call.
2021-09-02 15:02:27 -04:00
Anton Georgiev
4ecb24b4fa Merge branch 'v2.3.x-release' of github.com:bigbluebutton/bigbluebutton into merge-aug30 2021-08-30 18:11:16 +00:00
Calvin Walton
93422b5f21 Move ffmpeg '-an' and '-vn' options out of the working format args
Disabling audio or video processing isn't really something that's part
of the working format (and at some point we might want to combine
audio+video processing together).

Move the setting of the '-an' and '-vn' options to where they're
required - as a detail of the EDL processing for video-only and
audio-only components of the output.

Honestly, the main reason for this change is that when testing alternate
working formats, I had accidentally dropped the '-vn' option from the
FFMPEG_WF_ARGS variable without noticing.
2021-08-26 11:20:52 -04:00
Calvin Walton
02d5fe14a6 Don't re-parse the events xml for the has_screenshare_audio check 2021-08-19 10:58:04 -04:00
germanocaumo
4392b0d462 feat(recording): process published external videos
Generate a external_videos.json file at the recordings with an array of
played external videos url and timestamp.

This file will be published along with the other presentation format files
and can be used to display at the playback.
2021-07-07 13:26:24 +00:00
Pedro Beschorner Marin
3b83bddd86 feat(events): store etherpad events file 2021-05-04 13:06:12 -03:00
Pedro Beschorner Marin
83b48d5ee8 fix(events): keep events using resque workflow 2021-05-04 13:01:32 -03:00
Calvin Walton
8098b6b3ad Recording: Halt processing after archive step for non-recorded meetings
In the case where a meeting had recording enabled (record=true on create
call) but the presenter did not start recording during the meeting,
recording processing needs to be stopped after the meeting data is
archived, but before the recording formats are processed.

In the current 2.3 code, processing is halted after the "sanity" step.
However, the 2.2 code stopped processing after the "archive" step
instead. The main difference is that the scripts in the "post_archive"
directory (which are actually post_sanity scripts) did not get run on
non-recorded meetings for 2.2. This behaviour should be preserved for
compatibility.

I have added a special exception to trigger halting processing for a
recording job without causing the entire resque job to be marked as
failed. It only causes the `schedule_next_step` method to be skipped, so
following jobs won't get automatically run. This fixes #11877
2021-04-28 15:53:20 -04:00
Calvin Walton
9e7cecb033 Split the EDL recording marks generation out to a helper function
This function is useful any place you want the matched recording marks
with timestamps rebased so 0 is the start of the meeting, I've used it
for chat analysis, for example.

There is no functional change here, it only exposes the extra function
for recording scripts or dropin/post scripts to use.
2021-04-14 13:40:01 -04:00
Richard Alam
55a416050c - store status when recording has no start/stop marks 2021-03-26 13:39:27 -07:00
Richard Alam
77b105aea2 Track recording process status
- store recording process status into a redis list. This option
   needs to be enabled in bigbluebutton.yml
2021-03-25 12:25:30 -07:00
Richard Alam
54f4d43bea Merge branch 'develop' of github.com:bigbluebutton/bigbluebutton into keep-recording-status-files 2021-03-25 12:14:36 -07:00
germanocaumo
951700502d Recording: Ignore video in audio processing scripts (fix error with screenshare input) 2021-03-25 16:30:32 +00:00
Calvin Walton
331c63adec Don't print audio info for corrupt audio files
Fixes a crash: undefined method `[]' for nil:NilClass
that happens when a corrupt audio file is hit.
2021-03-24 17:02:47 -04:00
Anton Georgiev
a950c9af53
Merge pull request #11626 from prlanzarin/u23-recsa
screenshare: add rap processing for screen streams with audio (complements #11622)
2021-03-24 14:36:31 -04:00
germanocaumo
ea375d6c5e remove trailing whitespaces 2021-03-24 14:01:17 -03:00
germanocaumo
35104fba47 number of inputs for amix command, remove old java deskshare events 2021-03-24 13:35:00 -03:00
Pedro Beschorner Marin
0c4cf0135d Handle pad's events and Meteor's instances
Since Meteor was split in multiple process and events started to be
filtered by instances, all Etherpad's Redis events were being discarded.

Etherpad has a Redis' publisher plugin that is unaware of BigBlueButton's
existence. All the communication between them is kept simple with minimal
of internal data exchange. The concept of distincts subscribers at Meteor's
side broke part of this simplicity and, now, Etherpad has to know which
instance must receive it's messages. To provide such information I decided
to include Meteor's instance as part of the pad's id. Should look like:

 - [instanceId]padId for the shared notes
 - [instanceId]padId_cc_(locale) for the closed captions

With those changes the pad id generation made at the recording scripts had to
be re-done because there is no instance id available. Pad id is now recorded at
akka-apps and queried while archiving the shared notes.
2021-03-23 18:03:50 -03:00