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

Added simple RTSP support and custom video sink option #40

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chm10
Copy link

@chm10 chm10 commented Aug 24, 2024

New feature #39

  • Implement RTSP source handling in the GStreamer pipeline
  • Add command-line argument for specifying custom video sink
  • Update pipeline string generation to include RTSP source
  • Enhance flexibility by allowing user to choose video sink
  • Improve error handling for invalid network types
  • Refactor pipeline string generation for better readability

Disclaimer:
I am not the owner or maintainer of this project. This pull request is a suggested solution based on
the information available in issue #39. It is provided "as is", without warranty of any kind, express
or implied. The project maintainers should review and test these changes thoroughly before considering
implementation. I'm open to feedback and further modifications if needed.

- Implement RTSP source handling in the GStreamer pipeline
- Add command-line argument for specifying custom video sink
- Update pipeline string generation to include RTSP source
- Enhance flexibility by allowing user to choose video sink
- Improve error handling for invalid network types
- Refactor pipeline string generation for better readability
@giladnah
Copy link
Contributor

@chm10 Thanks for your input.

The current code is hardcoded to support only H.265 videos. Please convert it to use auto-pluggers like decodebin. It should look something like this: rtspsrc location=rtsp://your_rtsp_stream_url ! application/x-rtp,media=video ! decodebin ! videoconvert ! autovideosink

Once that's done, I'll be able to merge it.

Thanks a lot for your contributions; they are highly appreciated. I'd be happy to merge your code here.

@chm10
Copy link
Author

chm10 commented Aug 25, 2024

@chm10 Thanks for your input.

The current code is hardcoded to support only H.265 videos. Please convert it to use auto-pluggers like decodebin. It should look something like this: rtspsrc location=rtsp://your_rtsp_stream_url ! application/x-rtp,media=video ! decodebin ! videoconvert ! autovideosink

Once that's done, I'll be able to merge it.

Thanks a lot for your contributions; they are highly appreciated. I'd be happy to merge your code here.

I will change the code. I only have devices using H.265 rtsp for now.
Thank you for the suggestions.

…lo-ai#40)

Update the GStreamer pipeline to use decodebin for RTSP video sources
Remove hardcoded H.265 video decoding elements
Automatically select the appropriate decoder based on the incoming video stream's codec
Ensure compatibility with various video codecs without explicit specification
Maintain existing functionality for other video sources (RPI, USB, file)
Copy link
Contributor

@giladnah giladnah left a comment

Choose a reason for hiding this comment

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

See remarks.
Please add example for RTSP url with user and password.
After changes i'll run tests on RPi and x86 to make sure it works.

@@ -92,6 +92,7 @@ class GStreamerDetectionApp(GStreamerApp):
def __init__(self, args, user_data):
# Call the parent class constructor
super().__init__(args, user_data)
self.video_sink = args.video_sink if hasattr(args, 'video_sink') else 'autovideosink'
Copy link
Contributor

Choose a reason for hiding this comment

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

Not used please remove

@@ -216,6 +225,8 @@ def get_pipeline_string(self):
default=None,
help="Path to costume labels JSON file",
)
parser.add_argument('--video-sink', default='autovideosink',
Copy link
Contributor

Choose a reason for hiding this comment

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

not used

source_element = (
f"rtspsrc location={self.video_source} name=src_0 ! "
"application/x-rtp,media=video ! "
"decodebin ! "
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need to add some queues between decodebin, videoconvert and videoscale. These are big tasks which can benefit if separated to multiple threads.

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