Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RSDK-9573] Autodetect height and width of source cam in video store #32

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

hexbabe
Copy link
Collaborator

@hexbabe hexbabe commented Dec 18, 2024

RSDK-9573

Tested with config:

{
  "components": [
    {
      "name": "webcam-cam",
      "namespace": "rdk",
      "type": "camera",
      "model": "webcam",
      "attributes": {
        "video_path": "FDF90FEB-59E5-4FCF-AABD-DA03C4E19BFB"
      }
    },
    {
      "name": "transform-cam",
      "namespace": "rdk",
      "type": "camera",
      "model": "transform",
      "attributes": {
        "pipeline": [
          {
            "attributes": {
              "y_max_px": 0.4,
              "x_min_px": 0.3,
              "y_min_px": 0.2,
              "x_max_px": 0.6
            },
            "type": "crop"
          },
          {
            "type": "rotate",
            "attributes": {
              "angle_degs": 270
            }
          }
        ],
        "source": "webcam-cam"
      }
    },
    {
      "name": "rtsp-cam-1",
      "namespace": "rdk",
      "type": "camera",
      "model": "viam:viamrtsp:rtsp",
      "attributes": {
        "rtsp_address": "rtsp://localhost:8554/live.stream"
      }
    },
    {
      "name": "video-store-comp",
      "namespace": "rdk",
      "type": "camera",
      "model": "viam:video:storage",
      "attributes": {
        "storage": {
          "segment_seconds": 10,
          "size_gb": 1
        },
        "cam_props": {
          "framerate": 20
        },
        "camera": "rtsp-cam-1",
        "sync": "data"
      },
      "depends_on": [
        "data"
      ]
    }
  ],
  "services": [
    {
      "name": "data",
      "namespace": "rdk",
      "type": "data_manager",
      "attributes": {
        "capture_dir": "/users/seanyu/Downloads/video-store",
        "tags": [],
        "additional_sync_paths": [
          "/users/seanyu/Downloads/video-store"
        ],
        "sync_disabled": false,
        "sync_interval_mins": 0.1
      }
    }
  ],
  "modules": [
    {
      "type": "local",
      "name": "local-viamrtsp-mod",
      "executable_path": "/Users/seanyu/Projects/sean-viamrtsp/bin/darwin-arm64/viamrtsp"
    },
    {
      "type": "local",
      "name": "local-video-store-mod",
      "executable_path": "/Users/seanyu/Projects/sean-video-store/bin/darwin-arm64/video-store"
    }
  ]
}
2024-12-18_15-42-15.mp4
2024-12-18_15-41-04.mp4

Tested with standard RTSP resolution. Tested also with "weird" resolution using transform cam. See attached vids

@hexbabe hexbabe marked this pull request as ready for review December 18, 2024 20:12
@hexbabe hexbabe requested a review from seanavery December 18, 2024 20:45
README.md Show resolved Hide resolved
@seanavery
Copy link
Collaborator

@hexbabe Should we make framerate not required with a default of 20? May need to test out to make sure video still looks ok when framerate is off.

@hexbabe
Copy link
Collaborator Author

hexbabe commented Dec 18, 2024

@hexbabe Should we make framerate not required with a default of 20? May need to test out to make sure video still looks ok when framerate is off.

Gotcha I can make a quick change and test tomorrow

@seanavery
Copy link
Collaborator

@hexbabe Can we also adjust conf test around cam_props

t.Run("Fails Configuration No CamProps", func(t *testing.T) {
timeoutCtx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
r, err := setupViamServer(timeoutCtx, config5)
test.That(t, err, test.ShouldBeNil)
defer r.Close(timeoutCtx)
cam, err := camera.FromRobot(r, videoStoreComponentName)
test.That(t, err, test.ShouldNotBeNil)
test.That(t, cam, test.ShouldBeNil)
test.That(t, err.Error(), test.ShouldContainSubstring, "cam_props")
})

@hexbabe hexbabe requested review from seanavery and removed request for seanavery December 19, 2024 18:01
@hexbabe
Copy link
Collaborator Author

hexbabe commented Dec 19, 2024

Just tested that it works with an empty cam props and also a nil cam props

@hexbabe
Copy link
Collaborator Author

hexbabe commented Dec 19, 2024

I also tested to make sure that when we return an error after frame fetch retries reaches the threshold, we keep re-trying to register the model and we don't just give up setting up the module if we can't get a frame. See

@hexbabe hexbabe merged commit 2f80374 into viam-modules:main Dec 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants