Page 1 of 1

Movie Clip Buffer

Posted: 23 May 2016, 16:22
by chriss0212
Hi,

i have a movie clip playing an *mp4 file. It is configured to loop and have a buffer of 200 frames. When it comes to the loop the buffer jumps from 200 to 0 and needs to fill up again. Wouldn't it be more sense full, if the buffer starts to cache frames starting at 0 200 frames before the loop point comes? Problem is not only Buffer runs out also cpu goes up on the looping point.

greets

christian

Re: Movie Clip Buffer

Posted: 24 May 2016, 09:38
by Götz_B
Im sure we optimized exactly that in V4 already. :?
Lets doublecheck...

Re: Movie Clip Buffer

Posted: 24 May 2016, 10:55
by Dierk Ohlerich
Assuming nothing weird happens, the movie clip node does prebuffer the loop-start-point, but this is not visualized. then it will start decoding from were the prebuffered loop point ends, and this is visualized in the performance statistics.

There are many reasons for a spike in CPU. First the cpu stops decoding when the last frame has been decoded, and then does no decoding until the buffer is used up and the last frame is displayed. When the loop-point is reached all free cpu time will be used to decode the frames after the loop as fast as possible - spiking the CPU. This should not be a problem because in the end the CPU does not more work as if the loop was not present.

If you have long group-of-pictures (GOP), something really bad can happen. Imagine 10 buffers and 30 GOP. Then the first 10 frames after the loop-start-point. As soon as the loop jumps back, the 10 buffers will be played back. Decoding starts at frame 10, but since the GOP is 30 the decoder jumps to the start of the GOP (frame 0) and decodes the same 10 frames that are in the loop buffer - more work is done as if the loop was not present and the CPU spike is a problem. Solution: more prebuffer.

-- Dierk

Re: Movie Clip Buffer

Posted: 25 May 2016, 08:41
by chriss0212
Hi Dierk,
There are many reasons for a spike in CPU. First the cpu stops decoding when the last frame has been decoded, and then does no decoding until the buffer is used up and the last frame is displayed. When the loop-point is reached all free cpu time will be used to decode the frames after the loop as fast as possible - spiking the CPU. This should not be a problem because in the end the CPU does not more work as if the loop was not present.
If i understand it correct:
i Have a Movie lets say 500 frames and i buffer 100 frames.

If the movie is running it has bufferd 100 frames and "some" frames for the loop start. if i rech frame 400 the movie node is just using the buffer until it is empty at frame 500...and on the looping point it jumps to frame number 0 use the (don't know how many) prbuffered frames and in the samte time the movie node is loading and decoding the difference from the pre buffered frames to frame 100?

for me this makes not realy sense because hi have realy big spikes in the cpu power at this moment!

for me it would make sense always prebuffer next 100 frames. what means if the movie is on frame 410 frames 0-9 are already prebuffered and decoded and on 450 frames 0-49 are already buffered and decoded. for my understanding there would be no spike.

greets

christian

Re: Movie Clip Buffer

Posted: 31 May 2016, 09:10
by sandercox
My expectations of the behavior would be the same as Christian. The buffer is just filled with the number frames it needs next (if set to only forward buffer) or divide that between a backward buffer and a forward buffer. Maybe behavior could be different when loop flag is not set on the movie but not sure if that would be really expected.