小编mar*_*e23的帖子

Python 未知文件扩展名 .mp4

我正在开展一个模拟项目,但是我无法创建视觉效果。我首先运行 matplotlib 文档中的代码(即该代码不属于我)。\n当我运行代码时,收到错误“未知文件扩展名:.mp4”。\n我已经安装了 ffmpeg 并检查它是否是更新版本。

\n\n

我使用的是 Windows 计算机和 Python 3。

\n\n
import numpy as np\nfrom matplotlib import pyplot as plt\nfrom matplotlib import animation\nplt.rcParams[\'animation.ffmpeg_path\']=\'\xe2\x80\xaaC:\\\\FFmpeg\\bin\\ffmpeg.exe\'\n\n# First set up the figure, the axis, and the plot element we want to animate\nfig = plt.figure()\nax = plt.axes(xlim=(0, 2), ylim=(-2, 2))\nline, = ax.plot([], [], lw=2)\n\n# initialization function: plot the background of each frame\ndef init():\n    line.set_data([], [])\n    return line,\n\n# animation function.  This is called sequentially\ndef animate(i):\n    x = np.linspace(0, 2, 1000)\n    y = np.sin(2 * np.pi …
Run Code Online (Sandbox Code Playgroud)

python ffmpeg matplotlib

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

ffmpeg ×1

matplotlib ×1

python ×1