Jump to content

Low FPS video drawing?


.:HyPeX:.

Recommended Posts

This was my experience with the CEF browser as well, which ultimately led to me not using it. Instead, I go with a less efficient method in terms of download size - but I can control what speed to draw it at.

You can render the video frames as .jpg files to minimize the size of the download. You can use my code if you'd like to try it out;

local currentFrame = 1; 
local currentImageFile = "Images/TTOFlag (1).jpg"; 
local animationStartTick = getTickCount(); 
  
-- Animated Flag Background 
function dxDrawAnimatedBackground() 
    local animationCurrentTick = getTickCount(); 
    local tickDifference = (((animationCurrentTick-animationStartTick) > 3600) and (animationCurrentTick-animationStartTick-(math.floor((animationCurrentTick-animationStartTick)/3600)*3600))) or animationCurrentTick-animationStartTick; 
    currentFrame = math.ceil(tickDifference/40)((tickDifference/40)+0.5) and math.ceil(tickDifference/40) or math.floor(tickDifference/40); 
    if(currentFrame == 0) then 
        currentFrame = 1; 
    end 
    currentImageFile = "Images/TTOFlag ("..tostring(currentFrame)..").jpg"; 
    dxDrawImage(0, 0, screenWidth, screenHeight, currentImageFile, 0, 0, 0, tocolor(255, 255, 255, 255)); 
end 

3600 should be the approximate length of the video. You then divide this number by the amount of frames in the video, in my case it's 90 frames.

So 3600/90 = 40 and I think you can spot where this number goes. :)

Outcome should be something like this;

Link to comment

Okay, so i got this working, but for some reason i get very big FPS drops on the first 1-4 loops (starting over), and this affects me becouse i just wanna draw one loop of out if, any idea on this?

PD: Just checked, this thingie makes the GTA process go from 800mb to 1800mb RAM usage :shock:

Link to comment

Yeah I said it's not very efficient :P It depends a lot on what format the pictures are. I highly recommend not going above 720p and a compressed jpg format.

For me it's only the first loop that lags, and that's because it stores it all in memory. You could also try making them a DXT1 DDS texture, which should use a lot less memory.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...