Comments (12)
I got this error with Ubuntu 18.04 while using Monitor class in OpenAI Gym. You need correct versions of ffmpeg and x264 encoder. To get them, I used following and it worked:
conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge
from gym.
In 2019, the solution by @sytelus down 2 comments is what worked for me. He has exact versions which work well! Leaving this comment for context only
For those using conda (and my future self,) I solved a similar issue by:
-
Installing x264:
conda install x264
-
Upgrading ffmpeg:
conda install ffmpeg==4.0
from gym.
This error also happens on OS X 10.11.6 (El Capitan). In that case, the solution is to reinstall ffmpeg with the -x265 (not -x264...) library:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
(From the ffmpeg docs, though I had to get rid of --with-libass
to get this to work.)
from gym.
I'm slightly surprised that there isn't a nicer error message for you, but does using the xvfb command recommended here help: https://gist.github.com/joschu/e42a050b1eb5cfbb1fdc667c3450467a?
I'll re-open the other issue so we can chat there about readability. Sorry, think we missed that the first time around!
from gym.
Most likely ffmpeg is failing. Can you try this:
dd if=/dev/zero bs=750000 count=50 | ffmpeg -nostats -loglevel error -y -r 60 -f rawvideo -s:v 500x500 -pix_fmt 'rgb24' -i /dev/stdin -vcodec libx264 -pix_fmt yuv420p /tmp/foo.mp4
and see if it's able to generate a /tmp/foo.mp4 video file (of all black pixels). If not, the error message should give a clue.
from gym.
Thanks a lot. It said id doesn't know about libx264.
dd if=/dev/zero bs=750000 count=50 | ffmpeg -nostats -loglevel error -y -r 60 -f rawvideo -s:v 500x500 -pix_fmt 'rgb24' -i /dev/stdin -vcodec libx264 -pix_fmt yuv420p /tmp/foo.mp4
Unknown encoder 'libx264'
This did not help (still getting the same error)
sudo apt-get update
sudo apt-get install libav-tools
sudo apt-get install libavcodec-extra-53
However, doing the same thing with avconv worked
dd if=/dev/zero bs=750000 count=50 | avconv -nostats -loglevel error -y -r 60 -f rawvideo -s:v 500x500 -pix_fmt 'rgb24' -i /dev/stdin -vcodec libx264 -pix_fmt yuv420p /tmp/foo.mp4
50+0 records in
50+0 records out
37500000 bytes (38 MB) copied, 0,141512 s, 265 MB/s
Yet the error in the game monitoring stays the same.
It may actually be due to weirdness of that server, so if you have no idea why such behaviour may happen and no one can reproduce it, i believe it's worth simply closing the thing.
from gym.
The video_recorder logic is
if distutils.spawn.find_executable('ffmpeg') is not None:
self.backend = 'ffmpeg'
elif distutils.spawn.find_executable('avconv') is not None:
self.backend = 'avconv'
Try deleting the ffmpeg executable so it will use avconv instead. Use:
sudo apt-get remove ffmpeg
I suspect we should prefer avconv over ffmpeg, since it is more predictable.
from gym.
Thank you, that finally worked 👍
from gym.
In case this helps someone, this issue got resolved for me by specifying ffmpeg>4.1
in my environment.yml
file (using conda
). It installed 4.1.3
. My gym
version is 0.12.1
.
Before this I had ffmpeg 4.0
which didn't work.
from gym.
I get the same error with Ray RLlib when setting the video recording on.
I tried both methods, i.e. conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge
(and also the newer versions), as well as installing x265
instead of x264
.
Both method worked for me in the sense that I don't get the error any more. However, many of the recorded videos are corrupted and cannot be played. I am wondering if people may have experienced the same problem? any suggestion to fix this later issue?
EDIT: Source of my problem should be something else. I tested these in a container and all worked fine.
from gym.
I encountered this issue again after updating packages.
It works with: ffmpeg=4.2.2
, x264=1!157.20191217
, gym=0.17.3
.
The problem occurred with ffmpeg=4.3
and disappeared when downgrading to 4.2.2
.
from gym.
I got this error with Ubuntu 18.04 while using Monitor class in OpenAI Gym. You need correct versions of ffmpeg and x264 encoder. To get them, I used following and it worked:
conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge
This works for gym==0.18.3 python==3.7.10 torch=1.7.1 with Ubuntu 20.04.
from gym.
Related Issues (20)
- [Bug Report] Getting Error from "D:\PongDQN_RL\venv\lib\site-packages\gym\wrappers\compatibility.py" HOT 12
- [Question] Custom dtype in observation space
- [Bug Report] pusher-v4 in the environment doesn't collide the object for the fork HOT 1
- [Question] How to verify who is the winner of a game? HOT 3
- [bug] OpenAI gym set_level(50) not disabling logs HOT 1
- [Bug Report] Humanoidv4 doesnt include contact_cost in code, but still present in documentation HOT 4
- [Question] I am implementing a DQN on Atari. I have some shape related problems. HOT 1
- [Question] MUJOCO environment info ERROR in the gym documentation website HOT 3
- [Question] How do I edit the leaderboard? HOT 1
- [Question] AsyncVectorEnv getting hung up as `pip.recv()` not returning anything for `_check_observation_spaces` HOT 4
- [Question] Question title
- gym.error.UnregisteredEnv: No registered env with id: meme-v0 HOT 1
- AttributeError: attempted to get missing private attribute '_domain_file' HOT 2
- ModuleNotFoundError: No module named 'gym.envs.atari' HOT 4
- [Bug Report] When call a base64.b64encode() on a Box observation_space, the programme shut down without Error
- Problem in render_mode HOT 1
- Error related to import gym HOT 4
- [bug] EOF error with gym.vector.AsyncVectorEnv() when calling the step method. HOT 1
- trying to use mujoco env
- [Question] Install gym 0.19.0 on google colab. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gym.