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

Add FileStreamFrameGrabber #62

Merged
merged 9 commits into from
Dec 17, 2024
Merged

Add FileStreamFrameGrabber #62

merged 9 commits into from
Dec 17, 2024

Conversation

tyler-romero
Copy link
Member

@tyler-romero tyler-romero commented Dec 14, 2024

Add a framegrabber class that can grab frames from a filestream. This works on mp4 and mjpg available either locally and or remotely via a url.

Adding support for this class will let us fully switch to using framegrab within https://github.com/groundlight/stream

README.md Outdated Show resolved Hide resolved
README.md Outdated
'file_path': 'path/to/your/video.mjpeg' # or .mp4, .avi, etc.
},
'options': {
'max_fps': 2, # Decimate stream if FPS is too high
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is perhaps confusing to end users. Maybe something like "specify a lower FPS than the original video's FPS if desired. Framegrab will skip extra frames as needed."

I also wonder if we should just call this "fps" instead of "max_fps". I was the one who introduced the term "max_fps" for RTSP streams, and it is admittedly confusing. It determines the rate at which the frames are grabbed from the network stream, effectively emptying the buffer. As long as this value is greater than or equal to the rate frames are actually being published by the camera, the buffer won't grow, hence "max_fps".

The way you are using it is a bit different. You can effectively lower the FPS of the camera if you want to. If you tried the same thing with an RTSP grabber, it would cause problems with the buffer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, its still a max_fps though - we cant speed up the video's underlying FPS and so this can only cap the FPS.

README.md Outdated
config = {
'input_type': 'file_stream',
'id': {
'file_path': 'path/to/your/video.mjpeg' # or .mp4, .avi, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I tried it with a .mov, and it worked, so that's nice. Maybe we should mention that.

| options.keep_connection_open | True | - | optional | - | - | - | optional | optional |
| options.max_fps | 30 | - | optional | - | - | - | - | - |

| Configuration Name | Example | Generic USB | RTSP | Basler | Realsense | Raspberry Pi CSI2 | HLS | YouTube Live | File Stream |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table is becoming a little hard to read on github.com due to the need for horizontal scrolling. Not a huge deal, but a little annoying. Not sure to fix this aside from redoing it in html/css.

Copy link
Contributor

@timmarkhuff timmarkhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I noted one typo in the documentation and added a few other suggestions/comments.

@tyler-romero tyler-romero merged commit a4f1fd8 into main Dec 17, 2024
6 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