In the experiment of using gym environment to train the agent and save the video locally, an error was encountered when using monitor to save the video:
Unknown encoder 'libx264'
Considering that the video saved in gym is saved in ffmpeg, I reinstalled it, but still reported an error. Then yes
check the original codes ofwrappers.Monitor
Here we judge the selection method, so we can choose other encoders to save our video. We just need to install CONDA, uninstall ffmpeg, and then use other options
import pkgutil
import distutils.spawn
import imageio_ffmpeg
print(distutils.spawn.find_executable("avconv"))
print(distutils.spawn.find_executable("ffmpeg"))
print(pkgutil.find_loader("imageio_ffmpeg"))
print(imageio_ffmpeg.get_ffmpeg_exe())
In my case, after I uninstall ffmpeg in CONDA, what gym calls becomes ffmpeg installed in Ubuntu, and then it can run.