n00mkrad / flowframes

Flowframes Windows GUI for video interpolation using DAIN (NCNN) or RIFE (CUDA/NCNN)
GNU General Public License v3.0
1.54k stars 117 forks source link

Image order gets scrambled and HDR weirdness when setting temp directory to network share #57

Open patrickmollohan opened 3 years ago

patrickmollohan commented 3 years ago

I'm attempting to interpolate a few larger videos of mine which will require the larger storage space on my NAS. I have a Samba share mounted and mapped to my Z: drive and have full permissions for that share. Using the free itch.io build (1.24.6) as well as building Flowframes myself from the latest commit on GitHub (8e14c6118655598e65f96d713b26b9f3eb1d7c7c), there are two strange issues that occur with using a temp directory on that SMB share (either setting it manually or having it set to be in the same directory as the video itself, stored on the share).

The first issue is the order of the video frames get scrambled after extraction. During the extraction phase, the frames in the temp folder are in the correct order, and all should be well. However, after it's finished extracting the frames, it performs the step "Generating frame order information" and scrambles the images. It seems to interweave frames from the first and second half of the video, where the first half of the frames has nine digits and the second half has eight digits in the file name. Once it's finished generating the frame order information, the frames are all renamed back to eight digits. It then performs the interpolation with the incorrect order, generating bad (although hilarious) frames. This is for normal SDR videos.

For HDR videos, it will extract frames that, when opened in the default image viewer in Windows, appears vibrant at first as it should, then becomes dull as it finishes loading. I'm able to recreate this with ffmpeg by running the command:

ffmpeg -i .\CH04.mkv -r 24000/1001 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -profile:v main10 -pix_fmt yuv420p10le %08d.png

I don't believe this is a bug itself, just how HDR frames are being extracted. Nevertheless, it initially extracts fine and in the correct order, but gets scrambled same as above. However, in addition to this, when it does the interpolation, it will simply copy each frame from the "frames" directory (no interpolation performed at all) without the HDR colour information. Additionally, it will generate an entirely black frame every other frame.

Both issues only occur when the temp directory is on the SMB share. I've attempted this on different videos from different sources, and this is repeatable. When those same videos are processed with the temp directory on my HDD, all works as it should.

n00mkrad commented 3 years ago

This is possibly caused by the file system not being sorted. Will look into it.

However I can generally not recommend interpolating on a network drive.

patrickmollohan commented 3 years ago

@n00mkrad thank you very much for taking a look into it. For the time being, I have split the movies into their chapters and will process smaller sections on my HDD, but it would be really great if you can get it working for network drives. I appreciate the time and effort creating this tool; it's been really fun so far seeing what it can do!