0

I'm trying to create a program that concatenates clips into one compilation and rescales them all to fill the full height of the frame (1920x1080).

The concatenation part works fine, and the program has no trouble making a compilation when given clip links, however, the 'resize' function is not being recognised:

Unresolved attribute reference 'resize' for class 'VideoFileClip'

As far as I know, I'm following the docs, I have PIL installed. Why doesn't it recognise 'resize'?

# Video Compiler
cliplist = []
count = 1
for filename in os.listdir(location):
    if filename.endswith(".mp4"):
        cliplist.insert(0, VideoFileClip(f'{Path(location)}/{filename}'))
        print(f'Clip {count} Processed')
        count += 1

for clip in cliplist:
    clip.resize(height=1080)

Note: this is just a snippet of the code, I see no reason why the resize function does not work here as 'clip' represents a VideoFileClip.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Coski
  • 43
  • 2
  • 8

2 Answers2

1

You need to import VideoFileClip from moviepy.editor for it to have the resize method.

This is being changed in v2.0 to be much more intuitive so that it always works: github.com/Zulko/moviepy/pull/1340

Tom Burrows
  • 2,225
  • 2
  • 29
  • 46
  • I added `from moviepy.editor import VideoFileClip, concatenate_videoclips`, and still no luck. Is that what you mean? @TomBurrows – Coski Oct 30 '20 at 05:49
1

Ok, so there was actually no issue. The static code checker that of the editor I use (PyCharm) was throwing out errors but when I ran the code it worked as intended.

Coski
  • 43
  • 2
  • 8