Search code examples
pythonraspberry-piraspbianmoviepy

Moviepy - TypeError: Can't convert 'bytes' object to str implicitly


from moviepy.editor import *
clip = VideoFileClip("vid.mov")
clip.write_videofile("movie.mp4")

^ Gives the error

TypeError: Can't convert 'bytes' object to str implicitly.

It prints "Building video movie.mp4" and "Writing audio in movieTEMP_MPY_wvf_snd.mp3" normally.

I am using python 3.2 with Raspian Wheezy. What is wrong? Surely it should be a simple program...

EDIT: If you add audio = false to the write_videofile parameters, it works fine. The problem is somewhere in the audio.


Solution

  • As per this answer, the issue was that there is an error in the moviepy script which generates an incorrect error output. The correct output indicates that I had not install the libmp3lame codec when I installed ffmpeg, so it could not write audio. See this question for details on how to correctly install ffmpeg with aforementioned codec.