ArdenButterfield / stammer

Recreate any audio track by rearranging the frames of another video
MIT License
434 stars 29 forks source link

line 171 file not found error. "No such file or directory frames\\frame12345.png" #40

Closed earo16 closed 1 year ago

earo16 commented 1 year ago

line 171 causes an issue where it tries to find a frame that doesn't exist

        shutil.copy(frames_dir / f'frame{match_num+1:06d}.png', outframes_dir / f'frame{i:06d}.png')

it's the "match_num+1" part. When it builds the output video-- if it points to the last frame in the frames temp folder, it tries to copy over a frame after that last frame, but it doesn't exist, and so it aborts the whole operation

I tried just removing the +1 from right there, but then it looks for frame000000 in the frames folder. So, I modified it to just copy frame000001 as frame000000

at line 169 I modified the code to be

shutil.copy(frames_dir / f'frame000001.png', frames_dir / f'frame000000.png')     //added this line to copy the frame

if type(best_matches) == list:
    for i, match_num in enumerate(best_matches):
        shutil.copy(frames_dir / f'frame{match_num:06d}.png', outframes_dir / f'frame{i:06d}.png')

I don't know Python like at all but this seems to have fixed the error for me

brilliant program, by the way. I love this thing. This is great

GarfQC commented 4 months ago

I tried doing that with what you used, but then it gives me:

Traceback (most recent call last):
  File "stammer.py", line 171, in <module>
    if type(best_matches) == list:
NameError: name 'best_matches' is not defined

did I do something wrong? how did you insert it?