While trying to write a video clip to a file, I get the BrokenPipeError with the following message :
b"Unknown encoder 'libmp3lame'\n"
The audio export failed because FFMPEG didn't find the specified codec for audio encoding (libmp3lame). Please install this codec or change the codec when calling to_videofile or to_audiofile. For instance for mp3:
>>> to_videofile('myvid.mp4', audio_codec='libmp3lame')
Now I assume that I have to install the libmp3lame codec, but I don't know how to install it.
I have libmp3lame0 installed (using command sudo apt-get install libmp3lame0. ), but when I tried to use it, it shows the following error:
'ValueError: The audio_codec you chose is unknown by MoviePy. You should report this. In the meantime, you can specify a temp_audiofile with the right extension in write_videofile.'
I am using Ubuntu 17.04, with miniconda environment. Please help out!
I was able to run the program by using 'aac' audio codec clip.subclip(t_start, t_end).write_videofile(output, fps=video.frame_rate,audio_codec='aac')
But, will it make any difference, since the error message clearly says to use 'libmp3lame' codec for audio?
Same here
Changing audio_code to 'aac' helped.
But afterwards I faced b"Unknown encoder 'libx264'\n". Helped additionally to do codec='mpeg4'
If you are trying to use codec libmp3lame0, then it failed because moviepy could not work out that it was an mp3 codec, so it suggested specifying temp_audiofile with a .mp3 extension, which would have worked. Alternatively, create/suggest a change to extensions_dict in moviepy/tools.py, so that it can be automatically recognised.
Most helpful comment
I was able to run the program by using 'aac' audio codec
clip.subclip(t_start, t_end).write_videofile(output, fps=video.frame_rate,audio_codec='aac')But, will it make any difference, since the error message clearly says to use 'libmp3lame' codec for audio?