Repository: pytorch/rl

Issue:
[BUG] VideoRecorder Crashes When Passing fps
## Describe the bug
Creating an instance of `VideoRecorder` crashes when we pass `fps`.

## To Reproduce
```python
from torchrl.record import VideoRecorder
VideoRecorder(None, None, "", None, fps=1)
```  
```bash
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mila/b/browna/.conda/envs/maniskill3_env/lib/python3.10/site-packages/torchrl/record/recorder.py", line 127, in __init__
    self.video_kwargs["fps"] = fps
  File "/home/mila/b/browna/.conda/envs/maniskill3_env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1928, in __getattr__
    raise AttributeError(
AttributeError: 'VideoRecorder' object has no attribute 'video_kwargs'
```
## Expected behavior
No crash  

## System info

Describe the characteristic of your environment:
 * Describe how the library was installed (pip, source, ...) `torchrl==0.7.1`
 * Python version `3.10`

```python
print(torchrl.__version__, numpy.__version__, sys.version, sys.platform)
0.7.1 1.26.4 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] linux
```

## Checklist

- [x] I have checked that there is no similar issue in the repo (**required**)
- [x] I have read the [documentation](https://github.com/pytorch/rl/tree/main/docs/) (**required**)
- [x] I have provided a minimal working example to reproduce the bug (**required**)

Hints from issue comments:

Solution patch:
diff --git a/torchrl/record/recorder.py b/torchrl/record/recorder.py
index c2cf93dd1..37d905c9a 100644
--- a/torchrl/record/recorder.py
+++ b/torchrl/record/recorder.py
@@ -121,7 +121,7 @@ class VideoRecorder(ObservationTransform):
         video_kwargs = {}
         video_kwargs.update(kwargs)
         if fps is not None:
-            self.video_kwargs["fps"] = fps
+            video_kwargs["fps"] = fps
         self.video_kwargs = video_kwargs
         self.iter = 0
         self.skip = skip


Test patch:
diff --git a/test/test_transforms.py b/test/test_transforms.py
index 38ecc81a5..fd3d6676f 100644
--- a/test/test_transforms.py
+++ b/test/test_transforms.py
@@ -131,6 +131,7 @@ from torchrl.envs.transforms.vip import _VIPNet, VIPRewardTransform
 from torchrl.envs.utils import check_env_specs, MarlGroupMapType, step_mdp
 from torchrl.modules import GRUModule, LSTMModule, MLP, ProbabilisticActor, TanhNormal
 from torchrl.modules.utils import get_primers_from_module
+from torchrl.record.recorder import VideoRecorder
 
 if os.getenv("PYTORCH_TEST_FBCODE"):
     from pytorch.rl.test._utils_internal import (  # noqa
@@ -13978,6 +13979,14 @@ class TestTimer(TransformBase):
         raise pytest.skip("Tested elsewhere")
 
 
+class TestVideoRecorder:
+    # TODO: add more tests
+    def test_can_init_with_fps(self):
+        recorder = VideoRecorder(None, None, fps=30)
+
+        assert recorder is not None
+
+
 if __name__ == "__main__":
     args, unknown = argparse.ArgumentParser().parse_known_args()
     pytest.main([__file__, "--capture", "no", "--exitfirst"] + unknown)