nihui / dain-ncnn-vulkan

DAIN, Depth-Aware Video Frame Interpolation implemented with ncnn library
MIT License
507 stars 44 forks source link

DAIN on MAC #13

Open ivg-design opened 3 years ago

ivg-design commented 3 years ago

Hi there!

I realize this is not technically an "issue" but perhaps you could find the time (and interest) to help out!

I have been reading about DAIN and its possibilities and I am very eager to use it, however, I have several obstacles:

  1. I only have a mac
  2. I am a complete noob at anything programming/coding related - I am designer/animator

So while your project solves issue number 1 :), I am still having a huge problem with issue number 2- i have tried to get it to work but I have no idea how to - I downloaded vulkan SDK from their site and the MacOSX actions from here - however I can't even open it - I am not sure how to make it work - Please help me - if you could provide a step by step guide for dummies like myself, I would be eternally greatful!

Thanks in advance!

Mar2ck commented 3 years ago

You don't need the vulkan sdk since that's just for development

It's a terminal program so you'll need some basic terminal knowledge, eg. you'll need to cd into the dain folder first

ivg-design commented 3 years ago

Thank you very much for your reply... I have tried that and I get the message - "permission denied" prompt Screen Shot 2020-09-24 at 22 01 39

nihui commented 3 years ago

chmod +x dain-ncnn-vulkan

ivg-design commented 3 years ago

Thank you so much it seems to be working now! but it still is in command line interface.. so perhaps you could point me in the right direction - so I have a m4v file that it at 25fps and I want to make it 60fps - can I use that? or I need an actual image sequence?

Mar2ck commented 3 years ago

You'll need something like ffmpeg to extract the video to images. ffmpeg -i input.m4v output/%06d.png for example would extract the frames into a folder called output

ivg-design commented 3 years ago

Thanks @Mar2ck!

I do have a folder with an image sequence already - its rather big since I have just upconverted a 58min video at 25fps to 4k...(around 87k frames) so I can use that... the only questions is how... :)

Mar2ck commented 3 years ago

All you need is to use the -i and -o options and dain-ncnn will generate double the frames automatically. ./dain-ncnn-vulkan -i "[Path to input folder]" -o "[Path to output folder]"

Also consider using cain-ncnn instead, it's a very similar program but it is much faster and uses a lot less video memory. 87k frames will take a lifetime with dain-ncnn

ivg-design commented 3 years ago

how would I specify a framerate? and since it is using GPU (and I have a 16gb AMD card) how long do you think it might take ? several days?

Mar2ck commented 3 years ago

It depends on resolution, you can use the -v option to see frames as theyre being made. The program will just double the frames so you'll have 50fps afterwards. If you want a higher framerate you'll need to run it again to get 100 fps and use ffmpeg to reduce the framerate from there. Dain-ncnn has the option -n which can let you interpolate 25fps -> 60fps directly but like i said you should really use Cain-ncnn or you'll never finish

Btw if by "upconvert" you mean that you're upscaling the resolution, you should try interpolating the frames first then upscaling the resolution after as that'll be much faster

ivg-design commented 3 years ago

I think that ship has sailed for me :) I have already finished the upscaling - took around 40hrs... and I did not realize that you can’t pick the framerate... that really will make this much more complicated

ivg-design commented 3 years ago

Hold on - but it says -n num-frame target frame count (default=N*2)

Doesn’t that mean I can pick a framerate to be 60fps?

Mar2ck commented 3 years ago

It's not that hard if you use ffmpeg. Once youve got your frames at 100fps and for example wanted them at 60fps you could use ffmpeg -framerate 100 -i 100fps/%06d.png -vf framerate=fps=60 output-60.mp4

Yes -n lets you multiply by any amount but cain-ncnn doesn't have it and using dain-ncnn is completely impractical for your situation

ivg-design commented 3 years ago

Thanks! I will try both and see if what works! but if you can tell me, for dain-ncnn how should I write the -n parameter -n 60 or how?

Mar2ck commented 3 years ago

-n takes an amount of frames to output not a framerate.

However you'll need to swap 87,000 with the exact number of frames you have or it wont make exactly 60 fps.

ivg-design commented 3 years ago

Thanks! that is very much appreciated!

BahzBeih commented 3 years ago

All you need is to use the -i and -o options and dain-ncnn will generate double the frames automatically. ./dain-ncnn-vulkan -i "[Path to input folder]" -o "[Path to output folder]"

Also consider using cain-ncnn instead, it's a very similar program but it is much faster and uses a lot less video memory. 87k frames will take a lifetime with dain-ncnn

thanks I tried the program and it's much faster but I wonder if there is quality loss when I use "cain-ncnn" instead of "dain-ncnn"

Mar2ck commented 3 years ago

@BahzBeih You'll have to judge for yourself, they're pretty similar. In my experience Cain seems more blurry in motion whereas Dain has more noticeable artifacting when it doesn't know how to track movement

ivg-design commented 3 years ago

So I can't for the life of me figure out the correct syntax for launching this... I use the following commands: ./dain-ncnn-vulkan -i"/Volumes/CACHES\ SSD/wedding\ Upconversion/DAIN\ TEST" -o"/Volumes/CACHES\ SSD/wedding\ Upconversion/DAIN\ TEST\ OUTPUT " -n 3600
and i get the error "invalid outputpath extension type"

what am I doing wrong?

Mar2ck commented 3 years ago

Try ./dain-ncnn-vulkan -i "/Volumes/CACHES SSD/wedding Upconversion/DAIN TEST/" -o "/Volumes/CACHES SSD/wedding Upconversion/DAIN TEST OUTPUT/" -n 3600 if the path is in quotes it doesnt need backslashes before spaces

ivg-design commented 3 years ago

Thanks @Mar2ck! with your help i figured it out i just took out the quotes and then added -f jpg -v in the end and its all working... but DAMN it is slow! @Mar2ck you were absolutely correct - it outputs 1 image per minute, whereas CAIN outputs 16 frames per minute... so yeah huge improvement... so I am testing it now on 1 min of footage (1500 frames) and will see what kind of result I will get...

Mar2ck commented 3 years ago

@woozygoozy No problem. You can get it to process faster by using -j 1:1:1 and using the -t option. Try setting -t as high as your mac can handle before it starts giving you "vkQueueSubmit failed" or "vkAllocateMemory failed"