bigbluebutton-Github/record-and-playback/core/lib/recordandplayback
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
..
edl Recording: Don't use stateful filters in ffmpeg video processing 2022-11-22 13:35:48 -05:00
generators refactor(recording): remove not used event 2022-08-23 18:39:46 +00:00
workers feat(events): store etherpad events file 2021-05-04 13:06:12 -03:00
edl.rb Recording processing using MP4/OGG temporary files, stream copy, and customizable (lower) frame rates. 2021-03-08 20:14:48 +02:00
events_archiver.rb - store status when recording has no start/stop marks 2021-03-26 13:39:27 -07:00
workers.rb RaP: Clean up resque worker code, add worker for keep_events feature 2020-01-21 17:14:39 -05:00