How to convert video to memory with moviepy?

Asked

Viewed 56 times

0

I’m converting videos into python and I’m using the moviepy library. I’m using the instructions:

clip = VideoFileClip('/home/developer/Pictures/aa.mov')
clip.write_videofile('/home/developer/Pictures/aa.mp4') 

And it is working perfectly, however as my application does not receive the image via path file I am having difficulties in converting the file. In case I’m trying to load the file in memory and convert it:

img = open('/home/developer/Pictures/aa.mov','rb').read()
clip = VideoFileClip(img)
clip.write_videofile('/home/developer/Pictures/aa.mp4')

[1] TypeError: 'str' object is not callable

That doesn’t work because VideoFileClip just accepts the image path, there is some way to convert the video by loading the video in memory?

  • 1

    It was not clear why you need to load the video in memory. To use open you need the path of the video, so why not go straight to VideoFileClip?

  • Because I get the entire file by paramentro, I don’t get it via stream.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.