nihui / rife-ncnn-vulkan

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

Resume interpolation job based on existing frames generated #36

Open sanchezelton opened 2 years ago

sanchezelton commented 2 years ago

Some of the video files that may be worked with may be incredibly large, gigs of data. As a user, in order to deal with situations where time might be otherwise wasted by a system crash or the system must go offline, I want rife-nccc-vulkan to resume the job from the last fully generated interpolated frame when running:

mkdir input_frames
mkdir output_frames

# find the source fps and format with ffprobe, for example 24fps, AAC
ffprobe input.mp4

# extract audio
ffmpeg -i input.mp4 -vn -acodec copy audio.m4a

# decode all frames
ffmpeg -i input.mp4 input_frames/frame_%08d.png

# interpolate 2x frame count
./rife-ncnn-vulkan -i input_frames -o output_frames

If the above command for rife-ncnn-vulkan is run in verbose mode and terminated early (with Ctrl-C), then run again, at current ALL frames are regenerated a second time although the existing frames (except for the last one, which should be regenerated).

KeygenLLC commented 2 years ago

Yes, this would be very useful for those of us who work with a lot of data and large videos.

I use uncompressed image sequences and it would be nice to have some kind of --keep flag, or --ignore (existing).

Could also allow setting which frame to specifically resume on with an int: ./rife-ncnn-vulkan -i input_frames -o output_frames --keep --resume 01257

Actually, you could simplify it by the use of one --resume flag that will automatically ignore the last frame, or only overwrite the last frame generated to make sure it wasn't corrupted. I would opt for the overwrite of the last frame, standard or as an option, in case someone needs to start overwriting earlier in the sequence for some reason. It would save time not having to manually trash files. ./rife-ncnn-vulkan -i input_frames -o output_frames --resume ./rife-ncnn-vulkan -i input_frames -o output_frames --resume 01257 ./rife-ncnn-vulkan -i input_frames -o output_frames --resume 01257 --overwrite

Not sure if this could work in arguments... ./rife-ncnn-vulkan -i input_frames -o output_frames --resume 01257,overwrite or ./rife-ncnn-vulkan -i input_frames -o output_frames --resume "01257 overwrite"