How force GLMediaPlayer not to depend on machine time

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How force GLMediaPlayer not to depend on machine time

Ertong
I'm trying to build a video renderer using jogl.

The target FPS of the video is fixed (25, for example).
But rendering speed can be different.
So, for example, if rendering FPS is 100, I can render 60 sec video in 60*25/100=15 sec.

In this case I cannot rely on the system time, and my display() method should calculate it's own "time".
E.g. if we are rendering the frame #100, display() should build the scene that is expected to be seen at 100/25=4th second of the resulting video.

Well, now I'm trying to use GLMediaPlayer for including embedded video to the scene.
But getNextTexture is hard-coded to use system time.
And in the end, the resulting video contains the embedded video with wrong playing speed.

There is setPlaySpeed() method, but it is good only if rendering FPS is constant, but it is not true in reality.

I've tried to use seek(), but it is not working properly being called on every display().

I've tried to subclass FFMPEGMediaPlayer, but there are too much private fields.

In this case it would be logical to implement getNextTexture(long time) somehow, where time is the time form embedded  video beginning.

Is it possible to do without affecting library code?
Reply | Threaded
Open this post in threaded view
|

Re: How force GLMediaPlayer not to depend on machine time

Sven Gothel
Administrator
On 12/29/2013 04:24 PM, Ertong [via jogamp] wrote:

> I'm trying to build a video renderer using jogl.
>
> The target FPS of the video is fixed (25, for example).
> But rendering speed can be different.
> So, for example, if rendering FPS is 100, I can render 60 sec video in
> 60*25/100=15 sec.
>
> In this case I cannot rely on the system time, and my display() method should
> calculate it's own "time".
> E.g. if we are rendering the frame #100, display() should build the scene that
> is expected to be seen at 100/25=4th second of the resulting video.
>
> Well, now I'm trying to use GLMediaPlayer for including embedded video to the
> scene.
> But getNextTexture is hard-coded to use system time.
> And in the end, the resulting video contains the embedded video with wrong
> playing speed.
GLMediaPlayer currently 'plays' video in 'real time' not 'machine time',
i.e. getNextTexture either returns the frame for the current
real time window, which might be either the last frame or the 'next' frame.

If I understand you properly, you like to _not_ play in real time
or a multiple of it (play speed), but simply get the next frame
and render it at your leisure ?
I.e. for saving each frame or editing it .. etc ?

Please create a bug entry (enhancement) and we will can take care of it.

I also have thought about such enhancement, i.e. how to use it for
video editing.

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How force GLMediaPlayer not to depend on machine time

Ertong