python - ffmpeg和moviepy:gif 转mp4

python moviepy:

import moviepy.editor as mp


if __name__ == "__main__":
    clip = mp.VideoFileClip("./upload_5F6ae68C8B3b.gif")
    clip.write_videofile("./myvideo.mp4")

ffmpeg:

import os

# 对ffmpeg版本有要求,老版本不支持部分转换,ffmpeg 4.4版本测试通过,3.4版本转换失败killed
# ffmpeg -i './gif_path.gif' -r 30 './mp4_path.mp4'
origin_full_save_path = './a.gif'
mp4_full_file_path = './b.mp4'

os.system(f"ffmpeg -f gif -i {origin_full_save_path} -r 30 {mp4_full_file_path}")

示例图片:

你可能感兴趣的:(gif转,moviepy,ffmpeg)