libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
147 stars 50 forks source link

Framerate issues on Desktop (mp4 video) #29

Closed MaximilianWang closed 1 year ago

MaximilianWang commented 8 years ago

Hello,

I am currently experiencing framerate issues when playing mp4 videos on desktop. At first I thought it was a decoding speed issue but when i commented out the line showAlreadyDecodedFrame = true; At the bottom of the render function in VideoPlayerDesktop and then play the video then the video renders very smoothly (albeit at fast forward pace of 60 ish frames per second).

I understand that the variable showAlreadyDecodedFrame is being used to try to play the videos at the framerate they should be at (25 fps or whatever) my syncing the video play time via frame timestamp and the application play time but it seems I am just getting jerky video. Is there any code tweak recommendations you can make regarding this to make the playback timing sync smoother?

Regards,

N

RBogie commented 8 years ago

23 seems similar to this. I'm going to investigate it a bit more when I have some free time. Unfortunately, that might be some weeks, because I'm very busy lately.

Is your CPU fully utilized? Or is it jerky while not using all resources it can? It could just be that the cpu you're running on can't handle the file with the software decoding used by ffmpeg. A solution would be using hardware acceleration for decoding probably. I'll have to figure out licenses for this though (Which takes a lot of time...).

dasisdormax commented 1 year ago

I don't know if it is the same problem, but during development of #77, I also noticed non-smooth video playback, especially for low-framerate video. Of two video frames, one was be displayed shortly, while the other was visible for much longer. This way, the video still had the correct overall speed, but didn't 'feel right' to watch. In my branch, that was fixed by changing the getCurrentFrameTimestamp function.