I can clarify a bit here on what is present in the Guacamole protocol stream and how it relates to the traditional video concept of a keyframe.
First, the Guacamole protocol stream is not a video stream. The Guacamole protocol consists of a series of instructions, including instructions related to graphical operations, audio, file/data transfer, events, etc. The concept of a video stream here would relate only to a subset of those instructions. With that in mind: A keyframe is a frame which *does not* depend on earlier parts of the video. The graphical content of a Guacamole protocol stream is generally entirely incremental, and as such contains zero keyframes, with the possible exception of the initial part of the stream (which inherently has to initialize the display state). To replay the Guacamole instructions of a particular frame, you must have the display state resulting from all previous frames. You *can* quickly seek to any particular point with a binary search, as the stream contains timestamps which are naturally in sorted order, but you would then need to replay all instructions prior to that point. This is what the player object provided by guacamole-common-js does. The player object also takes this a step further and dynamically generates its own internal key frames (snapshots of display state), so that you can seek backward in the stream quickly. What you describe is possible - you would end up replaying the stream up to the start timestamp (without writing video frames), then begin writing video frames as normal, and then stop the process once you reach the end timestamp. - Mike On Sun, Mar 15, 2020 at 3:38 PM Adrian Owen <[email protected]> wrote: > Hi Sean, > > > Yes this is something I'd be very interested on working on. > > > My requirements are simple. Start at point x and run to the end. > > > The stream will be active (locked), and each time I visit it and will have > moved on. > > > > Or supply the 2 parameters, either way make it a contribution to guacamole > project > > > > I had as look at video.c and see I have a really steep learning curve > ahead to code it. > > Thanks Adrian > > ------------------------------ > *From:* Sean Reid <[email protected]> > *Sent:* 15 March 2020 22:15 > *To:* [email protected] > *Subject:* Re: guacenc new parameters > > Hi Adrian, > > Is this something you'd be interested in working on? I've worked a bit on > guacenc myself, so I can give you some information that I've found from > working on it. > > I'm not confident that you need to think about keyframes much at all from > the perspective of guacenc. From my understanding (and I welcome anyone who > might differ from my understanding or explanation here to jump in), since > the Guacamole Protocol attempts to only send changes, guacenc renders a new > image in memory for each new instruction in the recording file, based on > the previously rendered image. Each new image is just a mutation of the > previous, but itself is a full image. These images are sent to libavcodec > on a periodic that matches the target framerate. This is done because the > guacamole protocol doesn't have a framerate, so to square the circle of > converting to a video with a time base, guacenc holds the image in memory > so that it can repeat sending unchanged frames to libavcodec if no > guacamole protocol instructions mutated the in-memory image. This > implicitly means that each image guacenc sends can be a keyframe, so you > could potentially start the encoding at any frame you'd like. > > I'd recommend you look at the logic of video.c > <https://github.com/apache/guacamole-server/blob/master/src/guacenc/video.c> > in the guacenc source to get a better idea about how this process works. > > Sean > > On Sun, Mar 15, 2020 at 5:17 PM Adrian Owen <[email protected]> wrote: > >> Hi Sean, >> >> >> Thanks! >> >> >> I believe that Keyframes are written to video stream, done as work for >> the Player. >> >> >> So I guess it would be StartKeyFrame EndKeyFrame. >> >> >> It would have to start at StartKeyFrame and run 'n' keyframes and stop. >> >> >> So its a matter of scanning the video stream file for keyframes. >> >> >> That is challenging. I am a C programmer, but know not how to identify a >> keyframe while reading the stream. >> >> >> >> >> Adrian >> >> >> >> ------------------------------ >> *From:* Sean Reid <[email protected]> >> *Sent:* 15 March 2020 20:02 >> *To:* [email protected] >> *Subject:* Re: guacenc new parameters >> >> Hi Adrian, >> >> I don't see a reason that this wouldn't be possible. I think it would be >> done by guacenc, though, not by ffmpeg. I'd think that guacenc just >> wouldn't start sending the frames to be encoded until, while reading the >> input file, guacenc has reached the start time and stop sending frames to >> be encoded at end time. >> >> Sean >> >> On Sun, Mar 15, 2020 at 1:55 PM Adrian Owen <[email protected]> wrote: >> >>> Hi, >>> >>> ffmpeg allows getting a section of a video file by specifying start >>> seconds and end seconds, >>> >>> Now the Guacamole video steam may not know seconds but: >>> >>> Could Guacenc support extra parameters: StartPoint Endpoint? >>> >>> And then only generate MV4 between those points. >>> >>> >>> This is a theoretical question, >>> >>> >>> Many thanks, Adrian >>> >>>
