Implement real-time video logging
Closed this issue · 2 comments
Investigate whether this is possible
Likely there is some open-source work that does this
In the worst case we might have to implement it?
Update: I figured out how to do this.
The README.md has instructions on using python -m utils.record_video
to take a video of the simulation.
This produces a .mp4
file with a default 30fps frame rate.
To achieve real-time rendering, I used ffmpeg to increase the frame rate to 1000 fps. This is based on 1 / 0.001 simulation time step.
The command to do so is:
ffmpeg -i input.mp4 -r <OUTPUT_FPS> -filter:v "setpts=<RATIO>*PTS" output.mp4
where RATIO = INPUT_FPS / OUTPUT_FPS
Reference: https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
Update:
I realized that python -m utils.record_video
is already doing a real time video (or close enough).
This is because the env_time_step
is different from the sim_time_step
. By default the former is 33x the latter (so 0.033s).
Doing some basic accounting. a 1000 frame video should thus last 33 seconds, and the actual video we got is 32 seconds. So it's real time, or close enough.
In summary:
python -m utils.record_video
is enough to get a real time video