nihui / rife-ncnn-vulkan

RIFE, Real-Time Intermediate Flow Estimation for Video Frame Interpolation implemented with ncnn library
MIT License
821 stars 68 forks source link

frame count #67

Open kikoferrer opened 1 year ago

kikoferrer commented 1 year ago

Just want to confirm. If I use arguement -n, should I put N*8 for example if I want to interpolate the video 8 times? Is that how it works?

TNTwise commented 1 year ago

From my testing, you need to put the amount of frames * 8 for it to work in your specific case.

kikoferrer commented 1 year ago

From my testing, you need to put the amount of frames * 8 for it to work in your specific case.

Oohhhhh! I see! Thanks! Now my bash script works like a charm! Thanks again!

2blackbar commented 10 months ago

This is not correct, when you set it like this and will have 3 input frames then you will end up with 3rd frame getting reapeated multiple times at the end... they really dropped the ball with those multiplier calculations, its just plain dumb cause it could of been much much simple way

TNTwise commented 10 months ago

Pretty sure the third frame at the end gets repeated to keep the time the same, at least that's what I'm told.

2blackbar commented 10 months ago

ok i built the fix, you can download from here : i also will upload gui in bat file form ,its a python gui for this app so needs to be in same folder as the exe : https://github.com/2blackbar/rife-ncnn-vulkanfix/releases

kikoferrer commented 10 months ago

Soo...what should be the computation then?

2blackbar commented 10 months ago

What You want it to be? I can customise, i can make it so you specify number of inbetweens to generate between each input frames .

Actually there it is, replace code inside bat file, replace what starts from if output path till model name = model_name etc... easy to find inside generate command

So now if you want twice as much frames then set number to 1 to create 1 inbetween each input frame

if output_path:
    command += f' -o "{output_path}"'

num_inbetween_frames = num_frame_entry.get()

if num_inbetween_frames:
    num_input_frames = len([name for name in os.listdir(input_path) if os.path.isfile(os.path.join(input_path, name))])
    target_frame_count = num_input_frames + (int(num_inbetween_frames) * (num_input_frames - 1))
    command += f" -n {target_frame_count}"

time_step = time_step_entry.get()
if time_step:
    command += f" -s {time_step}"  # Include the time step in the command

model_name = model_name_var.get()

Now there is also this one, with this one you can simply tell it to multiply all input frames by this number So 2x 4x 7x or whatever and it will count all input frames and spit out proper amount of multiplied frames, so use this code below if you want that , so you will be able to set it like in first post here , you set it to 8 and it will do 8 times amount of all frames

frame_multiplier = num_frame_entry.get()

if frame_multiplier: num_input_frames = len([name for name in os.listdir(input_path) if os.path.isfile(os.path.join(input_path, name))]) target_frame_count = int(frame_multiplier) * num_input_frames command += f" -n {target_frame_count}"

kikoferrer commented 10 months ago

Cool thanks! Imma try this later when i get home. I use linux so I am not sure a bat file will work on my case but i will give it a try. Thanks

TNTwise commented 10 months ago

Cool thanks! Imma try this later when i get home. I use linux so I am not sure a bat file will work on my case but i will give it a try. Thanks

Could use my project and replace the binary https://github.com/TNTwise/REAL-Video-Enhancer

Edit: recompiled for Linux, MacOS, and Windows: https://github.com/TNTwise/rife-ncnn-vulkan/releases/tag/20240102-frame-count-patch