Open TheBizzle opened 12 years ago
I tried taking the code that pushes to the file sink and having it run inside an actor, but that didn't seem to change things at all....
Alright, I'm throwing in the towel on this one for now (even though–nay, because–I'm pretty sure I just figured out how to fix it).
The problem–or at least part of it–is how the recording code was originally written. Right now, when the view asks for a buffer from GStreamer, process that request, give the buffer to NetLogo, and push to the recorder as a part of our "buffer cleanup" phase. _This is wrong._ This causes FPS issues–irreconcilable ones. We cannot provide 30 frames of video per second to the recorder if we constantly have to wait on NetLogo and the processing in a first pipeline before sending it off to another. Also, the fact that the video gets scaled twice, then, is bad. More so, it's not just that we can't provide 30 FPS; we can't hope to promise any constant framerate–and that's exactly what these GStreamer elements are expecting: constant framerate. As such, this functionality needs to be redone.
Here's what we have now:
(NetLogo): Webcam Source => Color Converter => Scaler => Balancer => (hacky tee) => [(NetLogo Sink), (Recorder)]
(Recorder): (hacky tee output) => Scaler => Rate Filter => File Sink
Instead of doing a NetLogo Pipeline and pushing its buffers off to the Recorder Pipeline when it's convenient, we need to have one pipeline–a pipeline that I propose to be laid out like so:
Webcam Source => Color Converter => Balancer => Tee (GstTee) => [(a), (b)]
(a):
(GstTee output) => Scaler => NetLogoSink
(b):
If we're not recording: (GstTee output) => Fake Sink (fakesink)
Else: (GstTee output) => Scaler (videoscale) => Rate Filter (videorate) => File Sink
NOTE: The Rate Filter could probably even come before the GstTee.
ONE SINK
WITH A TEE
NO DOUBLE-SCALING
NO HACKS
PROPER FRAMERATES
JUSTICE
VICTORY
Unfortunately, I don't want to work on this right now.... I plan to tackle this later.
I made a recording of me putting up an additional finger every second for five seconds. The video runs fast and shortened. That is, it was 3 seconds long (where it should have been ~6 seconds long), and the final 1-2 seconds of footage were actually missing.
My guess is that this is at least partially related to passing the recorder a framerate of 30 FPS at initialization and then not being able to deliver a full 30 FPS.