0

I'm new to moviepy my requirement is to make a normal video into 2x. All the videos are recorded on the phone and the videos which are not required any rotations are working fine. By the videos which are needed to be rotated even, I apply rotation or even just trying to write the outup is zoomed in with full screen here is the code

from moviepy.editor import VideoFileClip

from moviepy.audio import *

import moviepy.video.fx.all as vfx

clip = VideoFileClip("testingggg.mp4",audio=False) 

clip.size

#clip = clip.rotate(90) 

print("Duration of video : ", clip.duration)

print("Duration of video : ", clip.reader.fps)

clip = clip.speedx(2)

#clip = VideoFileClip("final.mp4",audio=False) 

#clip.size


clip.write_videofile("final.mp4", threads=4, audio_fps=44100,codec = 'libx264')

hope someone can help me here are some images so that u can get an idea on my issue image of original file output is in this way Thank you

Education 4Fun
  • 176
  • 3
  • 16

1 Answers1

0

It's because your original_video is not 1920x1080. you can use resize((1920, 1080)) to convert the Resolution to 1080p.

clip1 = clip.speedx(0.5).resize([1920, 1080])

try those code:


    
from moviepy.editor import *
import time as tt

# your fpath
fpath =  "C:\\Users\\Administrator\\Desktop\\crawl\\videos\\Cat doesn't finish Vegetables-736fiBMtADg\\Cat doesn't finish Vegetables-736fiBMtADg.mp4"

clip = VideoFileClip(fpath)
print('clip.size: ', clip.size)
# [720, 720]

print("Duration of video : ", clip.duration)
print("Duration of video : ", clip.reader.fps)

clip1 = clip.speedx(0.5).resize([1920, 1080])
print('clip1.size: ', clip.size)
# [1920, 1080]
print("Duration of clip1 : ", clip1.duration)
print("Duration of clip1 : ", clip1.reader.fps)


tmp_mp4 = '__temp__.mp4'        # temporary file

clip1.write_videofile(tmp_mp4)
tt.sleep(0.5)
os.system('explorer ' + tmp_mp4)    # open the file: tmp_mp4.
bode liang
  • 119
  • 3