【Python】動画と音声の合成がしたい
import moviepy.editor as mp
clip = mp.VideoFileClip('video.mp4').subclip()
clip.write_videofile('synthesis.mp4', audio='voice.mp3')
以上のコードで動画と音声の合成を行おうと思っているのですが以下のようなエラーが表示されます。
OSError: [Errno 32] Broken pipe
MoviePy error: FFMPEG encountered the following error while writing file result0.mp4:
b'[mp4 @ 0x7fb5c4838200] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container\nCould not write header for output file #0 (incorrect codec parameters ?): Invalid argument\nError initializing output stream 0:0 -- \n'
The video export failed, possibly because the codec specified for the video (libx264) is not compatible with the given extension (mp4). Please specify a valid 'codec' argument in write_videofile. This would be 'libx264' or 'mpeg4' for mp4, 'libtheora' for ogv, 'libvpx for webm. Another possible reason is that the audio codec was not compatible with the video codec. For instance the video extensions 'ogv' and 'webm' only allow 'libvorbis' (default) as avideo codec.
原因と対処法について知りたいです
0